Commit d115cec6 authored by June's avatar June

feature:many

parent 21220c8d
<script>
import { mapActions } from 'vuex'
// import { wxLogin } from '@/apis/user.js'
import { login_wx } from '@/utils/modules/login.js'
import dayjs from 'dayjs'
import { removeStorage } from '@/lib/storage/index.js'
export default {
onLaunch: function() {
this.setSystemInfo() // 获取系统信息
......@@ -22,6 +22,14 @@ export default {
// uni.setEnableDebug({
// enableDebug: true
// })
uni.getStorageInfo({
success: res => {
if(res.currentSize > 5120) {
removeStorage('search-history')
}
}
})
},
methods: {
......@@ -70,4 +78,7 @@ export default {
.primaryColor {
color: $primary!important;
}
.descColor {
color: $desc!important;
}
</style>
......@@ -16,16 +16,6 @@ export function addressList(params) {
})
}
/**
* @desc 默认收货地址接口
*/
export function defaultAddress() {
return request({
url: `zsxcx/getDefaultAddressXcx.htm`,
method: 'post'
})
}
/**
* @desc 新增/编辑地址
* @params { } look docs
......
......@@ -33,6 +33,7 @@ export function cateGoodsList(cat_id, keywords = '') {
export function homeCategory() {
return request({
url: 'zsxcx/indexGoodsXcx.htm',
method: 'post'
method: 'post',
needMask: true
})
}
\ No newline at end of file
......@@ -13,7 +13,8 @@ export function preConfirmOrderData(params) {
return request({
url: 'zsxcx/orderDetail.htm',
method: 'post',
data: params
data: params,
needMask: true
})
}
......@@ -25,34 +26,76 @@ export function confirmOrder(params) {
return request({
url: 'zsxcx/orderInfoXcx.htm',
method: 'post',
data: params
data: params,
needMask: true
})
}
/**
* @desc 获取订单列表
*/
export function orderList() {
export function orderList(params) {
return request({
url: `${baseUrl}/a`
url: 'zsxcx/orderXcx.htm',
method: 'post',
data: params
})
}
/**
* @desc 订单详情
*/
export function orderDetail() {
export function orderDetail(order_sn) {
return request({
url: 'zsxcx/snapshotXcx.htm',
method: 'post',
data: {
order_sn
},
needMask: true
})
}
/**
* @desc 提醒发货接口
*/
export function remindOrder({order_id, order_sn}) {
return request({
url: `${baseUrl}/a`
url: 'zsxcx/remindXcx.htm',
method: 'post',
data: {
order_sn,
order_id
},
needMask: true
})
}
/**
* @desc 删除订单
* @desc 取消订单
*/
export function delOrder() {
export function cancelDetail1(order_sn) {
return request({
url: `${baseUrl}/a`
url: 'zsxcx/orderCancelXcx.htm',
method: 'post',
data: {
order_sn
},
needMask: true
})
}
/**
* @desc 确认收货
*/
export function recieveOrder(order_sn) {
return request({
url: 'zsxcx/orderConfirmXcx.htm',
method: 'post',
data: {
order_sn
}
})
}
\ No newline at end of file
<template>
<view
class="nav-bar"
:style="cNavSty"
>
<view class="title" :style="cTitleStyle">
<view v-if="showBack" class="back-icon" :style="backStyle" @click="handleBack">
<view class="icon"></view>
</view>
<view class="title-inner">{{title}}</view>
</view>
</view>
</template>
<script>
import { mapState } from 'vuex'
export default {
props: {
color: {
type: String,
default: '#333'
},
showBack: {
type: Boolean,
default: false
},
title: {
type: String,
default: ''
},
bg: {
type: String,
default: '#fff'
}
},
computed: {
...mapState(['systemInfo']),
cNavSty() {
const { systemInfo, menuButtonInfo } = this.systemInfo
const space = menuButtonInfo.top - systemInfo.statusBarHeight
return `height: ${menuButtonInfo.bottom + space}px;background-color: ${this.bg};color: ${this.color};`
},
backStyle() {
const { systemInfo, menuButtonInfo } = this.systemInfo
const space = menuButtonInfo.top - systemInfo.statusBarHeight // 上下间距
const navH = menuButtonInfo.bottom + space
const titleH = navH - systemInfo.statusBarHeight
const lrSpace = systemInfo.windowWidth - menuButtonInfo.right // 左右间距
return `height: ${titleH}px;left: ${lrSpace}px;`
},
cTitleStyle() {
const { systemInfo, menuButtonInfo } = this.systemInfo
const space = menuButtonInfo.top - systemInfo.statusBarHeight // 上下间距
const navH = menuButtonInfo.bottom + space
const titleH = navH - systemInfo.statusBarHeight
const lrSpace = systemInfo.windowWidth - menuButtonInfo.right // 左右间距
const v = systemInfo.system.includes('iOS') ? 'center' : 'flex-start'
return `height: ${titleH}px;font-size: ${systemInfo.fontSizeSetting}px;padding: 0 ${lrSpace}px;justify-content: ${v};margin-top: ${systemInfo.statusBarHeight}px;`
}
},
methods: {
handleBack() {
uni.navigateBack()
}
}
}
</script>
<style lang="scss" scoped>
.nav-bar {
position: fixed;
left: 0;
right: 0;
top: 0;
z-index: 998;
width: 100%;
.title {
position: relative;
box-sizing: border-box;
display: flex;
align-items: center;
.back-icon {
position: absolute;
top: 50%;
transform: translateY(-50%);
width: 20px;
z-index: 999;
display: flex;
align-items: center;
.icon {
@include backBtn(18rpx, 34rpx)
}
}
.title-inner {
box-sizing: border-box;
padding: 0 30px;
max-width: 260px;
overflow: hidden;
white-space: nowrap;
text-overflow: ellipsis;
}
}
}
</style>
......@@ -2,7 +2,7 @@
<view class="empty flex flex-column j-center a-center">
<image
style="width: 400rpx;"
class="my-4"
class="mb-2"
:src="iconSrc"
mode="widthFix"
/>
......
import { isArray } from "@/utils/types.js"
// 判断是否符合购买条件
function judgePay(skuData) {
for(let i = 0, j = skuData.length; i < j; i ++) {
......
......@@ -28,25 +28,20 @@
:params="{
index
}"
:max="~~item.inventory"
@change="numberChange"
/>
</view>
</view>
<view class="w-100 flex j-between a-center">
<view class="flex-1 text-left price-txt">
<view class="flex-1 flex j-start a-center price-txt">
<!-- 如果不是阶梯价 ? 价格 === 0 ? 询价 : 固定售价 -->
<template v-if="goods.is_inquiry">
<template v-if="goods.is_inquiry === '1'">
<text>询价</text>
</template>
<template v-else>
<!-- <text v-if="item.is_tiered === '1'">{{item.tiered_pri}}</text>
<text v-else-if="item.is_tiered === '0' && item.price === '0'">询价</text>
<text v-else>{{item.price}}</text> -->
<price
:is_inquiry="goods.is_inquiry"
:price="item.price"
/>
<text class="originPrice ml-1">{{item.original_price}}</text>
<text>{{item.price}}</text>
<text class="originPrice ml-1">{{item.original_price || 0}}</text>
</template>
</view>
......@@ -55,7 +50,17 @@
<text v-else class="primaryColor">库存需咨询商家</text>
</view>
<view class="payCount text-center">
<text v-if="~~item.origin_number_sku">{{item.origin_number_sku}}{{item.unit}}起购</text>
<text v-if="~~item.origin_number_sku">{{item.origin_number_sku + item.unit}}起购</text>
</view>
</view>
<view class="mt-2 w-100 descColor flex j-start a-center flex-wrap font-24" v-if="item.is_tiered === '1'">
<view
class="mr-3 mb-2"
v-for="tiered_pri in item.tiered_pri"
:key="tiered_pri.num"
>
¥{{tiered_pri.price }}<text class="ml-1">≥{{tiered_pri.num +'/' + item.unit}}</text>
</view>
</view>
</view>
......@@ -63,8 +68,8 @@
<view class="flex w-100 a-center flex-column font-28 mt-2">
<view class="as-end">
<text class="btn-theme">{{totalCounts}}</text>
<text class=" ml-2 price btn-theme">¥{{goods.is_inquiry ? '--' : totalPrice}}</text>
<text class="primaryColor">{{totalCounts}}</text>{{goods.unit || ''}}
<text class=" ml-2 price primaryColor">¥{{~~goods.is_inquiry ? '--' : totalPrice}}</text>
</view>
</view>
......@@ -130,17 +135,21 @@ export default {
*/
async show(params) {
try{
console.log(params)
this.goods = params.goodsInfo
this.skuData = params.skuData
this.skuData.forEach(item => item.counts = item.origin_number_sku || 1)
this.skuData.forEach(item => {
item.tiered_pri = item.tiered_pri && typeof item.tiered_pri === 'string' ? JSON.parse(item.tiered_pri) : ''
item.counts = 0
})
console.log('-----------------------------------------------------------')
console.log(this.skuData)
console.log('-----------------------------------------------------------')
this.$refs.goodsPopup.open()
this.total()
}catch(e){
console.log(e)
this.$toast({title: e.msg || '程序错误'})
}
},
hide() {
......@@ -168,12 +177,30 @@ export default {
total() {
const skuData = this.skuData
this.totalCounts = skuData.reduce((pre, cur) => { return pre + ~~cur.counts}, 0)
this.totalPrice = skuData.reduce((pre, cur) => { return pre + ~~cur.price * ~~cur.counts }, 0)
this.totalPrice = skuData.reduce((pre, cur) => {
const price = ~~cur.price
const counts = ~~cur.counts
if(cur.is_tiered === '1') { // 阶梯价 询价不管,不展示,按固定价计算
const tiered_pri = cur.tiered_pri
// console.log(cur.tiered_pri.find(item => item.num < counts))
for(let i = 0, j = tiered_pri.length; i < j; i ++) {
if(counts >= tiered_pri[j-1].num) {
return pre + tiered_pri[j-1].price * counts
} else if(tiered_pri[i].num > counts) {
return pre + (i - 1 >= 0 ? tiered_pri[i - 1].price : ~~cur.price) * counts
}
}
// return pre + cur.tiered_pri.find(item => item.num > counts).price * counts
} else {
return pre + price * counts
}
}, 0)
},
// 加入购物车
handleCart() {
const skuData = this.skuData
if(this.totalCounts === 0) return this.$toast({title: '请选择购买数量'})
if(!this.judgePay(skuData)) return this.$toast({title: '购买数量不能少于起购数量'})
const fn = []
for(let i = 0, j = skuData.length; i < j; i ++) {
......@@ -202,6 +229,7 @@ export default {
const skuData = this.skuData
console.log(skuData)
if(skuData.length === 0) return
if(this.totalCounts === 0) return this.$toast({title: '请选择购买数量'})
// if(this.totalPrice === 0) return this.$toast({title: '请选择规格数量'})
if(!this.judgePay(skuData)) return this.$toast({title: '购买数量不能少于起购数量'})
const sku_ids = []
......@@ -220,6 +248,7 @@ export default {
uni.navigateTo({
url: `/pages/order/confirm-order?params=${encodeURIComponent(JSON.stringify(params))}`
})
this.hide()
}catch(e){
console.log(e)
}
......@@ -242,7 +271,7 @@ export default {
.sku-list {
height: 372rpx;
@include borderBox(30rpx, 20rpx);
@include borderBox(0, 20rpx);
.sku-item {
border-bottom: 1rpx solid $line;
}
......@@ -288,8 +317,5 @@ export default {
}
}
.btn-theme {
color: $primary;
}
}
</style>
<template>
<view class="wrpper flex j-between a-center">
<view class="wrpper flex j-between a-center" @touchmove.stop.prevent="clear">
<view
class="btn iconfont icon-jianhao flex j-center a-center"
:class="calVal <= min ? 'disabled' : null"
......@@ -8,8 +8,9 @@
<input
class="input"
type="number"
:value="calVal"
@input="inputVal"
v-model="calVal"
@confirm="inputVal"
@blur="inputVal"
/>
<view
class="btn iconfont icon-hao flex j-center a-center"
......@@ -47,16 +48,26 @@ export default {
},
watch: {
calVal: throttle(function(newVal) {
const max = this.max
const min = this.min
const newVal_number = ~~newVal
if(max && newVal_number >= max) return
if(newVal_number <= min) return
this.$emit('change', {
params: this.params,
val: ~~newVal
val: newVal_number
})
}, 800)
},
methods: {
clear(e) {
// TODO nvue 取消冒泡
e.stopPropagation()
return
},
subtraction() {
const val = this.calVal
if(val <= this.min) return this.$toast({title: `数量不能${this.min}`})
if(val <= this.min) return this.$toast({title: `数量不能${this.min}`})
this.calVal -= 1
},
add() {
......@@ -70,12 +81,15 @@ export default {
this.calVal += 1
},
inputVal(e) {
const inputVal = ~~e.detail.value
let inputVal = ~~e.detail.value
const max = this.max
const min = this.min
if(max && inputVal >= max) {
this.calVal = max
inputVal = max
this.$toast({title: '数量不能大于商品库存'})
return
} else if(inputVal < min) {
inputVal = min
this.$toast({title: `数量不能少于${min}`})
}
this.calVal = inputVal
}
......
<template>
<view class="w-100 content-wrap flex flex-column j-center a-center">
<image
class="mt-4"
style="width: 400rpx;"
src="../../static/images/common/isOverdue.png"
mode="widthFix"
/>
<view class="font-bold my-2">店铺已打烊</view>
<navigator
class="mx-5"
hover-class="none"
open-type="switchTab"
url="/pages/mine/index"
>如需查看历史购买记录,请前往<text class="em_word p-1">【我的】</text>登录查看</navigator>
</view>
</template>
<style lang="scss" scoped>
.content-wrap {
font-size: 20rpx;
color: #desc;
.em_word {
color: $primary;
}
}
</style>
......@@ -5,7 +5,7 @@
</template>
<template v-else-if="is_tiered === '1'">
<text class="mr-1">{{price}}</text>
<text class="origin-price" v-if="originPrice">{{originPrice}}</text>
<text class="origin-price" v-if="originPrice">{{originPrice || 0}}</text>
<text v-if="goods_unit">/{{goods_unit}}</text>
</template>
<template v-else>
......
<template>
<view v-if="showPopup" class="uni-popup" @touchmove.stop.prevent="clear">
<view v-show="showPopup" class="uni-popup" @touchmove.stop.prevent="clear">
<uni-transition :mode-class="['fade']" :styles="maskClass" :duration="duration" :show="showTrans" @click="onTap" />
<uni-transition :mode-class="ani" :styles="transClass" :duration="duration" :show="showTrans" @click="onTap">
<view class="uni-popup__wrapper-box" @click.stop="clear">
......
const env = {
release: 'https://www.gelifood.com/', // 正式版
release: 'https://www.gelifood.com', // 正式版
trial: 'https://d.gelifood.com', // 体验版
develop: 'https://d.gelifood.com' // 开发版
}
......
export default function Modal(options) {
if(Object.prototype.toString.call(options) !== "[object Object]") return
if(!options.content) {
return uni.showToast({
title: 'content不能为空',
icon: "none"
})
}
uni.showModal({
title: options.title || '提示',
content: options.content,
showCancel: options.showCancel || true,
cancelText: options.cancelText || '取消',
cancelColor: options.cancelColor || '#000000',
confirmText: options.confirmText || '确定',
confirmColor: '#FF661A',
success: res => {
if(res.confirm) {
console.log(options.cb)
options.cb && typeof options.cb === 'function' && options.cb()
}
}
})
}
\ No newline at end of file
......@@ -33,6 +33,9 @@ async function successRes(res, options, resolve, reject) {
const status = data.code
switch(status) {
case 10:
if(store.state.user.isOverdue) {
store.state.user.isOverdue = false
}
resolve({
status: true,
data: data.data,
......@@ -59,7 +62,9 @@ async function successRes(res, options, resolve, reject) {
})
break;
case -11: // 购买的服务过期
store.state.user.isOverdue = true
if(!store.state.user.isOverdue) {
store.state.user.isOverdue = true
}
return Toast({title: data.rep_msg})
break;
default:
......@@ -100,15 +105,15 @@ export function request (options) {
uni.showLoading({title: '加载中...', mask: true})
}
return new Promise((resolve, reject) => {
const isOverdue = store.state.user.isOverdue
if(isOverdue) {
reject({
status: false,
data: null,
msg: '服务已过期'
})
return
}
// const isOverdue = store.state.user.isOverdue
// if(isOverdue) {
// reject({
// status: false,
// data: null,
// msg: '服务已过期'
// })
// return
// }
const token = store.state.user.token || ''
const appid = store.state.user.appid || ''
uni.request({
......@@ -145,15 +150,15 @@ export function upload(options) {
options.url = `${baseUrl}/${options.url}`
uni.showLoading({title: '上传中...', mask: true})
return new Promise((resolve, reject) => {
const isOverdue = store.state.user.isOverdue
if(isOverdue) {
reject({
status: false,
data: null,
msg: '服务已过期'
})
return
}
// const isOverdue = store.state.user.isOverdue
// if(isOverdue) {
// reject({
// status: false,
// data: null,
// msg: '服务已过期'
// })
// return
// }
const token = store.state.user.token || ''
const appid = store.state.user.appid || ''
uni.uploadFile({
......
......@@ -19,4 +19,5 @@ export default function Toast(options) {
}, 500)
}
})
}
\ No newline at end of file
}
......@@ -7,8 +7,10 @@ import "@/utils/vue_extend.js" // 常用方法
// 全局组件
import emptyView from '@/components/empty-view/index.vue'
import uniPopup from '@/components/uni-popup/index.vue'
import cNav_bar from '@/components/c-nav_bar/index.vue'
Vue.component('empty-view', emptyView)
Vue.component('uni-popup', uniPopup)
Vue.component('c-nav_bar' , cNav_bar)
Vue.prototype.$store = store
......
import { cancelDetail1, remindOrder } from "@/apis/order.js"
import { isFunction } from '@/utils/types.js'
// 详细看文档
const order_statsu = {
'0': '待接单',
'1': '待付款',
'2': '交易关闭',
'5': '交易完成',
'6': '待发货',
'7': '待收货',
'9': '退货退款中',
'10': '已收货',
'11': '退款退货审核'
}
const order_statsu_d = {
}
const order_mixin = {
filters: {
},
methods: {
// 立即支付
orderPay() {
console.log('立即支付')
},
// 取消订单
async orderCancel(order_sn, cb) {
try{
const { status, data } = await remindOrder(order_sn)
if(status) {
cb && isFunction(cb) && cb()
this.$toast({title: '订单取消成功'})
}
}catch(e){
this.$toast({title: '取消失败'})
//TODO handle the exception
}
},
// 提醒发货
async orderRemind() {
try{
const { status, data } = await cancelDetail1(order_sn)
if(status) {
cb && isFunction(cb) && cb()
this.$toast({title: '提醒成功'})
}
}catch(e){
this.$toast({title: '提醒失败'})
//TODO handle the exception
}
console.log('提醒发货')
},
// 撤销退款退货申请
async orderRefundAll () {
try{
}catch(e){
this.$toast({title: '撤销失败'})
//TODO handle the exception
}
console.log('撤销退款退货申请')
},
// 撤销退款申请
async orderRefund() {
try{
}catch(e){
this.$toast({title: '撤销失败'})
//TODO handle the exception
}
console.log('撤销退款申请')
}
}
}
export default order_mixin
\ No newline at end of file
{
"pages": [
{
"path": "pages/order/order-detail",
"style": {
"navigationBarTitleText": "订单详情"
}
},
{
"path": "pages/home/index",
"style": {
......@@ -52,6 +47,12 @@
"navigationBarTitleText": "订单管理"
}
},
{
"path": "pages/order/order-detail",
"style": {
"navigationBarTitleText": "订单详情"
}
},
{
"path": "pages/order/confirm-order",
"style": {
......@@ -117,6 +118,24 @@
"style": {
"navigationBarTitleText": "店铺详情"
}
},
{
"path": "afterSales/apply",
"style": {
"navigationBarTitleText": "申请售后"
}
},
{
"path": "afterSales/detail",
"style": {
"navigationBarTitleText": "申请退款/退货"
}
},
{
"path": "pay_status/index",
"style": {
"navigationBarTitleText": "支付结果"
}
}
]
}],
......
......@@ -44,7 +44,7 @@ function dealArr(arr) {
}
return arr
}
export default {
getCartList,
editCartCount,
......
This diff is collapsed.
<template>
<view class="category-wrap w-100">
<!-- search bar -->
<view class="searchBar-wrap flex j-center a-center w-100">
<view class="search flex j-center a-center">
<image class="search-icon mr-1" src="/static/images/common/icon-search.png" mode="aspectFit" />
<text class="font-24">搜索商品</text>
<template v-if="isOverdue">
<view style="width: 100vw; height: 100vh;display: flex;justify-content: center;align-items: center;">
<over-due />
</view>
</view>
</template>
<!-- category 未优化,可以递归组件 -->
<view class="category flex j-between w-100 font-24">
<scroll-view
class="scroll-left"
scroll-y
:scroll-into-view="leftScrollName"
>
<!-- 一级分类 -->
<view
class="w-100 px-3 py-2"
v-for="(cate_1, cate_idx_1) in cate_list"
:key="cate_1.cat_id"
:class="cate1_current === cate_1.cat_id ? 'cate-active' : null"
<template v-else>
<!-- search bar -->
<view class="searchBar-wrap flex j-center a-center w-100">
<navigator
class="search flex j-center a-center"
hover-class="none"
url="/pages/search/index"
>
<view
class="mb-2"
@click.stop="cateChange(1, cate_1.cat_id, cate_idx_1)"
:class="cate1_current === cate_1.cat_id ? 'cate-1_active' : null"
>{{cate_1.cat_name}}</view>
<view v-show="cate1_current === cate_1.cat_id && cate_1.list.length > 0">
<!-- 二级分类 -->
<view
class="ml-2 mb-2"
v-for="(cate_2, cate_idx_2) in cate_1.list"
:key="cate_2.cat_id"
<image class="search-icon mr-1" src="/static/images/common/icon-search.png" mode="aspectFit" />
<text class="font-24">搜索商品</text>
</navigator>
</view>
<!-- category 未优化,可以递归组件 -->
<template v-if="goods_list.length === 0">
<view class="flex j-center a-center w-100 category">
<empty-view
iconSrc="/static/images/common/noGoods.png"
text="店铺尚未上架商品"
/>
</view>
</template>
<template v-else>
<view class="category flex j-between w-100 font-24">
<scroll-view
class="scroll-left"
scroll-y
:scroll-into-view="leftScrollName"
>
<!-- 一级分类 -->
<view
class="w-100 px-3 py-2"
v-for="(cate_1, cate_idx_1) in cate_list"
:key="cate_1.cat_id"
:class="cate1_current === cate_1.cat_id ? 'cate-active' : null"
@click.stop=""
>
<view
:class="cate2_current === cate_2.cat_id ? 'cate-2_active' : null"
@click.stop="cateChange(2, cate_2.cat_id, cate_idx_1, cate_idx_2)"
>{{cate_2.cat_name}}</view>
class="mb-2"
@click.stop="cateChange(1, cate_1.cat_id, cate_idx_1)"
:class="cate1_current === cate_1.cat_id ? 'cate-1_active' : null"
>{{cate_1.cat_name}}</view>
<view v-show="cate1_current === cate_1.cat_id && cate_1.list.length > 0">
<!-- 二级分类 -->
<view
class="ml-2 mb-2"
v-for="(cate_2, cate_idx_2) in cate_1.list"
:key="cate_2.cat_id"
>
<view
:class="cate2_current === cate_2.cat_id ? 'cate-2_active' : null"
@click.stop="cateChange(2, cate_2.cat_id, cate_idx_1, cate_idx_2)"
>{{cate_2.cat_name}}</view>
</view>
</view>
</view>
</view>
</scroll-view>
</view>
</scroll-view>
<view class="scroll-right flex-1">
<view class="cates_title">{{cate1_name + '-' + cate2_name}}</view>
<pull-list
ref="pullList"
:refresherEnabled="false"
@tolower='tolower'
>
<view
class="goods-item flex j-start a-center"
v-for="good in goods_list"
:key="good.goods_id"
@click="navDetail(good)"
>
<image
class="goods-cover mr-2"
lazy-load
:src="baseUrl + '/' + good.goods_thumb"
mode="aspectFit"
/>
<view class="goods-price flex-1 flex flex-column j-between font-28">
<view class="title">{{good.goods_name}}</view>
<view class="w-100 flex j-between a-center">
<text class="price-txt">¥152.50</text>
<image
class="cart-icon"
src="/static/images/common/icon-cart.png"
<view class="scroll-right flex-1">
<view class="cates_title">{{cate1_name}} {{cate2_name ? '-' + cate2_name : ''}}</view>
<pull-list
ref="pullList"
:refresherEnabled="false"
>
<view
class="goods-item flex j-start a-center"
v-for="good in goods_list"
:key="good.goods_id"
@click="navDetail(good)"
>
<image
class="goods-cover mr-2"
lazy-load
:src="baseUrl + '/' + good.goods_thumb"
mode="aspectFit"
@click.stop="handlePop(good)"
/>
<view class="goods-price flex-1 flex flex-column j-between font-28">
<view class="title">{{good.goods_name}}</view>
<view class="w-100 flex j-between a-center">
<view class="flex j-start a-center">
<price
:is_inquiry="good.is_inquiry"
:price="good.shop_price"
/>
<text class="primaryColor font-28">{{good.least_str}}</text>
</view>
<image
class="cart-icon"
src="/static/images/common/icon-cart.png"
mode="aspectFit"
@click.stop="handlePop(good)"
/>
</view>
</view>
</view>
</view>
<view class="empty-text text-center mt-4 p-2">到底了,看看别的分类吧~</view>
</pull-list>
</view>
<view class="empty-text text-center mt-4 p-2">到底了,看看别的分类吧~</view>
</pull-list>
</view>
</view>
<!-- 购物弹窗 -->
<goods-popup ref="popup" />
</view>
</template>
<!-- 购物弹窗 -->
<goods-popup ref="popup" />
</template>
</view>
</template>
......@@ -95,16 +126,15 @@
// 所有写法需要优化!!!
import pullList from '@/components/pull-list/index.vue'
import goodsPopup from '@/components/goods-popup/index.vue'
import overDue from '@/components/overDue-view/index.vue'
import price from '@/components/price/index.vue'
import { getCatetories, cateGoodsList } from '@/apis/category.js'
import { searchGoods, goodsSku } from '@/apis/goods.js'
import { baseUrl } from '@/config/index.js'
import { mapState, mapActions } from 'vuex'
let cat_id = 0
// const params = {
// keywords: '',
// cat_id: 0
// }
export default {
data() {
return {
......@@ -120,17 +150,21 @@ export default {
},
components: {
pullList,
goodsPopup
goodsPopup,
overDue,
price
},
computed: {
...mapState({
token: state => state.user.token
token: state => state.user.token,
isOverdue: state => state.user.isOverdue
})
},
async created() {
this.getCate()
},
onShow() {
this.getCateGoods()
if(this.token) {
this.setCount()
}
......@@ -143,11 +177,11 @@ export default {
if(status) {
let cate_list = this.cate_list
cate_list = data
cat_id = cate_list[0].list[0].cat_id
this.cate2_current = cate_list[0].list[0].cat_id
cat_id = cate_list[0].cat_id
this.cate1_current = cate_list[0].cat_id
this.cate_list = cate_list
this.cate1_name = cate_list[0].cat_name
this.cate2_name = cate_list[0].list[0].cat_name
// this.cate2_name = cate_list[0].list[0].cat_name
this.getCateGoods()
}
}catch(e){
......@@ -155,21 +189,19 @@ export default {
this.$toast({title: e.msg || '获取分类失败'})
}
},
// 切换分类 type === 1 分类1 type === 2 分类2, cate1_idx 分类一的下表
cateChange(type, cate_id, cate1_idx, cate2_idx) {
console.log(type, cate_id, cate1_idx)
if(cat_id === cate_id) return
const cate_list = this.cate_list
if(type === 1) {
const cate_list = this.cate_list
this.cate1_current = cate_id
this.cate2_current = cate_list[cate1_idx].list[0].cat_id
// params.cat_id = cate_list[cate1_idx].list[0].cat_id
cat_id = cate_list[cate1_idx].list[0].cat_id
this.cate2_current = "0" // 初始化,让二级不在激活状态
cat_id = cate_id
this.cate1_name = cate_list[cate1_idx].cat_name
this.cate2_name = cate_list[cate1_idx].list[0].cat_name
this.cate2_name = ''
} else if(type === 2) {
this.cate2_current = cate_id
// params.cat_id = cat_id
cat_id = cate_id
this.cate2_name = cate_list[cate1_idx].list[cate2_idx].cat_name
}
......@@ -199,9 +231,9 @@ export default {
})
},
tolower() {
console.log('触底了')
},
// tolower() {
// console.log('触底了')
// },
// 点击拉起弹窗
async handlePop(goods) {
......@@ -217,7 +249,8 @@ export default {
goodsInfo: {
cover: `${this.baseUrl}/${goods.goods_thumb}`,
title: goods.goods_name,
is_inquiry: goods.is_inquiry
is_inquiry: goods.is_inquiry,
unit: goods.goods_unit
},
skuData: data
}
......@@ -317,6 +350,7 @@ export default {
.cart-icon {
width: 34rpx;
height: 32rpx;
padding: 5rpx 20rpx;
}
}
}
......
<template>
<view class="back-wrap flex j-start a-center" :style="menuSty" @click="handleBack">
<!-- <image class="icon" src="/static/images/common/icon-back.png" mode="aspectFit"></image> -->
<icon class="icon ml-1"></icon>
</view>
</template>
<script>
import { mapState } from 'vuex'
export default {
computed: {
...mapState({
menuButtonInfo: state => state.systemInfo.menuButtonInfo,
systemInfo: state => state.systemInfo.systemInfo
}),
menuSty() {
const menuButtonInfo = this.menuButtonInfo
const systemInfo = this.systemInfo
const left = systemInfo.windowWidth - menuButtonInfo.right
const top = menuButtonInfo.bottom - menuButtonInfo.height
return `width: ${menuButtonInfo.height}px;height: ${menuButtonInfo.height}px;left: ${left}px;top: ${top}px;`
}
},
methods: {
handleBack() {
uni.navigateBack()
}
}
}
</script>
<style lang="scss" scoped>
.back-wrap {
position: fixed;
z-index: 999;
border-radius: 50%;
.icon {
@include backBtn(18rpx, 34rpx)
}
}
</style>
<template>
<view class="wrapper w-100">
<c-nav_bar
showBack
title="商品详情"
bg="rgba(0, 0, 0, 0)"
/>
<!-- <left-menu-button /> -->
<back-btn />
<view class="swiper-wrap">
<swiper
......@@ -13,11 +17,12 @@
@change="swiperChange"
>
<swiper-item
class="w-100"
class="w-100 flex j-center a-center"
v-for="(item, index) in detail.imgs"
:key="index"
>
<image
<image
class="w-100"
:src="baseUrl + '/' + item.img_url"
lazy-load
mode="widthFix"
......@@ -25,7 +30,7 @@
</swiper-item>
</swiper>
<view class="cur-view font-24 px-1">{{swiperCurrent + 1}} / {{detail.imgs.length}}</view>
<view class="cur-view font-24 px-1">{{swiperCurrent + 1}} / {{detail.imgs.length || 0}}</view>
</view>
<view class="goods-info mb-2">
......@@ -33,7 +38,7 @@
<view class="font-28 font-bold mb-2">{{detail.goods_name}}</view>
<view class="counts w-100 flex j-start a-center">
<view class="mr-4">现库存:{{inventory}}</view>
<view>总销量:{{detail.virtual_quantity_sold}}</view>
<view>总销量:{{detail.virtual_quantity_sold || 0}}</view>
</view>
</view>
......@@ -41,8 +46,9 @@
<!-- 物流 -->
<!-- delivery_open_type 派送方式的物流信息展示是否开启(1为开启,0为关闭)
detail.delivery_open_type === '1' || detail.raising_open_type === '1' 格利小程序
raising_open_type 自提方式判断是否开启(1为开启,0为关闭) -->
<view class="logistics mb-2" v-if="detail.delivery_open_type === '1' || detail.raising_open_type === '1'">
<view class="logistics mb-2" v-if="logisticsTab.length > 0">
<view class="pb-2 font-28 flex j-start a-center">
<view class="name">物流:</view>
<view class="content flex-1 flex j-start a-center text-center">
......@@ -71,16 +77,25 @@
</view>
<view class="font-28" v-show="logistics_cur === 1">
<view class="name">自提地址:</view>
<scroll-view
class="w-100 address-scroll"
scroll-y
>
<template v-if="detail.raising_address.length <= 3">
<view
class="address-item"
v-for="(item, index) in detail.raising_address"
:key="index"
>{{item.x_province + item.x_city + item.x_district + item.t_address_name}}</view>
</scroll-view>
</template>
<template v-else>
<scroll-view
class="w-100 address-scroll"
scroll-y
>
<view
class="address-item"
v-for="(item, index) in detail.raising_address"
:key="index"
>{{item.x_province + item.x_city + item.x_district + item.t_address_name}}</view>
</scroll-view>
</template>
</view>
</view>
......@@ -124,8 +139,8 @@
</view>
</view>
<view class="right font-28 text-center">
<view class="cart-btn" @click="handlePopup">加入购物车</view>
<view class="pay-btn" @click="handlePopup">立即购买</view>
<view class="cart-btn" @click.stop="handlePopup">加入购物车</view>
<view class="pay-btn" @click.stop="handlePopup">立即购买</view>
</view>
</view>
......@@ -136,13 +151,13 @@
<script>
// import leftMenuButton from './components/left-menuButton.vue'
import backBtn from './components/back-btn.vue'
import uParse from '@/components/parse/parse.vue'
import price from '@/components/price/index.vue'
import goodsPopup from '@/components/goods-popup/index.vue'
import { goodDetail, goodsSku, collectGoods } from '@/apis/goods.js'
import { baseUrl } from '@/config/index.js'
import { makePhoneCall } from '@/utils/common.js'
import { makePhoneCall, throttle } from '@/utils/common.js'
import { mapState } from 'vuex'
let goods_id = null
export default {
......@@ -163,7 +178,6 @@ export default {
},
components: {
// leftMenuButton,
backBtn,
uParse,
price,
goodsPopup
......@@ -183,13 +197,20 @@ export default {
const detail = this.detail
if(!detail) return []
// + 将字符串0 和 1转为数字
if(+detail.delivery_open_type && +detail.raising_open_type) {
const delivery_open_type = ~~detail.delivery_open_type
const raising_open_type = ~~detail.raising_open_type
if(delivery_open_type && raising_open_type) {
this.logistics_cur = 0
return [{id: 0, title: '物流派送'}, {id: 1, title: '买家自提'}]
} else if (+detail.delivery_open_type && +detail.raising_open_type) {
} else if (delivery_open_type && !raising_open_type) {
this.logistics_cur = 0
return [{id: 0, title: '物流派送'}]
} else if (+detail.delivery_open_type && +detail.raising_open_type){
return [{id: 1, title: '买家自提'}]
} else if (!delivery_open_type && raising_open_type){
this.logistics_cur = 1
return [{id: 1, title: '买家自提'}]
} else {
console.log('EEE')
return []
}
},
......@@ -233,10 +254,10 @@ export default {
try{
const { status, data } = await goodsSku(goods_id)
if(status) {
this.skuData = data
if(!data) return
this.inventory = data.reduce((prev, cur) => {
return prev + (+cur.adsale_inventory)
this.skuData = data
this.inventory = data.reduce((pre, cur) => {
return pre + ~~cur.inventory
}, 0)
}
}catch(e){
......@@ -271,7 +292,7 @@ export default {
},
// sku弹窗
handlePopup() {
handlePopup: throttle(function() {
const skuData = this.skuData
const detail = this.detail
if(!skuData & skuData.length) return this.$toast({title: '该商品暂无库存'})
......@@ -279,12 +300,13 @@ export default {
goodsInfo: {
cover: `${this.baseUrl}/${detail.goods_thumb}`,
title: detail.goods_name,
is_inquiry: detail.is_inquiry
is_inquiry: detail.is_inquiry,
unit: skuData[0].unit
},
skuData: skuData
}
this.$refs.popup.show(params)
},
}, 300),
// 呼叫老板
callPhone() {
......
......@@ -17,10 +17,13 @@
<view class="goods-info flex flex-column j-between">
<view class="title font-28 my-1">{{item.goods_name}}</view>
<view class="w-100 flex j-between a-center mt-1 mb-2">
<price
:is_inquiry="item.is_inquiry"
:price="item.shop_price"
/>
<view class="flex j-start a-center">
<price
:is_inquiry="item.is_inquiry"
:price="item.shop_price"
/>
<text class="primaryColor font-28">{{item.least_str}}</text>
</view>
<image
class="cart-btn"
@click.stop="handlePop(item)"
......@@ -67,7 +70,6 @@ export default {
title: '加载中...',
mask: true
})
console.log(goods)
const { status, data } = await goodsSku(goods.goods_id)
if(status) {
console.log(data)
......@@ -76,7 +78,8 @@ export default {
goodsInfo: {
cover: `${this.baseUrl}/${goods.goods_thumb}`,
title: goods.goods_name,
is_inquiry: goods.is_inquiry
is_inquiry: goods.is_inquiry,
unit: goods.goods_unit
},
skuData: data
}
......@@ -98,7 +101,7 @@ export default {
.list-item {
box-sizing: border-box;
width: 330rpx;
height: 480rpx;
height: 490rpx;
background-color: $white;
border-radius: 8rpx;
.goods_cover {
......@@ -113,6 +116,7 @@ export default {
.cart-btn {
width: 34rpx;
height: 32rpx;
padding: 5rpx 20rpx;
}
}
}
......
......@@ -13,8 +13,8 @@ const searchParams = {
async function searchData () {
try{
const searchRes = await this.loadmore.getList(searchParams, searchGoods)
console.log(searchRes)
if(searchRes.status) {
if(!searchRes.data.length) return
this.$set(this.searchList, this.searchList.length, searchRes.data)
}
}catch(e){
......@@ -27,14 +27,31 @@ async function getHomeCate() {
const { status, data } = await homeCategory()
if(status) {
this.cate_data = data
if(this.checkShowAll(data)) {
this.searchData()
}
}
}catch(e){
console.log(e)
//TODO handle the exception
}
}
/**
* @desc 检查是否需要加载全部商品(综合商品);当有推荐的几个分类时,不加载这个综合商品
* @param {Object} Obj (cate_data)
*/
function checkShowAll(Obj) {
if(Obj === null) return true
const keysArr = Object.keys(Obj)
if(keysArr.length > 0 && keysArr.some(item => Obj[item] && Obj[item].length > 0)) {
return false
} else {
return true
}
}
export default {
searchData,
getHomeCate
getHomeCate,
checkShowAll
}
\ No newline at end of file
......@@ -12,12 +12,12 @@
</view>
<view class="introduct flex-1 ml-2">
<view class="shop-name mb-2">{{storeInfo.shop_name || ''}}</view>
<view>{{appid || ""}}</view>
<view class="intro-deatil font-24">简介: {{storeInfo.shop_intro || ''}}</view>
</view>
</view>
<view class="w-100">
<view class="menu pb-4 mb-1 w-100 flex j-around a-center flex-nowrap">
<view
......@@ -65,22 +65,19 @@
<view>分享</view>
</label>
</view>
<!-- search bar -->
<search-bar bg="#f8f8f8" innerBg="#fff" />
</view>
<!-- content -->
<template v-if="isOverdue">
<view class="w-100 content-wrap flex flex-column j-center a-center" style="font-size: 20rpx;color: ##7F7F7F;">
<image class="mt-4" style="width: 400rpx;" src="../../static/images/common/isOverdue.png" mode="widthFix"></image>
<view class="font-bold my-2">店铺已打烊</view>
<view class="mx-5">如需查看历史购买记录,请前往<text class="em_word">【我的】</text>登录查看</view>
</view>
<over-due />
</template>
<template v-else>
<!-- search bar -->
<search-bar bg="#f8f8f8" innerBg="#fff" />
<view class="w-100 content-wrap">
<block v-if="false">
<block v-if="!cate_data.xplist.length && !cate_data.cxlist.length && !cate_data.bklist.length && !searchList.length">
<empty-view
iconSrc="/static/images/common/noGoods.png"
text="店铺尚未上架商品"
......@@ -97,7 +94,7 @@
<goods-module
v-if="cate_data.cxlist.length > 0"
title="销商品"
title="销商品"
:list="cate_data.cxlist"
@purchase="purchase"
/>
......@@ -113,7 +110,6 @@
<!-- 综合商品 -->
<template v-if="searchList.length > 0">
<view class="w-100">
<view class="font-bold font-36 px-3 py-2">综合商品</view>
<view class="list-wrap w-100 flex j-start a-center flex-wrap">
<block
v-for="(item, index) in searchList"
......@@ -169,6 +165,7 @@ import searchBar from '@/components/search-bar/index.vue'
import goodsModule from './components/goods-module.vue'
import goodsPopup from '@/components/goods-popup/index.vue'
import price from '@/components/price/index.vue'
import overDue from '@/components/overDue-view/index.vue'
import LoadMore from '@/utils/load-more.js'
import { checkLogin } from '@/utils/modules/login.js'
......@@ -192,18 +189,18 @@ export default {
searchBar,
goodsModule,
goodsPopup,
price
price,
overDue
},
computed: {
...mapState({
isOverdue: state => state.user.isOverdue,
token: state => state.user.token,
storeInfo: state => state.user.storeInfo,
appid: state => state.user.appid
storeInfo: state => state.user.storeInfo
})
},
created() {
// 实例化分页方法
this.loadmore = new LoadMore()
......@@ -211,6 +208,8 @@ export default {
},
onShow() {
// 实时更新店铺信息
this.getStoreInfo()
if(this.token) {
this.setCount()
}
......@@ -231,6 +230,8 @@ export default {
uni.showLoading({
title: '加载中...'
})
this.getStoreInfo()
this.getHomeCate()
let timer = setTimeout(() => {
clearTimeout(timer)
timer = null
......@@ -242,17 +243,22 @@ export default {
// 上拉加载更多
onReachBottom() {
console.log('触底')
this.searchData()
const cate_data = this.cate_data
if(this.checkShowAll(cate_data)) {
console.log('pass')
this.searchData()
}
},
onShareAppMessage() {
return {
title: '分享title'
title: this.storeInfo.shop_name
}
},
methods: {
...mapActions('cart', ['setCount']),
...mapActions('user', ['getStoreInfo']),
...indexModule,
purchase(e) {
......@@ -292,16 +298,15 @@ export default {
})
const { status, data } = await goodsSku(goods.goods_id)
if(status) {
console.log(data)
const params = {
goodsInfo: {
cover: `${this.baseUrl}/${goods.goods_thumb}`,
title: goods.goods_name,
is_inquiry: goods.is_inquiry
is_inquiry: goods.is_inquiry,
unit: goods.goods_unit
},
skuData: data
}
console.log(params)
this.$refs.popup.show(params)
}
uni.hideLoading()
......@@ -352,9 +357,6 @@ export default {
.content-wrap {
margin-top: 10rpx;
.em_word {
color: $primary;
}
.list-wrap {
.list-item {
......
......@@ -37,7 +37,7 @@
</view>
<view class="clearfix">
<view class="forget font-24 py-1" @click="handleForget">忘记密码</view>
<view v-if="form.lgtype === 3" class="forget font-24 py-1" @click="handleForget">忘记密码</view>
</view>
<view
......@@ -52,7 +52,6 @@
>密码登录</view>
</view>
<view class="agreement-wrap text-center">
<view class="wx-login_title mb-2">微信快捷登录</view>
<label for="getPhone">
......@@ -79,7 +78,7 @@
open-type="getPhoneNumber"
@getphonenumber="getPhoneNumber"
></button>
</view>
</template>
......@@ -88,11 +87,11 @@ import common from './common.js'
import { timerFn } from '@/utils/common.js'
import { loginSms } from '@/apis/user.js'
import { mapState, mapActions } from 'vuex'
import md5 from 'md5'
const userPlachelderStr = {
1: '',
2: '请输入手机号码',
3: '请输入用户名或手机号码'
3: '请输入用户名'
}
export default {
data() {
......@@ -134,6 +133,7 @@ export default {
case 3:
const accoutValidaErr = this.accoutValidate()
if(accoutValidaErr) return this.$toast({title: accoutValidaErr})
this.loginCommon(this.form)
break;
default:
......
<template>
<view class="w-100">
<view class="nav-title w-100" :style="navTitleSty">我的</view>
<!-- <view class="nav-title w-100" :style="navTitleSty">我的</view> -->
<c-nav_bar
title="我的"
bg="rgba(0, 0, 0, 0)"
color='#fff'
/>
<!-- userInfo -->
<view class="user-wrap flex j-start a-center w-100" @click="handleAvatar">
......@@ -10,7 +15,9 @@
class="avatar mr-2"
:src="baseUrl + '/' + userInfo.avatar"
/>
<open-data v-else class="avatar mr-2" type="userAvatarUrl"></open-data>
<view class="avatar mr-2" v-else>
<open-data type="userAvatarUrl"></open-data>
</view>
<view v-if="userInfo.nickname">{{userInfo.nickname}}</view>
<open-data v-else type="userNickName" lang="zh_CN"></open-data>
......@@ -75,16 +82,25 @@
<!-- 功能与服务 -->
<view class="server-wrap">
<view class="title font-28 font-bold">功能与服务</view>
<view class="server-item font-28 flex j-between a-center py-2" @click="phoneCall">
<view class="title font-28 font-bold pt-3">功能与服务</view>
<view
class="server-item font-28 flex j-between a-center py-3"
@click="phoneCall"
>
<text>联系老板</text>
<icon class="right_arrow" />
</view>
<view class="server-item font-28 flex j-between a-center py-2" @click="nav('address')">
<view
class="server-item font-28 flex j-between a-center py-3"
@click="nav('address')"
>
<text>地址管理</text>
<icon class="right_arrow" />
</view>
<view class="server-item font-28 flex j-between a-center py-2" @click="nav('store')">
<view
class="server-item font-28 flex j-between a-center py-3"
@click="nav('store')"
>
<text>店铺信息</text>
<icon class="right_arrow" />
</view>
......@@ -108,12 +124,12 @@ export default {
...mapState({
token: state => state.user.token,
userInfo: state => state.user.userInfo,
menuButtonInfo: state => state.systemInfo.menuButtonInfo
// menuButtonInfo: state => state.systemInfo.menuButtonInfo
}),
navTitleSty() {
const menuButtonInfo = this.menuButtonInfo
return `height:${menuButtonInfo.height}px;line-height:${menuButtonInfo.height}px;top:${menuButtonInfo.top}px;`
}
// navTitleSty() {
// const menuButtonInfo = this.menuButtonInfo
// return `height:${menuButtonInfo.height}px;line-height:${menuButtonInfo.height}px;top:${menuButtonInfo.top}px;`
// }
},
onShow() { // 获取更新用户信息
if(this.token) {
......@@ -169,16 +185,16 @@ export default {
</script>
<style lang="scss" scoped>
.nav-title {
position: fixed;
left: 0;
right: 0;
z-index: 2;
text-align: center;
color: #fff;
font-weight: 500;
font-size: 34rpx;
}
// .nav-title {
// position: fixed;
// left: 0;
// right: 0;
// z-index: 2;
// text-align: center;
// color: #fff;
// font-weight: 500;
// font-size: 34rpx;
// }
.user-wrap {
position: relative;
@include borderBox(0, 30rpx);
......@@ -189,6 +205,7 @@ export default {
.avatar {
width: 140rpx;
height: 140rpx;
overflow: hidden;
border-radius: 50%;
}
}
......@@ -204,6 +221,8 @@ export default {
}
.order-wrap {
position: relative;
z-index: 3;
@include borderBox(40rpx, 30rpx);
width: 690rpx;
height: 258rpx;
......@@ -241,7 +260,7 @@ export default {
}
.server-wrap {
@include borderBox(20rpx, 20rpx);
@include borderBox(0, 30rpx);
width: 690rpx;
margin: 20rpx auto 0;
background-color: #fff;
......
<template>
<text class="text">剩余支付时间:{{time_text}}</text>
</template>
<script>
/**
* warning: 我没有通过页面生命周期处理onHide停止计时器
* 符合渲染的条件 一:在线支付 二: 订单待支付状态 通过改变这两个状态卸载组件
* 在列表页表页计时可能数组会很大,因为利用组件的方法,开启多个计时器,一般待支付我猜不会有很多,因此计时器不会有很多
*/
export default {
props: {
countdownNum: {
type: Number,
required: true
},
pauseTimer: { // 停止计时器 用在控制在onHide和onShow生命周期
type: Boolean,
default: false
},
params: {
type: Object,
default: () => {}
}
},
data() {
return {
time_text: ''
}
},
created () {
if(this.countdownNum <= 0) return console.log("倒计时时间小于0")
this.start()
this.$once('hook:beforeDestroy', () => {
this.timer && clearInterval(this.timer)
this.timer = null
})
},
methods: {
start() {
let countdownNum = this.countdownNum
let h = 0
let m = 0
let s = 0
this.timer && clearInterval(this.timer)
this.timer = setInterval(() => {
if(countdownNum === 0) {
clearInterval(this.timer)
this.timer = null
this.$emit('timerEnd', this.params)
return
}
h = Math.floor(countdownNum/(60*60)%24) m = Math.floor(countdownNum/(60)%60) s = Math.floor(countdownNum%60) this.time_text = `${h > 9 ? h : '0' + h }:${m > 9 ? m : '0' + m }:${s > 9 ? s : '0' + s }`
countdownNum --
}, 1000)
}
}
}
</script>
<style lang="scss" scoped>
.text {
color: $desc;
font-size: 20rpx;
}
</style>
......@@ -13,14 +13,23 @@
>卖家自提或找物流</view>
</view>
<view class="address">
<navigator
<view class="address" v-show="current_tab === 1">
<view
v-if="orderDetail.address.length === 0"
class="font-32 font-bold"
hover-class="none"
url="/subPages/address/index"
>选择收获地址</navigator>
<view class="font-32 font-bold" v-else>1</view>
>选择收获地址</view>
<view class="flex j-between a-center w-100" v-else>
<view class="flex-1" @click="handleAddress">
<view class="mb-2">
<text class="font-32 font-bold mr-3">{{select_address.consignee}}</text>
<text class="descColor">{{select_address.mobile}}</text>
</view>
<view class="descColor">{{select_address.p_cn + select_address.c_cn + select_address.d_cn + select_address.address}}</view>
</view>
<view class="right-arrow" />
</view>
<view class="tips mt-2 pt-2">卖家派送指卖家视同默认卖家提供的运输服务及因此可能产生的费用, 如 有疑问可点击<text class="primaryColor" @click="handleConcact">联系商家</text></view>
</view>
......@@ -60,7 +69,7 @@
<view class="mb-2">单价:{{sku.cart_price + '/' + sku.unit}}</view>
<view class="flex j-between a-center">
<text>数量:{{sku.cart_number}}</text>
<text>小记:<text class="primaryColor">{{sku.cart_subtotal}}</text></text>
<text>小记:<text class="primaryColor">{{sku.is_inquiry === '1' ? '待确认' : sku.cart_subtotal}}</text></text>
</view>
</view>
</block>
......@@ -87,43 +96,90 @@
</view>
<view class="py-2">
<view class="pb-2">选择支付方式</view>
<view class="pay-item pb-2">
<view class="pay-item pb-2" @click="handlePayWay(form.goods_before_pay)">
<view>在线支付</view>
<view class="select"></view>
<view :class="!form.goods_before_pay ? 'select' : 'unselect'"></view>
</view>
<view class="pay-item">
<view class="pay-item" @click="handlePayWay(form.goods_before_pay)">
<view>先货后款</view>
<view class="unselect"></view>
<view :class="form.goods_before_pay ? 'select' : 'unselect'"></view>
</view>
</view>
</view>
<view class="w-100 flex j-end a-center confirm">
<text class="font-24">不含运费</text>
<text class="total-price mx-4">合计:{{orderDetail.sum_amount}}</text>
<text class="total-price mx-4">合计:
<template v-if="judge.showTotal(orderDetail.shop.cartList2)">
<text>{{orderDetail.sum_amount}}</text>
</template>
<template v-else>
<text>待确认</text>
</template>
</text>
<view class="confirm-btn mr-2" @click="handleConfirm">提交订单</view>
</view>
<uni-popup ref="popup" type="center">
<scroll-view scroll-y class="address-popup" v>
<view
class="flex j-between a-center item w-100 py-2"
v-for="item in orderDetail.address"
:key="item.address_id"
@click="handleAddressItem(item)"
>
<view class="flex-1">
<view class="mb-2">
<text class="font-32 font-bold mr-3">{{item.consignee}}</text>
<text class="descColor">{{item.mobile}}</text>
</view>
<view class="descColor">{{item.p_cn + item.c_cn + item.d_cn + item.address}}</view>
</view>
<view class="right-arrow" />
</view>
</scroll-view>
</uni-popup>
</view>
</template>
<script module="judge" lang="wxs">
// 1 有询价商品显示待确定 2 统计
function showTotal(cartList) {
if(!cartList) return false
for(var i = 0; i < cartList.length; i++) {
if(cartList[i].is_inquiry === '1') {
return false
}
}
return true
}
module.exports = {
showTotal: showTotal
}
</script>
<script>
import { preConfirmOrderData, confirmOrder } from '@/apis/order.js'
import { makePhoneCall } from '@/utils/common.js'
import { makePhoneCall, wxPay } from '@/utils/common.js'
import { baseUrl } from '@/config/index.js'
import Validator from '@/utils/validate.js'
let params = null
export default {
data() {
return {
baseUrl,
current_tab: 1,
orderDetail: {},
select_address: {},
form: {
from: 6, // 来源:6专属小程序
buy_type: 0, //购买类型:0默认加入购物车 1立即购买
goods_before_pay: 0, // 是否为先货后款:0否 1是
sku_ids: '', // SKUIDs,多个则使用逗号分隔(buy_type=1时必填)
shipping_type: 1, // 配送类型1格利冷运2第三方(自提)
address_id: '1707', // 收货地址ID(shipping_type=1时必填)
address_id: '', // 收货地址ID(shipping_type=1时必填)
cart_ids: '', // 选中的购物车IDs,多个则使用逗号分隔(buy_type=0时必填)
postscript: '', // 订单附言,由用户提交订单前填写
cart_numbers: '' // 购买数量s,多个则使用逗号分隔(buy_type=1时必填)
......@@ -132,9 +188,16 @@ export default {
},
onLoad(options) {
const params = JSON.parse(decodeURIComponent(options.params))
params = JSON.parse(decodeURIComponent(options.params))
this.form = Object.assign(this.form, params)
this.getPreOrderData(params)
},
onShow() {
if(params) {
this.getPreOrderData(params)
}
},
methods: {
......@@ -147,12 +210,18 @@ export default {
handleConcact() {
this.$checkLogin(makePhoneCall)
},
// 获取提交订单前的数据
async getPreOrderData(params) {
try{
const { status, data } = await preConfirmOrderData(params)
if(status) {
this.orderDetail = data
// 如果有默认地址,那么默认选中地址,如果没有默认地址,那么就选择第一个为选中地址
const defaultAddress = data.address.find(item => item.is_default === '1')
const select_address = defaultAddress ? defaultAddress : data.address[0]
this.form.address_id = select_address.address_id || ''
this.select_address = select_address
} else {
uni.navigateBack()
}
......@@ -166,13 +235,73 @@ export default {
async handleConfirm() {
try{
const form = this.form
console.log(form)
if(form.shipping_type === 1 && !form.address_id) return this.$toast({title: '请选择收货地址'})
const { status, data } = await confirmOrder(form)
const valiteErr = this.valiteForm()
if(valiteErr) return this.$toast({title: valiteErr})
const list = this.orderDetail.shop.cartList2
for(let i = 0, j = list.length; i < j; i ++) {
if(list[i].is_inquiry === '1') {
return this.confirm2Order(form, () => {
uni.redirectTo({
url: '/pages/order/order-list'
})
})
}
}
this.confirm2Order(form, () => {
wxPay({params: {}, })
})
}catch(e){
console.log(e)
this.$toast({title: e.msg || '程序错误,订单提交失败'})
//TODO handle the exception
}
},
valiteForm() {
const formValidator = new Validator()
const form = this.form
if(form.shipping_type === 1) {
formValidator.add(form.address_id, [{strategy: 'notEmpty', errorMsg: '请完善地址信息'}])
}
if(form.buy_type === 0) { // 购物车进去
formValidator.add(form.cart_ids, [{strategy: 'notEmpty', errorMsg: '购物车id不能为空'}])
} else if(form.buy_type === 1){
formValidator.add(form.sku_ids, [{strategy: 'notEmpty', errorMsg: '规格不能空'}])
formValidator.add(form.cart_numbers, [{strategy: 'notEmpty', errorMsg: '购买数量不能为空'}])
}
return formValidator.validate()
},
// 更换地址
handleAddress() {
this.$refs.popup.open()
},
// 选择弹窗的地址
handleAddressItem(item) {
console.log(item)
this.select_address = item
this.form.address_id = item.address_id
this.$refs.popup.close()
},
// 支付方式
handlePayWay(pay_way) {
this.form.goods_before_pay = ~~!pay_way
},
async confirm2Order(form, cb) {
try{
const { status, data } = await confirmOrder(form)
if(status) {
cb && typeof cb === 'function' && cb()
}
}catch(e){
console.log(e)
//TODO handle the exception
}
}
}
}
......@@ -180,8 +309,9 @@ export default {
<style lang="scss" scoped>
.wrapper {
box-sizing: border-box;
padding-top: 110rpx;
margin-bottom: 98rpx;
padding-bottom: 118rpx;
.tab-wrap {
position: fixed;
left: 0;
......@@ -230,6 +360,11 @@ export default {
margin: 0 auto 20rpx;
border-radius: 8rpx;
background-color: #fff;
.right-arrow {
flex: 0 0 16rpx;
margin-left: 10rpx;
@include right_arrow(16rpx, 34rpx);
}
.tips {
font-size: 20rpx;
color: $desc;
......@@ -240,6 +375,22 @@ export default {
}
}
.address-popup {
@include borderBox(20rpx, 20rpx);
width: 700rpx;
height: 700rpx;
background-color: #fff;
border-radius: 10rpx;
.item {
border-bottom: 1rpx solid $line;
.right-arrow {
flex: 0 0 16rpx;
margin-left: 10rpx;
@include right_arrow(16rpx, 34rpx);
}
}
}
.address-store {
@include borderBox(0, 20rpx);
width: 690rpx;
......
<template>
<view class="wrapper">
<view class="order-status w-100">
d
{{order_detail.order.order_status | orderStatus}}
</view>
<view class="goods w-100 mt-2">
<view class="goods-item">
<view class="flex j-start a-center">
<image class="cover" src="/static/images/common/bg.png" mode="aspectFit"></image>
<view class="title flex-1">text</view>
<view class="goods w-100">
<block
v-for="(item, index) in order_detail.goods"
:key="index"
>
<view class="goods-item">
<view class="flex j-start a-center">
<image
class="cover"
:src="baseUrl + '/' + item.goods_thumb"
mode="aspectFit"
/>
<view class="title flex-1">{{item.goods_name}}</view>
</view>
<block
v-for="(s, sidx) in item.list"
:key="sidx"
>
<view class="mt-2">规格:{{s.goods_attr}}</view>
<view class="mt-2">单价:{{s.goods_price}}</view>
<view class="mt-2 flex j-between a-center">
<text>数量:{{s.cart_number}}</text>
<text class="primary">小计:¥{{s.amount}}</text>
</view>
</block>
</view>
<view class="mt-2">1</view>
<view class="mt-2">1</view>
<view class="mt-2 flex j-between a-center">
<text>1</text>
<text class="primary">小计:¥9999.99</text>
</view>
</view>
</block>
</view>
<view class="wrap mt-2 flex j-end a-center">
合计:<text class="primary">3</text><text class="mr-2"></text>合计:<text class="primary">¥9999.99</text>
合计:<text class="primary">{{order_detail.totalCount || 0}}</text><text class="mr-2"></text>合计:<text class="primary">{{order_detail.order.sum_amount || 0}}</text>
</view>
<view class="mt-2 box">
<view>商家派送: 商家自行派送<text class="primary">联系商家</text></view>
<view class="my-2">派送地址: 广东省广州市荔湾区那那那街这这这大厦多少 多少户</view>
<view>
<text class="mr-2">小格</text>
<text>188 1818 1888</text>
<view class="mt-2 box" v-if="order_detail.order.shipping_type === '1'">
<view>商家派送: 商家自行派送<text class="primary ml-1" @click="makePhoneCall()">联系商家</text></view>
<view class="mt-2">派送地址: {{order_detail.order.address_json.address1 + order_detail.order.address_json.address2}}</view>
<view class="mt-2">
<text class="mr-2">{{order_detail.order.address_json.consignee}}</text>
<text>{{order_detail.order.address_json.mobile}}</text>
</view>
</view>
<view class="mt-2 box" v-else>
<view>商家派送: 买家自提<text class="primary ml-1" @click="makePhoneCall()">联系商家</text></view>
<view class="mt-2">派送地址: {{order_detail.order.pickup_address}}</view>
<view class="mt-2">
<text class="mr-2">店铺名称:</text>
<text>{{order_detail.order.shop_name}}</text>
</view>
<view class="mt-2">
<text class="mr-2">自提时间:</text>
<text>{{order_detail.order.pickup_hours}}</text>
</view>
</view>
......@@ -38,14 +65,14 @@
<view class="item w-100 flex j-start a-center">
<view class="hd">订单编号:</view>
<view class="flex-1 flex j-between a-center">
<text>1</text>
<text class="primary">2</text>
<text>{{order_detail.order.order_sn}}</text>
<text class="primary" @click="copyOrderSn">复制</text>
</view>
</view>
<view class="item w-100 flex j-start a-center">
<view class="hd">订单编号</view>
<view class="hd">创建时间</view>
<view class="flex-1">
<text>1</text>
<text>{{order_detail.order.add_time | parseTime}}</text>
</view>
</view>
</view>
......@@ -58,6 +85,82 @@
</template>
<script>
import { orderDetail } from '@/apis/order.js'
import { makePhoneCall } from '@/utils/common.js'
import { baseUrl } from '@/config/index.js'
let order_sn = null
const order_statsu = {
'0': '待接单',
'1': '待付款',
'2': '交易关闭',
'5': '交易完成',
'6': '待发货',
'7': '待收货',
'9': '退货退款中',
'10': '已收货',
'11': '退款退货审核'
}
export default {
data() {
return {
baseUrl,
order_detail: {
order: {
add_time: ''
}
}
}
},
onLoad(ops) {
order_sn = ops.order_sn
this.getDetail()
},
filters: {
orderStatus(val) {
console.log(val)
return order_statsu[val] || ''
}
},
methods: {
makePhoneCall,
async getDetail() {
try{
if(!order_sn) return
const { status, data } = await orderDetail(order_sn)
if(status) {
this.order_detail = {
goods: data.goods2 || [],
order: data.order || {},
totalCount: data.goods2.reduce((pre, cur) => {
return pre + cur.list.reduce((p, c) => {
return p + ~~c.cart_number
}, 0)
}, 0)
}
}
}catch(e){
this.$toast({title: e.msg || '程序错误,获取订单详情失败'})
//TODO handle the exception
}
},
// 复制订单号
copyOrderSn() {
if(!order_sn) return this.$toast({title: '订单号为空'})
uni.setClipboardData({
data: order_sn,
success: () => {
this.$toast({title: '复制成功'})
}
})
}
}
}
</script>
<style lang="scss" scoped>
......@@ -70,12 +173,15 @@
.goods {
background-color: #fff;
border-bottom: 1rpx solid $line;
&:last-child {
border-bottom: none;
}
.goods-item {
@include borderBox(20rpx, 30rpx);
border-bottom: 1rpx solid $line;
&:first-child {
margin-top: 20rpx;
}
&:last-child {
border-bottom: none;
}
.cover {
flex: 0 0 160rpx;
width: 160rpx;
......
......@@ -4,7 +4,7 @@
<scroll-view class="tab-wrap w-100" scroll-x>
<view
class="tab-item mx-3"
v-for="(item, index) in list"
v-for="(item, index) in tab_list"
:key="index"
:class="current_tab === index ? 'tab_active' : ''"
@click="handleTab(index)"
......@@ -13,57 +13,90 @@
<view class="list-wrap">
<pull-list
ref="pullList"
refresherEnabled
@refresh="refresh"
@tolower="tolower"
>
<view class="w-100 list-item">
<view class="w-100 item-inner">
<view class="w-100 mb-2">
<template v-if="tab_list[current_tab].data.length === 0">
<empty-view text="暂无订单"></empty-view>
</template>
<template v-else>
<navigator
class="w-100 list-item"
hover-class="none"
:url="'/pages/order/order-detail?order_sn=' + item.order_sn"
v-for="(item, index) in tab_list[current_tab].data"
:key="item.order_sn"
>
<view class="w-100 item-inner">
<view class="flex j-between a-center">
<text class="order-item">time</text>
<text class="order-status">status</text>
<text class="order-item">{{item.add_time | parseTime}}</text>
<text class="order-status">{{item.order_status | orderStatus(item.goods_before_pay)}}</text>
</view>
<view class="flex j-start a-center">
<image class="cover" src="/static/images/common/bg.png" mode="aspectFit"></image>
<view class="goods-info flex-1 flex j-between flex-column">
<view class="title">title</view>
<view class="desc">12</view>
<view class="w-100 flex j-between a-center">
<text class="price">¥5555</text>
<text class="desc">x1</text>
<view
class="w-100 mb-2"
v-for="(good, idx) in item.goods"
:key="idx"
>
<view class="flex j-start a-center mt-2">
<image
class="cover"
:src="baseUrl + '/' + good.goods_thumb"
mode="aspectFit"
/>
<view class="goods-info flex-1 flex j-between flex-column">
<view class="title">{{good.goods_name}}</view>
<view class="desc">{{good.specification}}</view>
<view class="w-100 flex j-between a-center">
<text class="price">{{good.goods_price}}</text>
<text class="desc">x{{good.cart_number}}</text>
</view>
</view>
</view>
</view>
</view>
<view class="w-100 mb-2">
<view class="flex j-between a-center">
<text class="order-item">time</text>
<text class="order-status">status</text>
<view class="order-info">
<view class="w-100 flex j-end a-center mb-2">
<text class="mr-2"><text class="primary">{{item.sum_counts}}</text></text>
<text class="primary">{{item.sum_amount}}</text>
</view>
<view class="flex j-start a-center">
<image class="cover" src="/static/images/common/bg.png" mode="aspectFit"></image>
<view class="goods-info flex-1 flex j-between flex-column">
<view class="title">title</view>
<view class="desc">12</view>
<view class="w-100 flex j-between a-center">
<text class="price">¥5555</text>
<text class="desc">x1</text>
</view>
</view>
<!-- 2是交易关闭,5是交易完成,订单都已经结束,不展示按钮 -->
<view class="w-100 flex j-end a-center" v-if="!['0', '2', '5'].includes(item.order_status)">
<template v-if="item.order_status === '0'">
<countdown-t
v-if="item.goods_before_pay === '0' && item.countdownT > 0"
:countdownNum="item.countdownT"
:pauseTimer="pauseTimer"
:params="{
index
}"
@timerEnd="timerEnd"
/>
<view class="btn ml-2 cancle" @click.stop="handleCancel(item.order_sn, index)">取消订单</view>
</template>
<template v-else-if="item.order_status === '6'">
<view class="btn ml-2 cancle">申请退款</view>
<view class="btn ml-2 pay">提醒发货</view>
</template>
<template v-else-if="item.order_status === '7'">
<view class="btn ml-2 cancle">申请退款</view>
<view class="btn ml-2 pay">确认收货</view>
</template>
<template v-else-if="item.order_status === '9'">
<view class="btn ml-2 cancle">撤销退款申请</view>
</template>
<template v-else-if="item.order_status === '10'">
<view class="btn ml-2 cancle">申请售后</view>
</template>
<template v-else-if="item.order_status === '11'">
<view class="btn ml-2 cancle">撤销退货退款申请</view>
</template>
</view>
</view>
</view>
<view class="order-info">
<view class="w-100 flex j-end a-center mb-2">
<text class="mr-2"><text class="primary">3</text></text>
<text class="primary">¥333</text>
</view>
<view class="w-100 flex j-end a-center">
<view class="btn ml-2 cancle">取消订单</view>
<view class="btn ml-2 pay">立即支付</view>
</view>
</view>
</view>
</navigator>
</template>
</pull-list>
</view>
</view>
......@@ -71,50 +104,165 @@
<script>
import pullList from '@/components/pull-list/index.vue'
import countdownT from './components/countdownT.vue'
import LoadMore from '@/utils/load-more.js'
import { baseUrl } from '@/config/index.js'
import order_mixin from '@/mixins/order_operation.js'
import { orderList } from "@/apis/order.js"
const formParams = {
status: 10 // 0:待接单/待付款 1:待发货/待收货 3:已收货 4:交易关闭 5:退款中 10:全部
}
let timer = null
let serviceTime = 0
const order_statsu = {
'0': '待接单',
'1': '待付款',
'2': '交易关闭',
'5': '交易完成',
'6': '待发货',
'7': '待收货',
'9': '退货退款中',
'10': '已收货',
'11': '退款退货审核'
}
const order_statsu_d = {
}
export default {
data() {
return {
test: false,
current_tab: 0,
list: [
baseUrl,
tab_list: [
{
status: 10,
name: '全部',
data: []
},
{
status: 0,
name: '待付款',
data: []
},
{
status: 1,
name: '待收货',
data: []
},
{
status: 3,
name: '已收货',
data: []
},
{
status: 5,
name: '退货退款',
data: []
},
{
status: 4,
name: '交易关闭',
data: []
}
]
],
// times: {}, // 存放倒计时 通过key取
}
},
components: {
pullList
pullList,
countdownT
},
created() {
this.loadMore = new LoadMore()
},
filters: {
// goods_before_pay 是否为先货后款:0否 1是
orderStatus(status, goods_before_pay) {
if(goods_before_pay === '1' && status === '1') {
return null
}
return order_statsu[status]
}
},
mixins: [order_mixin],
onLoad(options) {
console.log(options)
const { id } = options
this.current_tab = Number(id) || 0
},
onShow() {
this.init()
},
methods: {
handleTab(idx) {
if(idx === this.current_tab) return
this.current_tab = idx
this.init()
},
init() {
this.loadMore.resetParams()
this.$refs.pullList.scroll2Top()
this.tab_list[this.current_tab].data = []
this.getData()
},
async getData() {
const tab_list = this.tab_list
const idx = this.current_tab
formParams.status = tab_list[idx].status
const { status, data, time } = await this.loadMore.getList(formParams, orderList)
console.log(data, time)
if(status && data) {
// 计算总数
data.forEach(item => {
item.pay_endTime = item.confirm_time === '0' ? 0 : ~~item.confirm_time + 3600
item.countdownT = ~~item.confirm_time + 3600 - time
item.last_payTime = ''
item.sum_counts = item.goods.reduce((pre, cur) => { return pre + ~~cur.cart_number}, 0)
})
serviceTime = time
this.tab_list[idx].data.push(...data)
// this.runTimer()
}
},
timerEnd(e) {
const { index } = e
const tab_list = this.tab_list
const current_tab = this.current_tab
this.$set(tab_list[current_tab].data[index], 'countdownT', 0)
},
// 取消订单
handleCancel(orderSn, idx) {
console.log(orderSn, idx)
this.$modal({
content: '您确定取消该订单吗?',
cb: () => {
this.orderCancel(orderSn, () => {
const tab_idx = this.current_tab
this.$set(this.tab_list[tab_idx].data[idx], 'order_status', '2')
this.$set(this.tab_list[tab_idx].data[idx], 'order_status_d', '29')
})
}
})
},
// 下拉刷新
refresh(e) {
this.init()
},
// 上拉加载更多
tolower(e) {
this.getData()
}
}
}
......
.clear-btn::after {
display: inline-block;
content: '';
position: absolute;
left: 50%;
top: 50%;
transform: translate(-50%, -50%);
width: 48rpx;
height: 48rpx;
background-image: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAEQAAAAsCAMAAADrau63AAAA/FBMVEUAAAD/gID/gED/gCv/gED/cTn/ZjPuZjPvcDDyayjyZibzaC70byzrbCfsaC/wbCfwaS3rZyfsZSbsZiruaCfuZibsaCfrZSftZiftaCfuZSnuZyjrZijraCfsZynsZijtZSfsZibsZyjtZifsZifsZijtZiftZSbtZibtZibrZSjsZyfsZifrZSbrZifsZifsZSbsZifsZifrZSbrZibrZSfsZibsZSfrZSbsZifsZSbrZifrZSfsZSbrZifrZibrZSfsZifsZifsZibsZSbrZSbrZifsZifsZifsZSbsZibsZibsZSfrZSfrZifrZibsZSfsZifsZSbrZSbIJ2ATAAAAU3RSTlMAAgQGCAkKDxATFBYXGhshIjQ1Nzs8Qk5VVlhZWlteX2JrbXB2en1+f4yNlZaam56ho6Wmp6mtsLW5usPEyc3O0d/h4uPo6+zu7/Dx8vT19vn7/gAR9X4AAAHHSURBVEjHvVZnc8IwDIWyy96zYRQItEDZe4e9wf//v7QQQgA5Trjz9X2T9PxyViRLKpUk9L5MudUf73bjfqvM+vSql+HO9o7oAcde1v2KgiE+RFgM4waFErb8Dklil7cpkNClt4iIbVonpxHmkCy4MFHC2ECK0DBKa7hGSCFGLimNxAEpxiGBlVAX0EsoqKHGWxlD3NQYj93uYWobTLD89qyhqUPWOnUrdX1qDeN1zaOGtgk5Xcs9w9KFjKb2QaQKGZWn72gqkFO9J7Aw3tGAG3cgixXDgROILs0w9+YloJ0CQtC5h59ICgcj39mY6WokIW/vvNb6BMYW15QFVmdrzlzTv4DMCd8BRUwNlPhTjGAHebuEoRbPAT+uHEOXM6aZYK/4FIVwXP8fcYoL8Df9FB0ffPZw3KlJVcM2hvVy5kd05C4OK5ZcI4rkREeWKEK6TkR0xIjXISXWvBLsmYmYWOIvDgo2I/OLicXGzC89EJAtNmLZv8e+chGzfNnTaUA6TwGdR4nO80jloZYcGVGvw+GNKhwZdIYXnTFKaaDTWS3O3a9kyYnIrlus3LrF6v5n8aO0glJahm9reaU94PZ7btCuZEhr+S9R2SzMt+mqIQAAAABJRU5ErkJggg==);
background-position: 0 0;
background-size: 100% 100%;
}
\ No newline at end of file
......@@ -2,20 +2,29 @@
<view class="w-100">
<!-- searbar -->
<view class="search-bar w-100 flex j-between a-center">
<input
class="input font-28"
type="text"
v-model="val"
placeholder="搜索商品"
confirm-type="search"
@confirm="search"
/>
<view class="font-28" @click="search">搜索</view>
<image
class="search-icon"
src="/static/images/common/icon-search.png"
mode="aspectFit"
/>
<view class="input-wrap flex j-between a-center flex-1">
<!-- @blur="handleSearch" -->
<input
class="input font-28 flex-1"
type="text"
v-model="val"
placeholder="搜索商品"
confirm-type="search"
@confirm="search"
/>
<view
v-show="inputFocus"
class="cancleInput clear-btn"
@click="clearInput"
/>
<image
class="search-icon"
src="/static/images/common/icon-search.png"
mode="aspectFit"
/>
</view>
<view class="search-btn font-28" @click="search">搜索</view>
</view>
<!-- history -->
......@@ -26,7 +35,7 @@
</view>
<view class="w-100 flex j-start a-center flex-wrap">
<view
class="history-item font-28 mr-2"
class="history-item font-28 mr-2 mb-2"
v-for="(item, index) in list"
:key="index"
@click="handleHistory(item)"
......@@ -37,35 +46,54 @@
</template>
<script>
import { removeStorage } from '@/lib/storage/index.js'
import { throttle } from '@/utils/common.js'
let cacheHistory = []
export default {
data() {
return {
inputFocus: false,
val: '',
list: []
list: [], // 在页面显示的历史
}
},
created() {
this.list = this.$getStorage('search-history') || []
onShow() {
const localHisotry = this.$getStorage('search-history') || []
this.list = localHisotry
cacheHistory = localHisotry
// this.cancle = false
},
onHide() {
this.$setStorage('search-history', cacheHistory)
this.cacheHistory = []
},
onUnload() {
this.$setStorage('search-history', this.list)
// onUnload() {
// this.$setStorage('search-history', this.list)
// },
watch: {
val: throttle(function(newVal) {
if(newVal.length > 0) {
this.inputFocus = true
}
}, 800)
},
methods: {
// 搜索
search() {
const { val, list } = this
if(!val) return this.$toast({title: '请输入搜索内容'})
if(!list.includes(val)) {
this.list.push(val)
if(!cacheHistory.includes(val)) {
cacheHistory.push(val)
}
uni.redirectTo({
uni.navigateTo({
url: `/pages/search/list?val=${val}`
})
},
// 点击历史
handleHistory(val) {
uni.redirectTo({
uni.navigateTo({
url: `/pages/search/list?val=${val}`
})
},
......@@ -73,30 +101,62 @@ export default {
// 清除记录
clearHistory() {
this.list = []
cacheHistory = []
removeStorage('search-history')
},
clearInput() {
// this.cancle = true
this.val = ''
// this.timer = setTimeout(() => {
// this.cancle = false
// clearTimeout(this.timer)
// }, 300)
}
}
}
</script>
<style lang="scss" scoped>
@import "./common/clear.css";
.search-bar {
position: relative;
@include borderBox(20rpx, 40rpx);
margin: 0 auto;
background-color: #fff;
.input {
width: 534rpx;
.input-wrap {
width: 100%;
height: 88rpx;
padding-left: 70rpx;
border-radius: 8rpx;
overflow: hidden;
background-color: $mainBg;
.input {
width: 534rpx;
height: 88rpx;
padding-left: 70rpx;
background-color: $mainBg;
}
.cancleInput {
position: relative;
flex: 0 0 50rpx;
width: 50rpx;
height: 88rpx;
}
.search-icon {
position: absolute;
left: 60rpx;
top: 50%;
transform: translateY(-50%);
width: 34rpx;
height: 34rpx;
}
}
.search-icon {
position: absolute;
left: 60rpx;
top: 50%;
transform: translateY(-50%);
width: 34rpx;
height: 34rpx;
.search-btn {
flex: 0 0 60rpx;
height: 88rpx;
line-height: 88rpx;
margin-left: 20rpx;
text-align: center;
}
}
......
<template>
<view class="w-100">
<!-- searchBar -->
<viwe class="search-bar w-100 flex j-center a-center">
<input
class="input font-28 mr-2"
type="text"
v-model="val"
placeholder="搜索商品"
confirm-type="search"
@confirm="search"
/>
<image
class="search-icon ml-3" src="/static/images/common/icon-search.png"
mode="aspectFit"
/>
<viwe class="search-bar w-100 flex j-between a-center">
<view class="input-wrap">
<input
class="input font-28 mr-2"
type="text"
v-model="searchParams.keywords"
placeholder="搜索商品"
confirm-type="search"
@confirm="search"
/>
<image
class="search-icon ml-2"
src="/static/images/common/icon-search.png"
mode="aspectFit"
/>
<view class="clearBtn clear-btn " @click.stop="clearInput" />
</view>
<image
class="nav-cart"
src="/static/images/common/icon-cart_gray.png"
......@@ -87,10 +91,13 @@
<text>销量:{{good.virtual_quantity_sold}}</text>
</view>
<view class="font-28 flex w-100 j-between a-center">
<price
:is_inquiry="good.is_inquiry"
:price="good.shop_price"
/>
<view class="flex j-start a-center">
<price
:is_inquiry="good.is_inquiry"
:price="good.shop_price"
/>
<text class="primaryColor font-28">{{good.least_str}}</text>
</view>
<image
class="cart-icon"
@click.stop="handlePop(good)"
......@@ -142,9 +149,6 @@ export default {
onLoad(options) {
this.loadmore = new LoadMore()
this.searchParams.keywords = options.val || ''
uni.setNavigationBarTitle({
title: options.val
})
this.getData()
},
......@@ -163,15 +167,36 @@ export default {
this.getData()
},
clearInput() {
this.searchParams.keywords = ''
},
// handleSearch(e) {
// const { type } = e
// const value = e.detail.value.trim()
// if(!value) return this.$toast({title: '请输入搜索内容'})
// this.searchParams.keywords = value
// switch(type) {
// case 'confirm':
// this.search()
// break;
// case 'blur':
// if(this.cancle) return
// this.search()
// break;
// default:
// this.search()
// break;
// }
// },
// 重新搜索
search(e) {
const value = e.detail.value
search() {
const value = this.searchParams.keywords.trim()
if(!value) return this.$toast({title: '请输入搜索内容'})
this.searchParams.keywords = value
this.loadmore.resetParams()
this.searchList = []
uni.setNavigationBarTitle({
title: value
})
this.searchParams.keywords = value
this.getData()
},
......@@ -214,16 +239,15 @@ export default {
})
const { status, data } = await goodsSku(goods.goods_id)
if(status) {
console.log(data)
const params = {
goodsInfo: {
cover: `${this.baseUrl}/${goods.goods_thumb}`,
title: goods.goods_name,
is_inquiry: goods.is_inquiry
is_inquiry: goods.is_inquiry,
unit: goods.goods_unit
},
skuData: data
}
console.log(params)
this.$refs.popup.show(params)
}
uni.hideLoading()
......@@ -239,29 +263,52 @@ export default {
<style lang="scss" scoped>
@import './common/iconfont.css';
@import './common/clear.css';
.search-bar {
box-sizing: border-box;
padding: 0 20rpx;
position: relative;
width: 100%;
height: 128rpx;
background-color: #fff;
.input {
width: 534rpx;
padding-left: 70rpx;
.input-wrap {
box-sizing: border-box;
position: relative;
width: 654rpx;
height: 88rpx;
background-color: $mainBg;
}
.search-icon {
position: absolute;
left: 40rpx;
top: 50%;
z-index: 1;
width: 34rpx;
height: 34rpx;
transform: translateY(-50%);
border-radius: 8rpx;
background-color: yellow;
.input {
width: 500rpx;
padding-left: 70rpx;
height: 88rpx;
background-color: $mainBg;
}
.search-icon {
position: absolute;
left: 0;
top: 50%;
z-index: 1;
width: 34rpx;
height: 34rpx;
transform: translateY(-50%);
}
.clearBtn {
position: absolute;
right: 0;
top: 50%;
z-index: 1;
transform: translateY(-50%);
width: 88rpx;
height: 88rpx;
line-height: 88rpx;
text-align: center;
}
}
.nav-cart {
width: 34rpx;
height: 32rpx;
width: 40rpx;
height: 88rpx;
}
}
......@@ -289,15 +336,16 @@ export default {
color: $primary!important;
}
.sanjiao-wrap {
width: 32rpx;
height: 22rpx;
width: 24rpx;
height: 18rpx;
color: #333;
line-height: 10rpx;
.sanjiao {
display: inline-block;
font-size: 12rpx!important;
font-size: 10rpx!important;
color: #333;
&:nth-child(1) {
margin-bottom: 8rpx;
margin-bottom: 5rpx;
}
}
......@@ -327,6 +375,7 @@ export default {
.cart-icon {
width: 44rpx;
height: 42rpx;
padding: 5rpx 20rpx;
}
}
}
......
......@@ -26,14 +26,16 @@
- 仅次于小程序原生弹窗 zIndex 100
#### warning
+ 2021/6/29,本日起的代码可能会引起不适,但我和代码都能跑(效率和质量不会成正比关系)
+ 2021/6/29,本日起的代码可能会引起不适,but all can run(效率和质量不会成正比关系)
#### 未完成
+ 搜索列表
+ 下单
+ 支付
+ 订单管理
+ 订单详情
+ 服务过期处理
+ 购物车
+ sku阶梯价未处理
+ 弹窗异步问题
+ 精度处理
#### unFinish, but not important
+ 自定义的导航栏的样式计算可以在vuex中处理(wxs计算)
......@@ -14,7 +14,7 @@ const actions = {
setCount: async ({ commit }) => {
const { status, data } = await cartCount()
const count = data.count
if(status && count > 0) {
if(status) {
commit('SETCOUNT', count)
const pages = getCurrentPages()
const curPage = whitePage.find(item => item === pages[pages.length - 1].__route__)
......
import { setStorageAsync, removeStorage } from '@/lib/storage'
import { setStorage, setStorageAsync, removeStorage } from '@/lib/storage'
// import store from '@/store/index.js'
import { login, logout, getUserInfo } from '@/apis/user.js'
import { getStoreInfo } from '@/apis/common.js'
import Toast from '@/lib/toast/index.js'
import { login_wx } from '@/utils/modules/login.js'
const state = {
token: null,
openid: null,
......@@ -70,7 +72,7 @@ const actions = {
try{
const { status, data } = await login(form)
if(status) {
setStorageAsync('token', data.token)
await setStorage('token', data.token)
// 这里返回了用户名,但后面会有个接口单独返回,所以这里不操作useInfo
commit('LOGIN', data.token)
Toast({
......@@ -79,7 +81,10 @@ const actions = {
})
}
}catch(e){
console.log(e)
login_wx()
Toast({title: e.msg || '登录失败'})
}
},
......
......@@ -5,7 +5,7 @@ page {
}
/* 去除image的间距 */
image {
display: block;
/* display: block; */
}
.wrapper {
width: 100%;
......
......@@ -23,7 +23,7 @@
<script>
import { queryCity } from '@/apis/common.js'
const cacheList = [null, null, null, null] // 分别为四级区域,其中第一级是不会变得
const cityCode = { // 四级联动的城市的code,第一级默认是1
let cityCode = { // 四级联动的城市的code,第一级默认是1
"1": 1,
"2": 0,
"3": 0,
......@@ -57,9 +57,20 @@ export default {
"3": form.district || '',
"4": form.street || ''
}
console.log(cacheList)
this.getDefault()
},
beforeDestroy() {
cityCode = { // 四级联动的城市的code,第一级默认是1
"1": 1,
"2": 0,
"3": 0,
"4": 0
}
},
methods: {
async getDefault() {
try{
......
......@@ -73,8 +73,8 @@
</view>
<view class="w-100 btn-wrap flex j-around a-center">
<view class="btn del w-100" v-if="form.address_id" @click="handleDel">删除地址</view>
<view class="btn normal w-100" @click="handleAdd">{{form.address_id ? '编辑' : '添加'}}</view>
<view class="btn del w-100" v-if="form.address_id" @click="handleDel">删除</view>
<view class="btn normal w-100" @click="handleAdd">保存</view>
</view>
</view>
</template>
......@@ -172,7 +172,7 @@ export default {
.info-wrap {
background-color: #fff;
.item {
@include borderBox(20rpx, 30rpx);
@include borderBox(30rpx, 30rpx);
width: 100%;
display: flex;
justify-content: space-between;
......
......@@ -11,14 +11,16 @@
@click="handleDetail(address)"
>
<view class="flex-1">
<view class="mb-2">
<view class="mb-2 flex j-start a-center">
<text class="mr-3">{{address.consignee}}</text>
<text>{{address.mobile}}</text>
<text class="mr-2">{{address.mobile}}</text>
<text class="default mr-1" v-if="address.is_default === '1'"></text>
<text class="default" v-if="address.is_send_default === '1'"></text>
</view>
<view>{{address.p_cn + address.d_cn + address.c_cn + address.st_cn + address.address}}</view>
<view>{{address.p_cn + address.c_cn + address.d_cn + address.st_cn + address.address}}</view>
</view>
<view class="right-arrow" />
<!-- <button type="default" @click="handleDel(address.address_id, index, inneridx)">删除地址</button> -->
</view>
</block>
......@@ -62,43 +64,26 @@ export default {
// 上拉加载更多
onReachBottom() {
console.log('触底')
this.getAddressList()
},
methods: {
init() {
// 初始化
// 初始化s
this.list = []
this.loadmore.resetParams()
uni.showLoading({title: '加载中...'})
Promise.all([defaultAddress(), this.loadmore.getList({keywords: ''}, addressList)])
.then(res => {
console.log(res)
this.$set(this.list, this.list.length, res[1].data)
})
.catch(err => {
console.log(err)
this.$toast({title: '获取数据失败'})
})
.finally(() => {
uni.hideLoading()
})
},
// 获取默认地址
async getDefault() {
try{
const { status, data } = await defaultAddress()
}catch(e){
this.$toast({title: e.msg || '程序错误'})
}
this.getAddressList()
},
// 获取地址列表
async getAddressList() {
try{
const { status, data } = await addressList({keywords: ''})
const { status, data } = await this.loadmore.getList({keywords: ''}, addressList)
if(status) {
this.$set(this.list, this.list.length, data)
}
}catch(e){
this.$toast({title: e.msg || '程序错误'})
this.$toast({title: e.msg || '程序错误, 获取地址失败'})
}
},
......@@ -124,10 +109,6 @@ export default {
uni.navigateTo({
url: `/subPages/address/edit?params=${params}`
})
},
confirmCity(e) {
console.log(e)
}
}
}
......@@ -144,6 +125,17 @@ export default {
margin-left: 10rpx;
@include right_arrow(16rpx, 34rpx);
}
.default {
width: 36rpx;
height: 36rpx;
line-height: 36rpx;
text-align: center;
border-radius: 8rpx;
border: 1rpx solid $primary;
font-size: 22rpx;
color: $primary;
}
}
.addresss-btn {
......
<template>
<view class="wrapper">
<goods-box />
<navigator
class="mt-2 w-100 nav-box"
hover-class="none"
url="/subPages/afterSales/detail"
>
<view class="font-28 font-bold mb-2">我要退款(无需退货)</view>
<view class="font-24 desc">没有收到货物或与卖家协商同意不退货只退款</view>
</navigator>
<navigator class="mt-2 w-100 nav-box">
<view class="font-28 font-bold mb-2">我要退款(无需退货)</view>
<view class="font-24 desc">没已收到货物需要退换收到的货物</view>
</navigator>
</view>
</template>
<script>
import goodsBox from './components/goods-box.vue'
export default {
components: {
goodsBox
}
}
</script>
<style scoped>
.nav-box {
box-sizing: border-box;
padding: 20rpx 30rpx;
background-color: #fff;;
}
</style>
<template>
<view class="w-100 mt-2 goods-box">
<view class="flex j-start a-center">
<image
class="cover"
src="/static/images/common/bg.png"
mode="aspectFit"
/>
<view class="introduct flex j-between flex-column">
<view class="title">444</view>
<view class="desc">规格:444</view>
<viwe class="primaryColor">¥f444</viwe>
</view>
</view>
<view class="w-100 flex j-end a-center">
<text class="mr-2"><text class="primaryColor">3</text></text>
<text >合计:<text class="primaryColor">¥222</text></text>
</view>
</view>
</template>
<script>
</script>
<style lang="scss" scoped>
.goods-box {
@include borderBox(20rpx, 30rpx);
background-color: #fff;
.cover {
width: 160rpx;
height: 160rpx;
margin-right: 20rpx;
}
.introduct {
height: 160rpx;
.title {
@include text-ellipsis(2);
font-weight: 600;
}
.desc {
color: $desc;
}
}
}
</style>
<template>
<view class="wrap">
<goods-box />
<view class="price-box w-100 flex j-between a-center mt-2">
<text>退款金额</text>
<text class="primaryColor">¥33333333</text>
</view>
<view class="submit-btn">提交</view>
</view>
</template>
<script>
import goodsBox from './components/goods-box.vue'
export default {
components: {
goodsBox
}
}
</script>
<style lang="scss" scoped>
.wrap {
margin-bottom: 98rpx;
.price-box {
box-sizing: border-box;
padding: 24rpx 30rpx;
background-color: #fff;
}
.submit-btn {
position: fixed;
left: 0;
right: 0;
bottom: 0;
width: 100%;
height: 98rpx;
line-height: 98rpx;
color: #fff;
font-weight: 600;
text-align: center;
background-color: $primary;
}
}
</style>
......@@ -5,7 +5,7 @@ import { historyList } from '@/apis/common.js'
async function getCollectData() {
try{
const { status, data } = await this.collectList.getList({}, collectGoodsList)
if(status) {
if(status && data.length > 0) {
this.$set(this.collect_list, this.collect_list.length, data)
}
}catch(e){
......
......@@ -18,7 +18,7 @@
<swiper class="list-wrap" :current="tab_current">
<swiper-item>
<template v-if="collect_list.length === 0">
<empty-view text="暂无收藏"></empty-view>
<empty-view text="暂无收藏"></empty-view>
</template>
<template v-else>
<pull-list
......@@ -106,7 +106,7 @@
<view
class="btn"
@click.stop="clearHistory(good, index, goodIdx)"
>删除历史</view>
>删除</view>
</view>
<view class="desc">规格:{{good.specification}}</view>
<view class="desc">总销量:{{good.virtual_quantity_sold}}</view>
......@@ -234,22 +234,27 @@ export default {
},
// 删除单条历史
clearHistory(good, wrapIdx, innerIdx) {
async clearHistory(good, wrapIdx, innerIdx) {
try{
uni.showModal({
title: '提示',
content: '您确定要删除这条历史吗?',
confirmColor: '#FF661A',
success: async res => {
if(res.confirm) {
const { status, data } = await delHistory({bro_id: good.bro_id, goods_id: good.goods_id})
if(status) {
this.history_list[wrapIdx].date_list.splice(innerIdx, 1)
this.$toast({title: '删除成功'})
}
}
}
})
const { status, data } = await delHistory({bro_id: good.bro_id, goods_id: good.goods_id})
if(status) {
this.history_list[wrapIdx].date_list.splice(innerIdx, 1)
this.$toast({title: '删除成功'})
}
// uni.showModal({
// title: '提示',
// content: '您确定要删除这条历史吗?',
// confirmColor: '#FF661A',
// success: async res => {
// if(res.confirm) {
// const { status, data } = await delHistory({bro_id: good.bro_id, goods_id: good.goods_id})
// if(status) {
// this.history_list[wrapIdx].date_list.splice(innerIdx, 1)
// this.$toast({title: '删除成功'})
// }
// }
// }
// })
}catch(e){
console.log(e)
this.$toast({title: '删除失败'})
......@@ -315,7 +320,7 @@ export default {
.list-wrap {
box-sizing: border-box;
padding: 40rpx 0 0 0;
padding: 40rpx 0;
width: 690rpx;
height: calc(100vh - 98rpx);
margin: 0 auto;
......@@ -370,8 +375,9 @@ export default {
@include text-ellipsis(1);
}
.btn {
text-align: right;
color: $desc;
flex: 0 0 120rpx;
flex: 0 0 160rpx;
}
}
}
......
This diff is collapsed.
......@@ -28,33 +28,59 @@
>{{smsMsg}}</view>
</view>
<view class="item mb-4">
<view class="item flex j-between a-center mb-4">
<input
class="font-28 py-2 pl-2"
v-if="first"
class="font-28 py-2 pl-2 flex-1"
type="text"
placeholder="请输入新密码"
v-model="form.upwd"
/>
<input
v-else
class="font-28 py-2 pl-2 flex-1"
type="password"
placeholder="请输入新密码"
v-model="form.upwd"
/>
<view class="psd-visibility">icon</view>
<view
class="psd-visibility"
:class="first ? 'showPsd' : 'hidePsd'"
@click.stop="handleShowPsd('first', first)"
></view>
</view>
<view class="item mb-2">
<!-- 动态改变input的type在真机上会无法切换 -->
<view class="item flex j-between a-center mb-2">
<input
class="font-28 py-2 pl-2"
v-if="second"
class="font-28 py-2 pl-2 flex-1"
type="text"
placeholder="再次输入密码"
v-model="form.upwd2"
/>
<input
v-else
class="font-28 py-2 pl-2 flex-1"
type="password"
placeholder="再次输入密码"
v-model="form.upwd2"
/>
<view class="psd-visibility">icon</view>
<view
class="psd-visibility"
:class="second ? 'showPsd' : 'hidePsd'"
@click.stop="handleShowPsd('second', second)"></view>
</view>
<view class="tips">密码由6-12位英文字母或数字组成</view>
</view>
<view class="submit font-bold font-32 text-center" @click="handleReset">提交</view>
</view>
</template>
0
<script>
import { mapState } from 'vuex'
......@@ -67,6 +93,8 @@ export default {
return {
smsMsg: '获取验证码',
smsDisabled: false,
first: false,
second: false,
form: {
phone: '',
f_code: '',
......@@ -75,7 +103,11 @@ export default {
}
}
},
computed: {
...mapState({
storeInfo: state => state.user.storeInfo
})
},
methods: {
...common,
......@@ -106,16 +138,24 @@ export default {
async handleReset() {
try{
const validateErr = this.validateForm()
console.log(validateErr)
if(validateErr) return this.$toast({title: validateErr})
const { status, msg } = await forgetPwd(this.form)
console.log(status, msg)
if(status) {
this.$toast({title: msg})
}
if(status) {
this.$toast({title: msg, cb: () => {uni.navigateBack()}})
}
}catch(e){
console.log(e)
this.$toast({title: e.msg || '程序错误'})
}
},
handleShowPsd(key, status) {
uni.hideKeyboard()
this[key] = !status
// this.$set(this.showPsd, key, )
}
}
}
......@@ -141,7 +181,7 @@ export default {
height: 88rpx;
border-radius: 8rpx;
background-color: #f7f7f7;
.sms-btn, .psd-visibility {
.sms-btn {
position: absolute;
right: 20rpx;
top: 50%;
......@@ -151,9 +191,53 @@ export default {
transform: translateY(-50%);
color: $primary;
}
.psd-visibility {
flex: 0 0 68rpx;
height: 88rpx;
line-height: 88rpx;
color: $primary;
}
.disabledSmsBtn {
color: $desc;
}
.showPsd {
right: 0;
width: 68rpx;
&:after {
display: inline-block;
content: '';
position: absolute;
right: 20rpx;
top: 50%;
transform: translateY(-50%);
width: 34rpx;
height: 20rpx;
z-index: 21;
background-image: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAEQAAAAsCAMAAADrau63AAAA/FBMVEUAAAD/gID/gED/gCv/gED/cTn/ZjPuZjPvcDDyayjyZibzaC70byzrbCfsaC/wbCfwaS3rZyfsZSbsZiruaCfuZibsaCfrZSftZiftaCfuZSnuZyjrZijraCfsZynsZijtZSfsZibsZyjtZifsZifsZijtZiftZSbtZibtZibrZSjsZyfsZifrZSbrZifsZifsZSbsZifsZifrZSbrZibrZSfsZibsZSfrZSbsZifsZSbrZifrZSfsZSbrZifrZibrZSfsZifsZifsZibsZSbrZSbrZifsZifsZifsZSbsZibsZibsZSfrZSfrZifrZibsZSfsZifsZSbrZSbIJ2ATAAAAU3RSTlMAAgQGCAkKDxATFBYXGhshIjQ1Nzs8Qk5VVlhZWlteX2JrbXB2en1+f4yNlZaam56ho6Wmp6mtsLW5usPEyc3O0d/h4uPo6+zu7/Dx8vT19vn7/gAR9X4AAAHHSURBVEjHvVZnc8IwDIWyy96zYRQItEDZe4e9wf//v7QQQgA5Trjz9X2T9PxyViRLKpUk9L5MudUf73bjfqvM+vSql+HO9o7oAcde1v2KgiE+RFgM4waFErb8Dklil7cpkNClt4iIbVonpxHmkCy4MFHC2ECK0DBKa7hGSCFGLimNxAEpxiGBlVAX0EsoqKHGWxlD3NQYj93uYWobTLD89qyhqUPWOnUrdX1qDeN1zaOGtgk5Xcs9w9KFjKb2QaQKGZWn72gqkFO9J7Aw3tGAG3cgixXDgROILs0w9+YloJ0CQtC5h59ICgcj39mY6WokIW/vvNb6BMYW15QFVmdrzlzTv4DMCd8BRUwNlPhTjGAHebuEoRbPAT+uHEOXM6aZYK/4FIVwXP8fcYoL8Df9FB0ffPZw3KlJVcM2hvVy5kd05C4OK5ZcI4rkREeWKEK6TkR0xIjXISXWvBLsmYmYWOIvDgo2I/OLicXGzC89EJAtNmLZv8e+chGzfNnTaUA6TwGdR4nO80jloZYcGVGvw+GNKhwZdIYXnTFKaaDTWS3O3a9kyYnIrlus3LrF6v5n8aO0glJahm9reaU94PZ7btCuZEhr+S9R2SzMt+mqIQAAAABJRU5ErkJggg==);
background-size: 100% 100%;
background-position: 0 0;
}
}
.hidePsd {
right: 0;
height: 88rpx;
&:after {
display: inline-block;
content: '';
position: absolute;
right: 20rpx;
top: 50%;
transform: translateY(-50%);
width: 34rpx;
height: 20rpx;
z-index: 21;
background-image: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAEQAAAAsCAMAAADrau63AAABhlBMVEUAAAD///+AgICqqqqAgICAgICAgICOjo6AgICJiYl/f3+IiIiAgICHh4eGhoaAgICFhYWAgICEhIR/f3+EhIR/f3+AgICDg4OCgoKAgICCgoJ/f3+CgoKAgICCgoJ/f3+CgoJ/f3+AgICBgYF/f3+BgYGAgICAgICAgIB/f3+AgICBgYGAgICAgICBgYGAgIB/f3+BgYGAgICBgYGBgYGBgYGAgICBgYGBgYF/f3+BgYGAgICAgICAgICAgICAgICAgICAgIB/f3+AgIB/f3+AgICAgICAgICAgICAgICAgICAgICAgIB/f3+AgICAgICAgICAgICAgICAgICAgICAgIB/f3+AgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIB/f3+AgICAgICAgICAgIB/f3+AgICAgIB/f3+AgIB/f3+AgIB/f3+AgIB/f3+AgICAgICAgICAgICAgIB/f3+AgICAgIB/f3/8hC/QAAAAgXRSTlMAAQIDBAYICQoNDg8QERMWFxgbHB0eICExMjM0NTY3ODs8QkNKS0xOUFJUVVZYWVpcXV5ja210dX1+f4CBg4WIiYqMjY6PkJiam6ChpaanqKmtr7Cxtba3ubq9vsPExsfJy83O0djc3d/h4uPl6Onq6+3u7/Lz9PX29/j5+vv8/f4wWT1qAAACsUlEQVRIx62WZ1saQRSFR7D3gr33XhJLxERFjLGgxt5NsKGiYEEponHff54PQOLOUpbnYb7NOXfv7t45c+8RIubKbplY3ju99vmuT/eWzS3ZIunVYLW/oVpvdmtDMhnyRs7DTyoeh/34whNJdD6SpzNF6YIP4OX39x6TMQRlmLpm7a8AvoVSHSmyxr2AcvhZU4PswQMF8I5nJcox4AQ83yqis5WTD4BzIG6K/E0gMFMQJ8ISADbzY0fUXQFLZfG/1WQDrupi0aNBuOtIXLY2NwRHo1KGRWCnWM/5Fe8CiwYtkb4MypgE5vTZji8vj5f6ctR42tg7LKfLOTLWIdivxnKnfBGV+aZy1VxfENYz1FjmNjy1qrEmF8Cr0/kK4GpSs61PsJ2pglbhvkpSTBC81kaDEIbGWS8EJXVU38PqR8AMPul2NQdhqySyK9mCYLM6ot4H5v/bXoU/7ZKo3DCX9qGUc+CWJNb+htIb2dT6YVgqtAU20lQHsgEWKWgY/LXhl97AlEQXBHguUkNFzwTk+zAFN6HPs8GRUWKHYFpWwTQMSZDxCGxCCNEJj+XyAz+hRsZqpNMQQgjTI3QKUeiCbo1+T/BrRe3nRIN1g6tQrMG8Nv4WhxZ0cKsF52EtNUlS8juiEx5NMreqs7DlocKm5ohTI7aUyF6IXoW3RBfwR5QL+OfDBQy1gvpkW0GDuhWEmlJ1ck2pSm5KqWmPoUbdp79R90dp1KGR8T6Wpm9kiC9KtJERHl67+obXTozhFR6j7rbEOTruYo7RyEC3meKnKFuKO9Aj1sISxzgUzCSyFhGT8zBZGZ2t+OpJbHKEEFlmL6AcDGrt1qdDBfCas3TUPmz8Xu3WLlNYCUZTz+yvF/3GT21B8Vwc2x0eJWkLmiIz/M+Wr+yfOf1+59n+ykQ8W/4XXFIzWaOprJ0AAAAASUVORK5CYII=);
background-size: 100% 100%;
background-position: 0 0;
}
}
}
.tips {
......
......@@ -2,7 +2,7 @@
<view class="wrap">
<view class="store-info my-2 flex j-star a-center" v-if="storeInfo">
<image
class="logo"
class="logo mr-2"
:src="baseUrl + '/' + storeInfo.shop_img"
mode="aspectFit"
/>
......@@ -14,31 +14,31 @@
<view class="store-introduct">
<view class="font-28 font-bold">基本信息</view>
<view class="store-item py-2 font-28">
<view class="store-item py-3 font-28">
<text class="hd">公司名称</text>
<text class="flex-1">{{storeInfo.shop_name}}</text>
</view>
<view class="store-item py-2 font-28">
<view class="store-item py-3 font-28">
<text class="hd">所在地</text>
<text class="flex-1">{{storeInfo.ap + storeInfo.ac + storeInfo.ad }}</text>
</view>
<view class="store-item py-2 font-28">
<view class="store-item py-3 font-28">
<text class="hd">详细地址</text>
<text class="flex-1">{{storeInfo.address}}</text>
</view>
<view class="store-item py-2 font-28">
<view class="store-item py-3 font-28">
<text class="hd">联系电话</text>
<text class="flex-1 theme">{{storeInfo.shop_tel}}</text>
</view>
<view class="store-item py-2 font-28">
<view class="store-item py-3 font-28">
<text class="hd">营业时间</text>
<text class="flex-1">{{startT + '' + endT}}</text>
</view>
<view class="store-item py-2 font-28">
<view class="store-item py-3 font-28">
<text class="hd">自提时间</text>
<text class="flex-1">{{storeInfo.pickup_hours}}</text>
</view>
<view class="store-item py-2 font-28">
<view class="store-item pt-3 font-28">
<text class="hd">创建时间</text>
<text class="flex-1">{{createTime}}</text>
</view>
......@@ -105,7 +105,7 @@ export default {
}
.store-introduct {
@include borderBox(20rpx, 20rpx);
@include borderBox(30rpx, 30rpx);
width: 690rpx;
margin: 0 auto;
background-color: #fff;
......
......@@ -15,7 +15,9 @@
/>
</template>
<template v-else>
<open-data class="avatar-img" type="userAvatarUrl"></open-data>
<view class="avatar-img">
<open-data type="userAvatarUrl"></open-data>
</view>
</template>
</view>
</view>
......@@ -29,6 +31,7 @@
:value="userInfo.nickname"
confirm-type="done"
@confirm="changeNickname"
@blur="changeNickname"
/>
</template>
<template v-else>
......@@ -40,7 +43,12 @@
<view class="item w-100 flex j-between a-center">
<view>手机号</view>
<view class="nickname text-right">
{{userInfo.phone}}
<!-- {{userInfo.phone}} -->
<input
type="text"
:value="userInfo.phone"
disabled
/>
</view>
</view>
</view>
......@@ -127,7 +135,9 @@ export default {
async changeNickname(e) {
try{
const { status, data } = await editNickname(e.detail.value)
const val = e.detail.value
if(val === this.userInfo.nickname) return
const { status, data } = await editNickname(val.trim())
if(status) {
this.setUserInfo()
this.$toast({title: '修改成功'})
......@@ -149,13 +159,14 @@ export default {
<style lang="scss" scoped>
.wrapper {
margin-bottom: 98rpx;
box-sizing: border-box;
padding-bottom: 98rpx;
padding-top: 57rpx;
color: #000;
.userInfo {
.item {
@include borderBox(20rpx, 30rpx);
@include borderBox(30rpx, 30rpx);
background-color: #FFFFFF;
border-bottom: 1rpx solid $line;
&:last-child {
......@@ -168,6 +179,8 @@ export default {
.avatar-img {
width: 100%;
height: 100%;
border-radius: 8rpx;
overflow: hidden;
}
}
}
......
......@@ -15,7 +15,7 @@ export default {
if(!url) return this.$toast({title: '缺少地址', cb: () => {
uni.navigateBack()
}})
this.webUrl = `${baseUrl}/{url}`
this.webUrl = `${baseUrl}/${url}`
},
methods: {
webViewLoadErr() {
......
......@@ -52,9 +52,7 @@ export function throttle(callback, wait = 3000) {
*/
export function debounce(func, wait = 1000, immediate = true) {
let timeout
console.log(func, wait)
return function(...args) {
console.log(args)
let context = this
if (timeout) clearTimeout(timeout)
......@@ -95,16 +93,41 @@ export function makePhoneCall() {
/**
* @微信支付
* @param { Functiom } cb 回调函数
* @param { Functiom } successCb 成功回调函数
* @param { Functiom } failCb 失败回调函数
* @param { Object } params 支付参数
*
timeStamp: '',
nonceStr: '',
package: '',
signType: 'RSA',
paySign: '',
*/
export function wxPay(cb) {
uni.requestPayment({
timeStamp: '',
nonceStr: '',
package: '',
signType: 'MD5',
paySign: '',
success (res) { },
fail (res) { }
export function wxPay({
params,
successCb,
failCb
}) {
console.log(params, successCb,
failCb)
wx.requestPayment({
// provider: 'wxpay',
...Object.assign(params, {
signType: 'RSA'
}),
success: res => {
// do
successCb && isFunction(successCb) && successCb()
},
fail: err => {
console.log(err)
Toast({
title: err.errMsg || '支付失败',
cb: () => {
failCb && isFunction(failCb) && failCb()
}
})
}
})
}
\ No newline at end of file
......@@ -31,7 +31,8 @@ class LoadMore {
this.total = count
this.totalPage = pages
this.flat = false
return { status: true, data: data.list, msg: '成功' }
// time是订单用的
return { status: true, data: data.list, time: data.time || 0, msg: '成功' }
} catch (e) {
console.log(e)
return Toast({title: '获取列表失败'})
......
import Vue from "vue"
import { getStorage, setStorage } from "@/lib/storage/index.js"
import Toast from "@/lib/toast/index.js"
import Modal from '@/lib/modal/index.js'
import { checkLogin } from '@/utils/modules/login.js'
import dayjs from 'dayjs'
Vue.prototype.$getStorage = getStorage
Vue.prototype.$setStorage = setStorage
Vue.prototype.$toast = Toast
Vue.prototype.$modal = Modal
Vue.prototype.$checkLogin = checkLogin
Vue.filter('parseTime', timestamp => {
if (!timestamp) return ''
return dayjs(timestamp * 1000).format('YYYY-MM-DD HH-mm-ss')
})
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment