Commit d115cec6 authored by June's avatar June

feature:many

parent 21220c8d
<script> <script>
import { mapActions } from 'vuex' import { mapActions } from 'vuex'
// import { wxLogin } from '@/apis/user.js'
import { login_wx } from '@/utils/modules/login.js' import { login_wx } from '@/utils/modules/login.js'
import dayjs from 'dayjs'
import { removeStorage } from '@/lib/storage/index.js'
export default { export default {
onLaunch: function() { onLaunch: function() {
this.setSystemInfo() // 获取系统信息 this.setSystemInfo() // 获取系统信息
...@@ -22,6 +22,14 @@ export default { ...@@ -22,6 +22,14 @@ export default {
// uni.setEnableDebug({ // uni.setEnableDebug({
// enableDebug: true // enableDebug: true
// }) // })
uni.getStorageInfo({
success: res => {
if(res.currentSize > 5120) {
removeStorage('search-history')
}
}
})
}, },
methods: { methods: {
...@@ -70,4 +78,7 @@ export default { ...@@ -70,4 +78,7 @@ export default {
.primaryColor { .primaryColor {
color: $primary!important; color: $primary!important;
} }
.descColor {
color: $desc!important;
}
</style> </style>
...@@ -16,16 +16,6 @@ export function addressList(params) { ...@@ -16,16 +16,6 @@ export function addressList(params) {
}) })
} }
/**
* @desc 默认收货地址接口
*/
export function defaultAddress() {
return request({
url: `zsxcx/getDefaultAddressXcx.htm`,
method: 'post'
})
}
/** /**
* @desc 新增/编辑地址 * @desc 新增/编辑地址
* @params { } look docs * @params { } look docs
......
...@@ -33,6 +33,7 @@ export function cateGoodsList(cat_id, keywords = '') { ...@@ -33,6 +33,7 @@ export function cateGoodsList(cat_id, keywords = '') {
export function homeCategory() { export function homeCategory() {
return request({ return request({
url: 'zsxcx/indexGoodsXcx.htm', url: 'zsxcx/indexGoodsXcx.htm',
method: 'post' method: 'post',
needMask: true
}) })
} }
\ No newline at end of file
...@@ -13,7 +13,8 @@ export function preConfirmOrderData(params) { ...@@ -13,7 +13,8 @@ export function preConfirmOrderData(params) {
return request({ return request({
url: 'zsxcx/orderDetail.htm', url: 'zsxcx/orderDetail.htm',
method: 'post', method: 'post',
data: params data: params,
needMask: true
}) })
} }
...@@ -25,34 +26,76 @@ export function confirmOrder(params) { ...@@ -25,34 +26,76 @@ export function confirmOrder(params) {
return request({ return request({
url: 'zsxcx/orderInfoXcx.htm', url: 'zsxcx/orderInfoXcx.htm',
method: 'post', method: 'post',
data: params data: params,
needMask: true
}) })
} }
/** /**
* @desc 获取订单列表 * @desc 获取订单列表
*/ */
export function orderList() { export function orderList(params) {
return request({ return request({
url: `${baseUrl}/a` url: 'zsxcx/orderXcx.htm',
method: 'post',
data: params
}) })
} }
/** /**
* @desc 订单详情 * @desc 订单详情
*/ */
export function orderDetail() { export function orderDetail(order_sn) {
return request({ return request({
url: `${baseUrl}/a` url: 'zsxcx/snapshotXcx.htm',
method: 'post',
data: {
order_sn
},
needMask: true
}) })
} }
/** /**
* @desc 删除订单 * @desc 提醒发货接口
*/ */
export function delOrder() { export function remindOrder({order_id, order_sn}) {
return request({ return request({
url: `${baseUrl}/a` url: 'zsxcx/remindXcx.htm',
method: 'post',
data: {
order_sn,
order_id
},
needMask: true
})
}
/**
* @desc 取消订单
*/
export function cancelDetail1(order_sn) {
return request({
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 @@ ...@@ -2,7 +2,7 @@
<view class="empty flex flex-column j-center a-center"> <view class="empty flex flex-column j-center a-center">
<image <image
style="width: 400rpx;" style="width: 400rpx;"
class="my-4" class="mb-2"
:src="iconSrc" :src="iconSrc"
mode="widthFix" mode="widthFix"
/> />
......
import { isArray } from "@/utils/types.js"
// 判断是否符合购买条件 // 判断是否符合购买条件
function judgePay(skuData) { function judgePay(skuData) {
for(let i = 0, j = skuData.length; i < j; i ++) { for(let i = 0, j = skuData.length; i < j; i ++) {
......
...@@ -28,25 +28,20 @@ ...@@ -28,25 +28,20 @@
:params="{ :params="{
index index
}" }"
:max="~~item.inventory"
@change="numberChange" @change="numberChange"
/> />
</view> </view>
</view> </view>
<view class="w-100 flex j-between a-center"> <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 ? 询价 : 固定售价 --> <!-- 如果不是阶梯价 ? 价格 === 0 ? 询价 : 固定售价 -->
<template v-if="goods.is_inquiry"> <template v-if="goods.is_inquiry === '1'">
<text>询价</text> <text>询价</text>
</template> </template>
<template v-else> <template v-else>
<!-- <text v-if="item.is_tiered === '1'">¥{{item.tiered_pri}}</text> <text>{{item.price}}</text>
<text v-else-if="item.is_tiered === '0' && item.price === '0'">询价</text> <text class="originPrice ml-1">¥{{item.original_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>
</template> </template>
</view> </view>
...@@ -55,7 +50,17 @@ ...@@ -55,7 +50,17 @@
<text v-else class="primaryColor">库存需咨询商家</text> <text v-else class="primaryColor">库存需咨询商家</text>
</view> </view>
<view class="payCount text-center"> <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> </view>
</view> </view>
...@@ -63,8 +68,8 @@ ...@@ -63,8 +68,8 @@
<view class="flex w-100 a-center flex-column font-28 mt-2"> <view class="flex w-100 a-center flex-column font-28 mt-2">
<view class="as-end"> <view class="as-end">
共<text class="btn-theme">{{totalCounts}}</text>件 共<text class="primaryColor">{{totalCounts}}</text>{{goods.unit || ''}}
<text class=" ml-2 price btn-theme">¥{{goods.is_inquiry ? '--' : totalPrice}}</text> <text class=" ml-2 price primaryColor">¥{{~~goods.is_inquiry ? '--' : totalPrice}}</text>
</view> </view>
</view> </view>
...@@ -130,17 +135,21 @@ export default { ...@@ -130,17 +135,21 @@ export default {
*/ */
async show(params) { async show(params) {
try{ try{
console.log(params)
this.goods = params.goodsInfo this.goods = params.goodsInfo
this.skuData = params.skuData 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.$refs.goodsPopup.open()
this.total() this.total()
}catch(e){ }catch(e){
console.log(e) console.log(e)
this.$toast({title: e.msg || '程序错误'}) this.$toast({title: e.msg || '程序错误'})
} }
}, },
hide() { hide() {
...@@ -168,12 +177,30 @@ export default { ...@@ -168,12 +177,30 @@ export default {
total() { total() {
const skuData = this.skuData const skuData = this.skuData
this.totalCounts = skuData.reduce((pre, cur) => { return pre + ~~cur.counts}, 0) 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() { handleCart() {
const skuData = this.skuData const skuData = this.skuData
if(this.totalCounts === 0) return this.$toast({title: '请选择购买数量'})
if(!this.judgePay(skuData)) return this.$toast({title: '购买数量不能少于起购数量'}) if(!this.judgePay(skuData)) return this.$toast({title: '购买数量不能少于起购数量'})
const fn = [] const fn = []
for(let i = 0, j = skuData.length; i < j; i ++) { for(let i = 0, j = skuData.length; i < j; i ++) {
...@@ -202,6 +229,7 @@ export default { ...@@ -202,6 +229,7 @@ export default {
const skuData = this.skuData const skuData = this.skuData
console.log(skuData) console.log(skuData)
if(skuData.length === 0) return if(skuData.length === 0) return
if(this.totalCounts === 0) return this.$toast({title: '请选择购买数量'})
// if(this.totalPrice === 0) return this.$toast({title: '请选择规格数量'}) // if(this.totalPrice === 0) return this.$toast({title: '请选择规格数量'})
if(!this.judgePay(skuData)) return this.$toast({title: '购买数量不能少于起购数量'}) if(!this.judgePay(skuData)) return this.$toast({title: '购买数量不能少于起购数量'})
const sku_ids = [] const sku_ids = []
...@@ -220,6 +248,7 @@ export default { ...@@ -220,6 +248,7 @@ export default {
uni.navigateTo({ uni.navigateTo({
url: `/pages/order/confirm-order?params=${encodeURIComponent(JSON.stringify(params))}` url: `/pages/order/confirm-order?params=${encodeURIComponent(JSON.stringify(params))}`
}) })
this.hide()
}catch(e){ }catch(e){
console.log(e) console.log(e)
} }
...@@ -242,7 +271,7 @@ export default { ...@@ -242,7 +271,7 @@ export default {
.sku-list { .sku-list {
height: 372rpx; height: 372rpx;
@include borderBox(30rpx, 20rpx); @include borderBox(0, 20rpx);
.sku-item { .sku-item {
border-bottom: 1rpx solid $line; border-bottom: 1rpx solid $line;
} }
...@@ -288,8 +317,5 @@ export default { ...@@ -288,8 +317,5 @@ export default {
} }
} }
.btn-theme {
color: $primary;
}
} }
</style> </style>
<template> <template>
<view class="wrpper flex j-between a-center"> <view class="wrpper flex j-between a-center" @touchmove.stop.prevent="clear">
<view <view
class="btn iconfont icon-jianhao flex j-center a-center" class="btn iconfont icon-jianhao flex j-center a-center"
:class="calVal <= min ? 'disabled' : null" :class="calVal <= min ? 'disabled' : null"
...@@ -8,8 +8,9 @@ ...@@ -8,8 +8,9 @@
<input <input
class="input" class="input"
type="number" type="number"
:value="calVal" v-model="calVal"
@input="inputVal" @confirm="inputVal"
@blur="inputVal"
/> />
<view <view
class="btn iconfont icon-hao flex j-center a-center" class="btn iconfont icon-hao flex j-center a-center"
...@@ -47,16 +48,26 @@ export default { ...@@ -47,16 +48,26 @@ export default {
}, },
watch: { watch: {
calVal: throttle(function(newVal) { 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', { this.$emit('change', {
params: this.params, params: this.params,
val: ~~newVal val: newVal_number
}) })
}, 800) }, 800)
}, },
methods: { methods: {
clear(e) {
// TODO nvue 取消冒泡
e.stopPropagation()
return
},
subtraction() { subtraction() {
const val = this.calVal 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 this.calVal -= 1
}, },
add() { add() {
...@@ -70,12 +81,15 @@ export default { ...@@ -70,12 +81,15 @@ export default {
this.calVal += 1 this.calVal += 1
}, },
inputVal(e) { inputVal(e) {
const inputVal = ~~e.detail.value let inputVal = ~~e.detail.value
const max = this.max const max = this.max
const min = this.min
if(max && inputVal >= max) { if(max && inputVal >= max) {
this.calVal = max inputVal = max
this.$toast({title: '数量不能大于商品库存'}) this.$toast({title: '数量不能大于商品库存'})
return } else if(inputVal < min) {
inputVal = min
this.$toast({title: `数量不能少于${min}`})
} }
this.calVal = inputVal 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 @@ ...@@ -5,7 +5,7 @@
</template> </template>
<template v-else-if="is_tiered === '1'"> <template v-else-if="is_tiered === '1'">
<text class="mr-1">¥{{price}}</text> <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> <text v-if="goods_unit">/{{goods_unit}}</text>
</template> </template>
<template v-else> <template v-else>
......
<template> <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="['fade']" :styles="maskClass" :duration="duration" :show="showTrans" @click="onTap" />
<uni-transition :mode-class="ani" :styles="transClass" :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"> <view class="uni-popup__wrapper-box" @click.stop="clear">
......
const env = { const env = {
release: 'https://www.gelifood.com/', // 正式版 release: 'https://www.gelifood.com', // 正式版
trial: 'https://d.gelifood.com', // 体验版 trial: 'https://d.gelifood.com', // 体验版
develop: '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) { ...@@ -33,6 +33,9 @@ async function successRes(res, options, resolve, reject) {
const status = data.code const status = data.code
switch(status) { switch(status) {
case 10: case 10:
if(store.state.user.isOverdue) {
store.state.user.isOverdue = false
}
resolve({ resolve({
status: true, status: true,
data: data.data, data: data.data,
...@@ -59,7 +62,9 @@ async function successRes(res, options, resolve, reject) { ...@@ -59,7 +62,9 @@ async function successRes(res, options, resolve, reject) {
}) })
break; break;
case -11: // 购买的服务过期 case -11: // 购买的服务过期
if(!store.state.user.isOverdue) {
store.state.user.isOverdue = true store.state.user.isOverdue = true
}
return Toast({title: data.rep_msg}) return Toast({title: data.rep_msg})
break; break;
default: default:
...@@ -100,15 +105,15 @@ export function request (options) { ...@@ -100,15 +105,15 @@ export function request (options) {
uni.showLoading({title: '加载中...', mask: true}) uni.showLoading({title: '加载中...', mask: true})
} }
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
const isOverdue = store.state.user.isOverdue // const isOverdue = store.state.user.isOverdue
if(isOverdue) { // if(isOverdue) {
reject({ // reject({
status: false, // status: false,
data: null, // data: null,
msg: '服务已过期' // msg: '服务已过期'
}) // })
return // return
} // }
const token = store.state.user.token || '' const token = store.state.user.token || ''
const appid = store.state.user.appid || '' const appid = store.state.user.appid || ''
uni.request({ uni.request({
...@@ -145,15 +150,15 @@ export function upload(options) { ...@@ -145,15 +150,15 @@ export function upload(options) {
options.url = `${baseUrl}/${options.url}` options.url = `${baseUrl}/${options.url}`
uni.showLoading({title: '上传中...', mask: true}) uni.showLoading({title: '上传中...', mask: true})
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
const isOverdue = store.state.user.isOverdue // const isOverdue = store.state.user.isOverdue
if(isOverdue) { // if(isOverdue) {
reject({ // reject({
status: false, // status: false,
data: null, // data: null,
msg: '服务已过期' // msg: '服务已过期'
}) // })
return // return
} // }
const token = store.state.user.token || '' const token = store.state.user.token || ''
const appid = store.state.user.appid || '' const appid = store.state.user.appid || ''
uni.uploadFile({ uni.uploadFile({
......
...@@ -20,3 +20,4 @@ export default function Toast(options) { ...@@ -20,3 +20,4 @@ export default function Toast(options) {
} }
}) })
} }
...@@ -7,8 +7,10 @@ import "@/utils/vue_extend.js" // 常用方法 ...@@ -7,8 +7,10 @@ import "@/utils/vue_extend.js" // 常用方法
// 全局组件 // 全局组件
import emptyView from '@/components/empty-view/index.vue' import emptyView from '@/components/empty-view/index.vue'
import uniPopup from '@/components/uni-popup/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('empty-view', emptyView)
Vue.component('uni-popup', uniPopup) Vue.component('uni-popup', uniPopup)
Vue.component('c-nav_bar' , cNav_bar)
Vue.prototype.$store = store 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": [ "pages": [
{
"path": "pages/order/order-detail",
"style": {
"navigationBarTitleText": "订单详情"
}
},
{ {
"path": "pages/home/index", "path": "pages/home/index",
"style": { "style": {
...@@ -52,6 +47,12 @@ ...@@ -52,6 +47,12 @@
"navigationBarTitleText": "订单管理" "navigationBarTitleText": "订单管理"
} }
}, },
{
"path": "pages/order/order-detail",
"style": {
"navigationBarTitleText": "订单详情"
}
},
{ {
"path": "pages/order/confirm-order", "path": "pages/order/confirm-order",
"style": { "style": {
...@@ -117,6 +118,24 @@ ...@@ -117,6 +118,24 @@
"style": { "style": {
"navigationBarTitleText": "店铺详情" "navigationBarTitleText": "店铺详情"
} }
},
{
"path": "afterSales/apply",
"style": {
"navigationBarTitleText": "申请售后"
}
},
{
"path": "afterSales/detail",
"style": {
"navigationBarTitleText": "申请退款/退货"
}
},
{
"path": "pay_status/index",
"style": {
"navigationBarTitleText": "支付结果"
}
} }
] ]
}], }],
......
<template> <template>
<view class="wrapper"> <view class="wrap">
<view v-if="!token"> <template v-if="isOverdue">
<view style="width: 100vw; height: 100vh;display: flex;justify-content: center;align-items: center;">
<over-due />
</view>
</template>
<template v-else>
<template v-if="!token">
<empty-view <empty-view
iconSrc="/static/images/common/icon-empty.png" iconSrc="/static/images/common/icon-empty.png"
text="啥都没有,快去逛逛吧~" text="啥都没有,快去逛逛吧~"
/> />
<view class="login-btn" @click="handleLogin">登录</view> <view class="login-btn" @click="handleLogin">登录</view>
</view> </template>
<view v-else style="margin-bottom: 98rpx;"> <template v-else>
<template v-if="cartList.length === 0"> <template v-if="cartList.length === 0">
<view style="width: 100vw;height: 100vh;">
<empty-view <empty-view
iconSrc="/static/images/common/icon-empty.png" iconSrc="/static/images/common/icon-empty.png"
text="啥都没有,快去逛逛吧~" text="啥都没有,快去逛逛吧~"
/> />
</view>
</template> </template>
<template v-else> <template v-else>
...@@ -22,20 +32,20 @@ ...@@ -22,20 +32,20 @@
class="list-item" class="list-item"
v-for="(item, index) in cartList" v-for="(item, index) in cartList"
:key="item.goods_id" :key="item.goods_id"
@click.stop="handleDetail(item.goods_id)"
> >
<view class="w-100 flex j-star a-center"> <view class="w-100 flex j-star a-center">
<view <view
class="mr-1" class="mr-1"
:class="item.checked ? 'agreement-icon_active' : 'agreement-icon'" :class="item.checked ? 'agreement-icon_active' : 'agreement-icon'"
@click="selectGoods(index, item)" @click.stop="selectGoods(index, item)"
/> />
<image <image
class="goods-cover mr-2" class="goods-cover mr-2"
:src="baseUrl + '/' + item.goods_thumb" :src="baseUrl + '/' + item.goods_thumb"
mode="aspectFit" mode="aspectFit"
@click="handleDetail(item.goods_id)"
/> />
<view class="goods-title flex j-start a-center flex-1 font-24">{{item.goods_name}}</view> <view class="goods-title flex j-start a-center flex-1 font-28">{{item.goods_name}}</view>
</view> </view>
<view <view
class="mb-2 ml-2" class="mb-2 ml-2"
...@@ -49,14 +59,14 @@ ...@@ -49,14 +59,14 @@
<view <view
class="mr-1" class="mr-1"
:class="cart.checked ? 'agreement-icon_active' : 'agreement-icon'" :class="cart.checked ? 'agreement-icon_active' : 'agreement-icon'"
@click="selectSku(index, cartIdx, cart.checked)" @click.stop="selectSku(index, cartIdx, cart.checked)"
></view> ></view>
<view class="w-100 flex j-between a-center"> <view class="w-100 flex j-between a-center">
<view class="specification font-24">{{cart.specification}}</view> <view class="specification font-24">{{cart.specification}}</view>
<view class="step-wrap"> <view class="step-wrap" @click.stop="stopClick">
<input-number <input-number
:defaultVal="cart.origin_number_sku > cart.cart_number ? cart.origin_number_sku : cart.cart_number" :defaultVal="cart.origin_number_sku | defaultCounts(cart.cart_number)"
:min="cart.origin_number_sku" :min="cart.origin_number_sku !== '0' ? cart.origin_number_sku : 1"
:params="{ :params="{
wrapIdx: index, wrapIdx: index,
innerIdx: cartIdx innerIdx: cartIdx
...@@ -66,15 +76,20 @@ ...@@ -66,15 +76,20 @@
</view> </view>
</view> </view>
</view> </view>
<view class="price flex j-start a-center"> <view class="price flex j-between a-center">
<price <price
class="flex-1"
:is_inquiry="cart.is_inquiry" :is_inquiry="cart.is_inquiry"
:price="cart.cart_price" :price="cart.cart_price"
/> />
<view class="flex-2 text-center">
<text class="specification font-28 ml-2" v-if="cart.inventory > 0">{{'库存:' + cart.inventory}}</text> <text class="specification font-28 ml-2" v-if="cart.inventory > 0">{{'库存:' + cart.inventory}}</text>
<text class="specification font-28 ml-2 primaryColor" v-else>库存需咨询商家</text> <text class="specification font-28 ml-2 primaryColor" v-else>库存需咨询商家</text>
</view> </view>
<view class="flex-2 text-center descColor" style="font-size: 20rpx;"><text v-if="cart.origin_number_sku !== '0'">{{cart.origin_number_sku + cart.goods_unit}}起购</text></view>
</view>
</view> </view>
</view> </view>
...@@ -84,18 +99,64 @@ ...@@ -84,18 +99,64 @@
<view class="w-100 cart_info flex j-between a-center"> <view class="w-100 cart_info flex j-between a-center">
<text class="font-24">不含运费</text> <text class="font-24">不含运费</text>
<text class="font-28 primary">合计:{{totalPrice}}</text> <text class="font-28 primary">
<text>合计:¥</text>
<template v-if="utils.showTotal(cartList)">
<text>{{totalPrice}}</text>
</template>
<template v-else>
<text>待确认</text>
</template>
</text>
<view class="font-28 py-2 px-1 primary" @click="removeCart">移除</view> <view class="font-28 py-2 px-1 primary" @click="removeCart">移除</view>
<view class="font-28 confirm-cart">结算</view> <view class="font-28 confirm-cart" @click="handlePay">结算({{utils.totalCounts(cartList)}})</view>
</view> </view>
</template> </template>
</view> </template>
</template>
</view> </view>
</template> </template>
<script module="utils" lang="wxs">
// 1 有询价商品显示待确定 2 统计
function showTotal(cartList) {
for(var i = 0; i < cartList.length; i++) {
if(cartList[i].checked) {
for(var k = 0; k < cartList[i].list.length; k ++) {
if(cartList[i].list[k].is_inquiry === '1') {
return false
}
}
}
}
return true
}
function totalCounts(cartList) {
var counts = 0
for(var i = 0; i < cartList.length; i++) {
if(cartList[i].checked) {
for(var k = 0; k < cartList[i].list.length; k ++) {
if(cartList[i].list[k].checked) {
counts += +cartList[i].list[k].cart_number
}
}
}
}
return counts
}
module.exports = {
showTotal: showTotal,
totalCounts: totalCounts
}
</script>
<script> <script>
import inputNumber from '@/components/inputNumber/index.vue' import inputNumber from '@/components/inputNumber/index.vue'
import price from '@/components/price/index.vue' import price from '@/components/price/index.vue'
import overDue from '@/components/overDue-view/index.vue'
import { mapState, mapActions } from 'vuex' import { mapState, mapActions } from 'vuex'
import cartModules from './cart-modules.js' import cartModules from './cart-modules.js'
...@@ -112,21 +173,29 @@ export default { ...@@ -112,21 +173,29 @@ export default {
components: { components: {
inputNumber, inputNumber,
price price,
overDue
}, },
onPullDownRefresh() { onPullDownRefresh() {
console.log('refresh');
setTimeout(function () { setTimeout(function () {
this.getCartList() this.getCartList()
uni.stopPullDownRefresh(); uni.stopPullDownRefresh();
}, 800); }, 800);
}, },
filters: {
defaultCounts(origin_number_sku, cart_number) {
// ~~cart.origin_number_sku > ~~cart.cart_number ? cart.origin_number_sku : cart.cart_number
console.log(origin_number_sku, cart_number)
return ~~origin_number_sku > ~~cart_number ? origin_number_sku : cart_number
}
},
computed: { computed: {
...mapState({ ...mapState({
token: state => state.user.token token: state => state.user.token,
isOverdue: state => state.user.isOverdue
}), }),
// 总价 // 总价
...@@ -135,7 +204,7 @@ export default { ...@@ -135,7 +204,7 @@ export default {
return pre + cur.list.filter(i => i.checked).reduce((p, c) => { return pre + cur.list.filter(i => i.checked).reduce((p, c) => {
return p + (c.cart_price * c.cart_number) return p + (c.cart_price * c.cart_number)
}, 0) }, 0)
}, 0) }, 0).toFixed(2)
} }
}, },
...@@ -149,7 +218,8 @@ export default { ...@@ -149,7 +218,8 @@ export default {
methods: { methods: {
...mapActions('cart', ['setCount']), ...mapActions('cart', ['setCount']),
...cartModules, ...cartModules,
stopClick() {return}, // 阻止input事件的冒泡
// login
handleLogin() { handleLogin() {
uni.navigateTo({ uni.navigateTo({
url: '/pages/login/index' url: '/pages/login/index'
...@@ -164,10 +234,12 @@ export default { ...@@ -164,10 +234,12 @@ export default {
// 选中/取消选中商品, 默认选中上级下的所有规格 // 选中/取消选中商品, 默认选中上级下的所有规格
selectGoods(index, item) { selectGoods(index, item) {
uni.showLoading({mask: true})
const curStatus = !item.checked const curStatus = !item.checked
item.checked = curStatus item.checked = curStatus
item.list.forEach(item => item.checked = curStatus) item.list.forEach(item => item.checked = curStatus)
this.$set(this.cartList, index, item) this.$set(this.cartList, index, item)
uni.hideLoading()
}, },
// 选中/取消规格, 父节点若没有选中要切换到选中状态 // 选中/取消规格, 父节点若没有选中要切换到选中状态
...@@ -220,15 +292,37 @@ export default { ...@@ -220,15 +292,37 @@ export default {
} }
} }
}) })
},
handlePay() {
const cartList = this.cartList
const cart_ids = []
for(let i = 0, j = cartList.length; i < j; i ++) {
if(cartList[i].checked) {
let item = cartList[i].list
for(let k = 0, h = item.length; k < h; k ++) {
if(item[k].checked) {
cart_ids.push(item[k].cart_id)
}
}
}
}
if(cart_ids.length === 0) return this.$toast({title: '请选择商品'})
const params = {
buy_type: 0,
cart_ids: cart_ids.join(',')
}
uni.navigateTo({
url: `/pages/order/confirm-order?params=${encodeURIComponent(JSON.stringify(params))}`
})
} }
} }
} }
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>
.wrapper { .wrap {
width: 100%; width: 100%;
height: ca;
.login-btn { .login-btn {
width: 520rpx; width: 520rpx;
height: 72rpx; height: 72rpx;
...@@ -242,6 +336,7 @@ export default { ...@@ -242,6 +336,7 @@ export default {
.list-wrap { .list-wrap {
margin-top: 40rpx; margin-top: 40rpx;
margin-bottom: 120rpx;
.list-item { .list-item {
@include borderBox(20rpx, 20rpx); @include borderBox(20rpx, 20rpx);
width: 690rpx; width: 690rpx;
...@@ -264,6 +359,8 @@ export default { ...@@ -264,6 +359,8 @@ export default {
@include text-ellipsis(3); @include text-ellipsis(3);
} }
.step-wrap { .step-wrap {
position: relative;
z-index: 1;
flex: 0 0 224rpx; flex: 0 0 224rpx;
width: 224rpx; width: 224rpx;
height: 64rpx; height: 64rpx;
......
<template> <template>
<view class="category-wrap w-100"> <view class="category-wrap w-100">
<template v-if="isOverdue">
<view style="width: 100vw; height: 100vh;display: flex;justify-content: center;align-items: center;">
<over-due />
</view>
</template>
<template v-else>
<!-- search bar --> <!-- search bar -->
<view class="searchBar-wrap flex j-center a-center w-100"> <view class="searchBar-wrap flex j-center a-center w-100">
<view class="search flex j-center a-center"> <navigator
class="search flex j-center a-center"
hover-class="none"
url="/pages/search/index"
>
<image class="search-icon mr-1" src="/static/images/common/icon-search.png" mode="aspectFit" /> <image class="search-icon mr-1" src="/static/images/common/icon-search.png" mode="aspectFit" />
<text class="font-24">搜索商品</text> <text class="font-24">搜索商品</text>
</view> </navigator>
</view> </view>
<!-- category 未优化,可以递归组件 --> <!-- 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"> <view class="category flex j-between w-100 font-24">
<scroll-view <scroll-view
class="scroll-left" class="scroll-left"
...@@ -21,6 +42,7 @@ ...@@ -21,6 +42,7 @@
v-for="(cate_1, cate_idx_1) in cate_list" v-for="(cate_1, cate_idx_1) in cate_list"
:key="cate_1.cat_id" :key="cate_1.cat_id"
:class="cate1_current === cate_1.cat_id ? 'cate-active' : null" :class="cate1_current === cate_1.cat_id ? 'cate-active' : null"
@click.stop=""
> >
<view <view
...@@ -44,17 +66,16 @@ ...@@ -44,17 +66,16 @@
</view> </view>
</view> </view>
</scroll-view> </scroll-view>
<view class="scroll-right flex-1"> <view class="scroll-right flex-1">
<view class="cates_title">{{cate1_name + '-' + cate2_name}}</view> <view class="cates_title">{{cate1_name}} {{cate2_name ? '-' + cate2_name : ''}}</view>
<pull-list <pull-list
ref="pullList" ref="pullList"
:refresherEnabled="false" :refresherEnabled="false"
@tolower='tolower'
> >
<view <view
class="goods-item flex j-start a-center" class="goods-item flex j-start a-center"
v-for="good in goods_list" v-for="good in goods_list"
...@@ -70,7 +91,13 @@ ...@@ -70,7 +91,13 @@
<view class="goods-price flex-1 flex flex-column j-between font-28"> <view class="goods-price flex-1 flex flex-column j-between font-28">
<view class="title">{{good.goods_name}}</view> <view class="title">{{good.goods_name}}</view>
<view class="w-100 flex j-between a-center"> <view class="w-100 flex j-between a-center">
<text class="price-txt">¥152.50</text> <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 <image
class="cart-icon" class="cart-icon"
src="/static/images/common/icon-cart.png" src="/static/images/common/icon-cart.png"
...@@ -82,12 +109,16 @@ ...@@ -82,12 +109,16 @@
</view> </view>
<view class="empty-text text-center mt-4 p-2">到底了,看看别的分类吧~</view> <view class="empty-text text-center mt-4 p-2">到底了,看看别的分类吧~</view>
</pull-list> </pull-list>
</view> </view>
</view> </view>
</template>
<!-- 购物弹窗 --> <!-- 购物弹窗 -->
<goods-popup ref="popup" /> <goods-popup ref="popup" />
</template>
</view> </view>
</template> </template>
...@@ -95,16 +126,15 @@ ...@@ -95,16 +126,15 @@
// 所有写法需要优化!!! // 所有写法需要优化!!!
import pullList from '@/components/pull-list/index.vue' import pullList from '@/components/pull-list/index.vue'
import goodsPopup from '@/components/goods-popup/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 { getCatetories, cateGoodsList } from '@/apis/category.js'
import { searchGoods, goodsSku } from '@/apis/goods.js' import { searchGoods, goodsSku } from '@/apis/goods.js'
import { baseUrl } from '@/config/index.js' import { baseUrl } from '@/config/index.js'
import { mapState, mapActions } from 'vuex' import { mapState, mapActions } from 'vuex'
let cat_id = 0 let cat_id = 0
// const params = {
// keywords: '',
// cat_id: 0
// }
export default { export default {
data() { data() {
return { return {
...@@ -120,17 +150,21 @@ export default { ...@@ -120,17 +150,21 @@ export default {
}, },
components: { components: {
pullList, pullList,
goodsPopup goodsPopup,
overDue,
price
}, },
computed: { computed: {
...mapState({ ...mapState({
token: state => state.user.token token: state => state.user.token,
isOverdue: state => state.user.isOverdue
}) })
}, },
async created() { async created() {
this.getCate() this.getCate()
}, },
onShow() { onShow() {
this.getCateGoods()
if(this.token) { if(this.token) {
this.setCount() this.setCount()
} }
...@@ -143,11 +177,11 @@ export default { ...@@ -143,11 +177,11 @@ export default {
if(status) { if(status) {
let cate_list = this.cate_list let cate_list = this.cate_list
cate_list = data cate_list = data
cat_id = cate_list[0].list[0].cat_id cat_id = cate_list[0].cat_id
this.cate2_current = cate_list[0].list[0].cat_id this.cate1_current = cate_list[0].cat_id
this.cate_list = cate_list this.cate_list = cate_list
this.cate1_name = cate_list[0].cat_name 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() this.getCateGoods()
} }
}catch(e){ }catch(e){
...@@ -158,18 +192,16 @@ export default { ...@@ -158,18 +192,16 @@ export default {
// 切换分类 type === 1 分类1 type === 2 分类2, cate1_idx 分类一的下表 // 切换分类 type === 1 分类1 type === 2 分类2, cate1_idx 分类一的下表
cateChange(type, cate_id, cate1_idx, cate2_idx) { cateChange(type, cate_id, cate1_idx, cate2_idx) {
console.log(type, cate_id, cate1_idx) if(cat_id === cate_id) return
if(type === 1) {
const cate_list = this.cate_list const cate_list = this.cate_list
if(type === 1) {
this.cate1_current = cate_id this.cate1_current = cate_id
this.cate2_current = cate_list[cate1_idx].list[0].cat_id this.cate2_current = "0" // 初始化,让二级不在激活状态
// params.cat_id = cate_list[cate1_idx].list[0].cat_id cat_id = cate_id
cat_id = cate_list[cate1_idx].list[0].cat_id
this.cate1_name = cate_list[cate1_idx].cat_name 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) { } else if(type === 2) {
this.cate2_current = cate_id this.cate2_current = cate_id
// params.cat_id = cat_id
cat_id = cate_id cat_id = cate_id
this.cate2_name = cate_list[cate1_idx].list[cate2_idx].cat_name this.cate2_name = cate_list[cate1_idx].list[cate2_idx].cat_name
} }
...@@ -199,9 +231,9 @@ export default { ...@@ -199,9 +231,9 @@ export default {
}) })
}, },
tolower() { // tolower() {
console.log('触底了') // console.log('触底了')
}, // },
// 点击拉起弹窗 // 点击拉起弹窗
async handlePop(goods) { async handlePop(goods) {
...@@ -217,7 +249,8 @@ export default { ...@@ -217,7 +249,8 @@ export default {
goodsInfo: { goodsInfo: {
cover: `${this.baseUrl}/${goods.goods_thumb}`, cover: `${this.baseUrl}/${goods.goods_thumb}`,
title: goods.goods_name, title: goods.goods_name,
is_inquiry: goods.is_inquiry is_inquiry: goods.is_inquiry,
unit: goods.goods_unit
}, },
skuData: data skuData: data
} }
...@@ -317,6 +350,7 @@ export default { ...@@ -317,6 +350,7 @@ export default {
.cart-icon { .cart-icon {
width: 34rpx; width: 34rpx;
height: 32rpx; 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> <template>
<view class="wrapper w-100"> <view class="wrapper w-100">
<c-nav_bar
showBack
title="商品详情"
bg="rgba(0, 0, 0, 0)"
/>
<!-- <left-menu-button /> --> <!-- <left-menu-button /> -->
<back-btn />
<view class="swiper-wrap"> <view class="swiper-wrap">
<swiper <swiper
...@@ -13,11 +17,12 @@ ...@@ -13,11 +17,12 @@
@change="swiperChange" @change="swiperChange"
> >
<swiper-item <swiper-item
class="w-100" class="w-100 flex j-center a-center"
v-for="(item, index) in detail.imgs" v-for="(item, index) in detail.imgs"
:key="index" :key="index"
> >
<image <image
class="w-100"
:src="baseUrl + '/' + item.img_url" :src="baseUrl + '/' + item.img_url"
lazy-load lazy-load
mode="widthFix" mode="widthFix"
...@@ -25,7 +30,7 @@ ...@@ -25,7 +30,7 @@
</swiper-item> </swiper-item>
</swiper> </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>
<view class="goods-info mb-2"> <view class="goods-info mb-2">
...@@ -33,7 +38,7 @@ ...@@ -33,7 +38,7 @@
<view class="font-28 font-bold mb-2">{{detail.goods_name}}</view> <view class="font-28 font-bold mb-2">{{detail.goods_name}}</view>
<view class="counts w-100 flex j-start a-center"> <view class="counts w-100 flex j-start a-center">
<view class="mr-4">现库存:{{inventory}}</view> <view class="mr-4">现库存:{{inventory}}</view>
<view>总销量:{{detail.virtual_quantity_sold}}</view> <view>总销量:{{detail.virtual_quantity_sold || 0}}</view>
</view> </view>
</view> </view>
...@@ -41,8 +46,9 @@ ...@@ -41,8 +46,9 @@
<!-- 物流 --> <!-- 物流 -->
<!-- delivery_open_type 派送方式的物流信息展示是否开启(1为开启,0为关闭) <!-- delivery_open_type 派送方式的物流信息展示是否开启(1为开启,0为关闭)
detail.delivery_open_type === '1' || detail.raising_open_type === '1' 格利小程序
raising_open_type 自提方式判断是否开启(1为开启,0为关闭) --> 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="pb-2 font-28 flex j-start a-center">
<view class="name">物流:</view> <view class="name">物流:</view>
<view class="content flex-1 flex j-start a-center text-center"> <view class="content flex-1 flex j-start a-center text-center">
...@@ -71,6 +77,14 @@ ...@@ -71,6 +77,14 @@
</view> </view>
<view class="font-28" v-show="logistics_cur === 1"> <view class="font-28" v-show="logistics_cur === 1">
<view class="name">自提地址:</view> <view class="name">自提地址:</view>
<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>
</template>
<template v-else>
<scroll-view <scroll-view
class="w-100 address-scroll" class="w-100 address-scroll"
scroll-y scroll-y
...@@ -81,6 +95,7 @@ ...@@ -81,6 +95,7 @@
:key="index" :key="index"
>{{item.x_province + item.x_city + item.x_district + item.t_address_name}}</view> >{{item.x_province + item.x_city + item.x_district + item.t_address_name}}</view>
</scroll-view> </scroll-view>
</template>
</view> </view>
</view> </view>
...@@ -124,8 +139,8 @@ ...@@ -124,8 +139,8 @@
</view> </view>
</view> </view>
<view class="right font-28 text-center"> <view class="right font-28 text-center">
<view class="cart-btn" @click="handlePopup">加入购物车</view> <view class="cart-btn" @click.stop="handlePopup">加入购物车</view>
<view class="pay-btn" @click="handlePopup">立即购买</view> <view class="pay-btn" @click.stop="handlePopup">立即购买</view>
</view> </view>
</view> </view>
...@@ -136,13 +151,13 @@ ...@@ -136,13 +151,13 @@
<script> <script>
// import leftMenuButton from './components/left-menuButton.vue' // import leftMenuButton from './components/left-menuButton.vue'
import backBtn from './components/back-btn.vue'
import uParse from '@/components/parse/parse.vue' import uParse from '@/components/parse/parse.vue'
import price from '@/components/price/index.vue' import price from '@/components/price/index.vue'
import goodsPopup from '@/components/goods-popup/index.vue' import goodsPopup from '@/components/goods-popup/index.vue'
import { goodDetail, goodsSku, collectGoods } from '@/apis/goods.js' import { goodDetail, goodsSku, collectGoods } from '@/apis/goods.js'
import { baseUrl } from '@/config/index.js' import { baseUrl } from '@/config/index.js'
import { makePhoneCall } from '@/utils/common.js' import { makePhoneCall, throttle } from '@/utils/common.js'
import { mapState } from 'vuex' import { mapState } from 'vuex'
let goods_id = null let goods_id = null
export default { export default {
...@@ -163,7 +178,6 @@ export default { ...@@ -163,7 +178,6 @@ export default {
}, },
components: { components: {
// leftMenuButton, // leftMenuButton,
backBtn,
uParse, uParse,
price, price,
goodsPopup goodsPopup
...@@ -183,13 +197,20 @@ export default { ...@@ -183,13 +197,20 @@ export default {
const detail = this.detail const detail = this.detail
if(!detail) return [] if(!detail) return []
// + 将字符串0 和 1转为数字 // + 将字符串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: '买家自提'}] 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: '物流派送'}] return [{id: 0, title: '物流派送'}]
} else if (+detail.delivery_open_type && +detail.raising_open_type){ } else if (!delivery_open_type && raising_open_type){
this.logistics_cur = 1
return [{id: 1, title: '买家自提'}] return [{id: 1, title: '买家自提'}]
} else { } else {
console.log('EEE')
return [] return []
} }
}, },
...@@ -233,10 +254,10 @@ export default { ...@@ -233,10 +254,10 @@ export default {
try{ try{
const { status, data } = await goodsSku(goods_id) const { status, data } = await goodsSku(goods_id)
if(status) { if(status) {
this.skuData = data
if(!data) return if(!data) return
this.inventory = data.reduce((prev, cur) => { this.skuData = data
return prev + (+cur.adsale_inventory) this.inventory = data.reduce((pre, cur) => {
return pre + ~~cur.inventory
}, 0) }, 0)
} }
}catch(e){ }catch(e){
...@@ -271,7 +292,7 @@ export default { ...@@ -271,7 +292,7 @@ export default {
}, },
// sku弹窗 // sku弹窗
handlePopup() { handlePopup: throttle(function() {
const skuData = this.skuData const skuData = this.skuData
const detail = this.detail const detail = this.detail
if(!skuData & skuData.length) return this.$toast({title: '该商品暂无库存'}) if(!skuData & skuData.length) return this.$toast({title: '该商品暂无库存'})
...@@ -279,12 +300,13 @@ export default { ...@@ -279,12 +300,13 @@ export default {
goodsInfo: { goodsInfo: {
cover: `${this.baseUrl}/${detail.goods_thumb}`, cover: `${this.baseUrl}/${detail.goods_thumb}`,
title: detail.goods_name, title: detail.goods_name,
is_inquiry: detail.is_inquiry is_inquiry: detail.is_inquiry,
unit: skuData[0].unit
}, },
skuData: skuData skuData: skuData
} }
this.$refs.popup.show(params) this.$refs.popup.show(params)
}, }, 300),
// 呼叫老板 // 呼叫老板
callPhone() { callPhone() {
......
...@@ -17,10 +17,13 @@ ...@@ -17,10 +17,13 @@
<view class="goods-info flex flex-column j-between"> <view class="goods-info flex flex-column j-between">
<view class="title font-28 my-1">{{item.goods_name}}</view> <view class="title font-28 my-1">{{item.goods_name}}</view>
<view class="w-100 flex j-between a-center mt-1 mb-2"> <view class="w-100 flex j-between a-center mt-1 mb-2">
<view class="flex j-start a-center">
<price <price
:is_inquiry="item.is_inquiry" :is_inquiry="item.is_inquiry"
:price="item.shop_price" :price="item.shop_price"
/> />
<text class="primaryColor font-28">{{item.least_str}}</text>
</view>
<image <image
class="cart-btn" class="cart-btn"
@click.stop="handlePop(item)" @click.stop="handlePop(item)"
...@@ -67,7 +70,6 @@ export default { ...@@ -67,7 +70,6 @@ export default {
title: '加载中...', title: '加载中...',
mask: true mask: true
}) })
console.log(goods)
const { status, data } = await goodsSku(goods.goods_id) const { status, data } = await goodsSku(goods.goods_id)
if(status) { if(status) {
console.log(data) console.log(data)
...@@ -76,7 +78,8 @@ export default { ...@@ -76,7 +78,8 @@ export default {
goodsInfo: { goodsInfo: {
cover: `${this.baseUrl}/${goods.goods_thumb}`, cover: `${this.baseUrl}/${goods.goods_thumb}`,
title: goods.goods_name, title: goods.goods_name,
is_inquiry: goods.is_inquiry is_inquiry: goods.is_inquiry,
unit: goods.goods_unit
}, },
skuData: data skuData: data
} }
...@@ -98,7 +101,7 @@ export default { ...@@ -98,7 +101,7 @@ export default {
.list-item { .list-item {
box-sizing: border-box; box-sizing: border-box;
width: 330rpx; width: 330rpx;
height: 480rpx; height: 490rpx;
background-color: $white; background-color: $white;
border-radius: 8rpx; border-radius: 8rpx;
.goods_cover { .goods_cover {
...@@ -113,6 +116,7 @@ export default { ...@@ -113,6 +116,7 @@ export default {
.cart-btn { .cart-btn {
width: 34rpx; width: 34rpx;
height: 32rpx; height: 32rpx;
padding: 5rpx 20rpx;
} }
} }
} }
......
...@@ -13,8 +13,8 @@ const searchParams = { ...@@ -13,8 +13,8 @@ const searchParams = {
async function searchData () { async function searchData () {
try{ try{
const searchRes = await this.loadmore.getList(searchParams, searchGoods) const searchRes = await this.loadmore.getList(searchParams, searchGoods)
console.log(searchRes)
if(searchRes.status) { if(searchRes.status) {
if(!searchRes.data.length) return
this.$set(this.searchList, this.searchList.length, searchRes.data) this.$set(this.searchList, this.searchList.length, searchRes.data)
} }
}catch(e){ }catch(e){
...@@ -27,14 +27,31 @@ async function getHomeCate() { ...@@ -27,14 +27,31 @@ async function getHomeCate() {
const { status, data } = await homeCategory() const { status, data } = await homeCategory()
if(status) { if(status) {
this.cate_data = data this.cate_data = data
if(this.checkShowAll(data)) {
this.searchData()
}
} }
}catch(e){ }catch(e){
console.log(e) console.log(e)
//TODO handle the exception //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 { export default {
searchData, searchData,
getHomeCate getHomeCate,
checkShowAll
} }
\ No newline at end of file
...@@ -12,7 +12,7 @@ ...@@ -12,7 +12,7 @@
</view> </view>
<view class="introduct flex-1 ml-2"> <view class="introduct flex-1 ml-2">
<view class="shop-name mb-2">{{storeInfo.shop_name || ''}}</view> <view class="shop-name mb-2">{{storeInfo.shop_name || ''}}</view>
<view>{{appid || ""}}</view>
<view class="intro-deatil font-24">简介: {{storeInfo.shop_intro || ''}}</view> <view class="intro-deatil font-24">简介: {{storeInfo.shop_intro || ''}}</view>
</view> </view>
...@@ -66,21 +66,18 @@ ...@@ -66,21 +66,18 @@
</label> </label>
</view> </view>
<!-- search bar -->
<search-bar bg="#f8f8f8" innerBg="#fff" />
</view> </view>
<!-- content --> <!-- content -->
<template v-if="isOverdue"> <template v-if="isOverdue">
<view class="w-100 content-wrap flex flex-column j-center a-center" style="font-size: 20rpx;color: ##7F7F7F;"> <over-due />
<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>
</template> </template>
<template v-else> <template v-else>
<!-- search bar -->
<search-bar bg="#f8f8f8" innerBg="#fff" />
<view class="w-100 content-wrap"> <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 <empty-view
iconSrc="/static/images/common/noGoods.png" iconSrc="/static/images/common/noGoods.png"
text="店铺尚未上架商品" text="店铺尚未上架商品"
...@@ -97,7 +94,7 @@ ...@@ -97,7 +94,7 @@
<goods-module <goods-module
v-if="cate_data.cxlist.length > 0" v-if="cate_data.cxlist.length > 0"
title="促销商品" title="热销商品"
:list="cate_data.cxlist" :list="cate_data.cxlist"
@purchase="purchase" @purchase="purchase"
/> />
...@@ -113,7 +110,6 @@ ...@@ -113,7 +110,6 @@
<!-- 综合商品 --> <!-- 综合商品 -->
<template v-if="searchList.length > 0"> <template v-if="searchList.length > 0">
<view class="w-100"> <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"> <view class="list-wrap w-100 flex j-start a-center flex-wrap">
<block <block
v-for="(item, index) in searchList" v-for="(item, index) in searchList"
...@@ -169,6 +165,7 @@ import searchBar from '@/components/search-bar/index.vue' ...@@ -169,6 +165,7 @@ import searchBar from '@/components/search-bar/index.vue'
import goodsModule from './components/goods-module.vue' import goodsModule from './components/goods-module.vue'
import goodsPopup from '@/components/goods-popup/index.vue' import goodsPopup from '@/components/goods-popup/index.vue'
import price from '@/components/price/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 LoadMore from '@/utils/load-more.js'
import { checkLogin } from '@/utils/modules/login.js' import { checkLogin } from '@/utils/modules/login.js'
...@@ -192,15 +189,15 @@ export default { ...@@ -192,15 +189,15 @@ export default {
searchBar, searchBar,
goodsModule, goodsModule,
goodsPopup, goodsPopup,
price price,
overDue
}, },
computed: { computed: {
...mapState({ ...mapState({
isOverdue: state => state.user.isOverdue, isOverdue: state => state.user.isOverdue,
token: state => state.user.token, token: state => state.user.token,
storeInfo: state => state.user.storeInfo, storeInfo: state => state.user.storeInfo
appid: state => state.user.appid
}) })
}, },
...@@ -211,6 +208,8 @@ export default { ...@@ -211,6 +208,8 @@ export default {
}, },
onShow() { onShow() {
// 实时更新店铺信息
this.getStoreInfo()
if(this.token) { if(this.token) {
this.setCount() this.setCount()
} }
...@@ -231,6 +230,8 @@ export default { ...@@ -231,6 +230,8 @@ export default {
uni.showLoading({ uni.showLoading({
title: '加载中...' title: '加载中...'
}) })
this.getStoreInfo()
this.getHomeCate()
let timer = setTimeout(() => { let timer = setTimeout(() => {
clearTimeout(timer) clearTimeout(timer)
timer = null timer = null
...@@ -242,17 +243,22 @@ export default { ...@@ -242,17 +243,22 @@ export default {
// 上拉加载更多 // 上拉加载更多
onReachBottom() { onReachBottom() {
console.log('触底') console.log('触底')
const cate_data = this.cate_data
if(this.checkShowAll(cate_data)) {
console.log('pass')
this.searchData() this.searchData()
}
}, },
onShareAppMessage() { onShareAppMessage() {
return { return {
title: '分享title' title: this.storeInfo.shop_name
} }
}, },
methods: { methods: {
...mapActions('cart', ['setCount']), ...mapActions('cart', ['setCount']),
...mapActions('user', ['getStoreInfo']),
...indexModule, ...indexModule,
purchase(e) { purchase(e) {
...@@ -292,16 +298,15 @@ export default { ...@@ -292,16 +298,15 @@ export default {
}) })
const { status, data } = await goodsSku(goods.goods_id) const { status, data } = await goodsSku(goods.goods_id)
if(status) { if(status) {
console.log(data)
const params = { const params = {
goodsInfo: { goodsInfo: {
cover: `${this.baseUrl}/${goods.goods_thumb}`, cover: `${this.baseUrl}/${goods.goods_thumb}`,
title: goods.goods_name, title: goods.goods_name,
is_inquiry: goods.is_inquiry is_inquiry: goods.is_inquiry,
unit: goods.goods_unit
}, },
skuData: data skuData: data
} }
console.log(params)
this.$refs.popup.show(params) this.$refs.popup.show(params)
} }
uni.hideLoading() uni.hideLoading()
...@@ -352,9 +357,6 @@ export default { ...@@ -352,9 +357,6 @@ export default {
.content-wrap { .content-wrap {
margin-top: 10rpx; margin-top: 10rpx;
.em_word {
color: $primary;
}
.list-wrap { .list-wrap {
.list-item { .list-item {
......
...@@ -37,7 +37,7 @@ ...@@ -37,7 +37,7 @@
</view> </view>
<view class="clearfix"> <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>
<view <view
...@@ -52,7 +52,6 @@ ...@@ -52,7 +52,6 @@
>密码登录</view> >密码登录</view>
</view> </view>
<view class="agreement-wrap text-center"> <view class="agreement-wrap text-center">
<view class="wx-login_title mb-2">微信快捷登录</view> <view class="wx-login_title mb-2">微信快捷登录</view>
<label for="getPhone"> <label for="getPhone">
...@@ -88,11 +87,11 @@ import common from './common.js' ...@@ -88,11 +87,11 @@ import common from './common.js'
import { timerFn } from '@/utils/common.js' import { timerFn } from '@/utils/common.js'
import { loginSms } from '@/apis/user.js' import { loginSms } from '@/apis/user.js'
import { mapState, mapActions } from 'vuex' import { mapState, mapActions } from 'vuex'
import md5 from 'md5'
const userPlachelderStr = { const userPlachelderStr = {
1: '', 1: '',
2: '请输入手机号码', 2: '请输入手机号码',
3: '请输入用户名或手机号码' 3: '请输入用户名'
} }
export default { export default {
data() { data() {
...@@ -134,6 +133,7 @@ export default { ...@@ -134,6 +133,7 @@ export default {
case 3: case 3:
const accoutValidaErr = this.accoutValidate() const accoutValidaErr = this.accoutValidate()
if(accoutValidaErr) return this.$toast({title: accoutValidaErr}) if(accoutValidaErr) return this.$toast({title: accoutValidaErr})
this.loginCommon(this.form) this.loginCommon(this.form)
break; break;
default: default:
......
<template> <template>
<view class="w-100"> <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 --> <!-- userInfo -->
<view class="user-wrap flex j-start a-center w-100" @click="handleAvatar"> <view class="user-wrap flex j-start a-center w-100" @click="handleAvatar">
...@@ -10,7 +15,9 @@ ...@@ -10,7 +15,9 @@
class="avatar mr-2" class="avatar mr-2"
:src="baseUrl + '/' + userInfo.avatar" :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> <view v-if="userInfo.nickname">{{userInfo.nickname}}</view>
<open-data v-else type="userNickName" lang="zh_CN"></open-data> <open-data v-else type="userNickName" lang="zh_CN"></open-data>
...@@ -75,16 +82,25 @@ ...@@ -75,16 +82,25 @@
<!-- 功能与服务 --> <!-- 功能与服务 -->
<view class="server-wrap"> <view class="server-wrap">
<view class="title font-28 font-bold">功能与服务</view> <view class="title font-28 font-bold pt-3">功能与服务</view>
<view class="server-item font-28 flex j-between a-center py-2" @click="phoneCall"> <view
class="server-item font-28 flex j-between a-center py-3"
@click="phoneCall"
>
<text>联系老板</text> <text>联系老板</text>
<icon class="right_arrow" /> <icon class="right_arrow" />
</view> </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> <text>地址管理</text>
<icon class="right_arrow" /> <icon class="right_arrow" />
</view> </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> <text>店铺信息</text>
<icon class="right_arrow" /> <icon class="right_arrow" />
</view> </view>
...@@ -108,12 +124,12 @@ export default { ...@@ -108,12 +124,12 @@ export default {
...mapState({ ...mapState({
token: state => state.user.token, token: state => state.user.token,
userInfo: state => state.user.userInfo, userInfo: state => state.user.userInfo,
menuButtonInfo: state => state.systemInfo.menuButtonInfo // menuButtonInfo: state => state.systemInfo.menuButtonInfo
}), }),
navTitleSty() { // navTitleSty() {
const menuButtonInfo = this.menuButtonInfo // const menuButtonInfo = this.menuButtonInfo
return `height:${menuButtonInfo.height}px;line-height:${menuButtonInfo.height}px;top:${menuButtonInfo.top}px;` // return `height:${menuButtonInfo.height}px;line-height:${menuButtonInfo.height}px;top:${menuButtonInfo.top}px;`
} // }
}, },
onShow() { // 获取更新用户信息 onShow() { // 获取更新用户信息
if(this.token) { if(this.token) {
...@@ -169,16 +185,16 @@ export default { ...@@ -169,16 +185,16 @@ export default {
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>
.nav-title { // .nav-title {
position: fixed; // position: fixed;
left: 0; // left: 0;
right: 0; // right: 0;
z-index: 2; // z-index: 2;
text-align: center; // text-align: center;
color: #fff; // color: #fff;
font-weight: 500; // font-weight: 500;
font-size: 34rpx; // font-size: 34rpx;
} // }
.user-wrap { .user-wrap {
position: relative; position: relative;
@include borderBox(0, 30rpx); @include borderBox(0, 30rpx);
...@@ -189,6 +205,7 @@ export default { ...@@ -189,6 +205,7 @@ export default {
.avatar { .avatar {
width: 140rpx; width: 140rpx;
height: 140rpx; height: 140rpx;
overflow: hidden;
border-radius: 50%; border-radius: 50%;
} }
} }
...@@ -204,6 +221,8 @@ export default { ...@@ -204,6 +221,8 @@ export default {
} }
.order-wrap { .order-wrap {
position: relative;
z-index: 3;
@include borderBox(40rpx, 30rpx); @include borderBox(40rpx, 30rpx);
width: 690rpx; width: 690rpx;
height: 258rpx; height: 258rpx;
...@@ -241,7 +260,7 @@ export default { ...@@ -241,7 +260,7 @@ export default {
} }
.server-wrap { .server-wrap {
@include borderBox(20rpx, 20rpx); @include borderBox(0, 30rpx);
width: 690rpx; width: 690rpx;
margin: 20rpx auto 0; margin: 20rpx auto 0;
background-color: #fff; 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 @@ ...@@ -13,14 +13,23 @@
>卖家自提或找物流</view> >卖家自提或找物流</view>
</view> </view>
<view class="address"> <view class="address" v-show="current_tab === 1">
<navigator <view
v-if="orderDetail.address.length === 0" v-if="orderDetail.address.length === 0"
class="font-32 font-bold" class="font-32 font-bold"
hover-class="none" hover-class="none"
url="/subPages/address/index" url="/subPages/address/index"
>选择收获地址</navigator> >选择收获地址</view>
<view class="font-32 font-bold" v-else>1</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 class="tips mt-2 pt-2">卖家派送指卖家视同默认卖家提供的运输服务及因此可能产生的费用, 如 有疑问可点击<text class="primaryColor" @click="handleConcact">联系商家</text></view>
</view> </view>
...@@ -60,7 +69,7 @@ ...@@ -60,7 +69,7 @@
<view class="mb-2">单价:{{sku.cart_price + '/' + sku.unit}}</view> <view class="mb-2">单价:{{sku.cart_price + '/' + sku.unit}}</view>
<view class="flex j-between a-center"> <view class="flex j-between a-center">
<text>数量:{{sku.cart_number}}</text> <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>
</view> </view>
</block> </block>
...@@ -87,43 +96,90 @@ ...@@ -87,43 +96,90 @@
</view> </view>
<view class="py-2"> <view class="py-2">
<view class="pb-2">选择支付方式</view> <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>在线支付</view>
<view class="select"></view> <view :class="!form.goods_before_pay ? 'select' : 'unselect'"></view>
</view> </view>
<view class="pay-item"> <view class="pay-item" @click="handlePayWay(form.goods_before_pay)">
<view>先货后款</view> <view>先货后款</view>
<view class="unselect"></view> <view :class="form.goods_before_pay ? 'select' : 'unselect'"></view>
</view> </view>
</view> </view>
</view> </view>
<view class="w-100 flex j-end a-center confirm"> <view class="w-100 flex j-end a-center confirm">
<text class="font-24">不含运费</text> <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 class="confirm-btn mr-2" @click="handleConfirm">提交订单</view>
</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> </view>
</template> </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> <script>
import { preConfirmOrderData, confirmOrder } from '@/apis/order.js' 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 { baseUrl } from '@/config/index.js'
import Validator from '@/utils/validate.js'
let params = null
export default { export default {
data() { data() {
return { return {
baseUrl, baseUrl,
current_tab: 1, current_tab: 1,
orderDetail: {}, orderDetail: {},
select_address: {},
form: { form: {
from: 6, // 来源:6专属小程序 from: 6, // 来源:6专属小程序
buy_type: 0, //购买类型:0默认加入购物车 1立即购买 buy_type: 0, //购买类型:0默认加入购物车 1立即购买
goods_before_pay: 0, // 是否为先货后款:0否 1是 goods_before_pay: 0, // 是否为先货后款:0否 1是
sku_ids: '', // SKUIDs,多个则使用逗号分隔(buy_type=1时必填) sku_ids: '', // SKUIDs,多个则使用逗号分隔(buy_type=1时必填)
shipping_type: 1, // 配送类型1格利冷运2第三方(自提) shipping_type: 1, // 配送类型1格利冷运2第三方(自提)
address_id: '1707', // 收货地址ID(shipping_type=1时必填) address_id: '', // 收货地址ID(shipping_type=1时必填)
cart_ids: '', // 选中的购物车IDs,多个则使用逗号分隔(buy_type=0时必填) cart_ids: '', // 选中的购物车IDs,多个则使用逗号分隔(buy_type=0时必填)
postscript: '', // 订单附言,由用户提交订单前填写 postscript: '', // 订单附言,由用户提交订单前填写
cart_numbers: '' // 购买数量s,多个则使用逗号分隔(buy_type=1时必填) cart_numbers: '' // 购买数量s,多个则使用逗号分隔(buy_type=1时必填)
...@@ -132,9 +188,16 @@ export default { ...@@ -132,9 +188,16 @@ export default {
}, },
onLoad(options) { onLoad(options) {
const params = JSON.parse(decodeURIComponent(options.params)) params = JSON.parse(decodeURIComponent(options.params))
this.form = Object.assign(this.form, params) this.form = Object.assign(this.form, params)
},
onShow() {
if(params) {
this.getPreOrderData(params) this.getPreOrderData(params)
}
}, },
methods: { methods: {
...@@ -147,12 +210,18 @@ export default { ...@@ -147,12 +210,18 @@ export default {
handleConcact() { handleConcact() {
this.$checkLogin(makePhoneCall) this.$checkLogin(makePhoneCall)
}, },
// 获取提交订单前的数据 // 获取提交订单前的数据
async getPreOrderData(params) { async getPreOrderData(params) {
try{ try{
const { status, data } = await preConfirmOrderData(params) const { status, data } = await preConfirmOrderData(params)
if(status) { if(status) {
this.orderDetail = data 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 { } else {
uni.navigateBack() uni.navigateBack()
} }
...@@ -166,13 +235,73 @@ export default { ...@@ -166,13 +235,73 @@ export default {
async handleConfirm() { async handleConfirm() {
try{ try{
const form = this.form const form = this.form
console.log(form) const valiteErr = this.valiteForm()
if(form.shipping_type === 1 && !form.address_id) return this.$toast({title: '请选择收货地址'}) if(valiteErr) return this.$toast({title: valiteErr})
const { status, data } = await confirmOrder(form) 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){ }catch(e){
console.log(e)
this.$toast({title: e.msg || '程序错误,订单提交失败'}) this.$toast({title: e.msg || '程序错误,订单提交失败'})
//TODO handle the exception //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 { ...@@ -180,8 +309,9 @@ export default {
<style lang="scss" scoped> <style lang="scss" scoped>
.wrapper { .wrapper {
box-sizing: border-box;
padding-top: 110rpx; padding-top: 110rpx;
margin-bottom: 98rpx; padding-bottom: 118rpx;
.tab-wrap { .tab-wrap {
position: fixed; position: fixed;
left: 0; left: 0;
...@@ -230,6 +360,11 @@ export default { ...@@ -230,6 +360,11 @@ export default {
margin: 0 auto 20rpx; margin: 0 auto 20rpx;
border-radius: 8rpx; border-radius: 8rpx;
background-color: #fff; background-color: #fff;
.right-arrow {
flex: 0 0 16rpx;
margin-left: 10rpx;
@include right_arrow(16rpx, 34rpx);
}
.tips { .tips {
font-size: 20rpx; font-size: 20rpx;
color: $desc; color: $desc;
...@@ -240,6 +375,22 @@ export default { ...@@ -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 { .address-store {
@include borderBox(0, 20rpx); @include borderBox(0, 20rpx);
width: 690rpx; width: 690rpx;
......
<template> <template>
<view class="wrapper"> <view class="wrapper">
<view class="order-status w-100"> <view class="order-status w-100">
d {{order_detail.order.order_status | orderStatus}}
</view> </view>
<view class="goods w-100 mt-2"> <view class="goods w-100">
<block
v-for="(item, index) in order_detail.goods"
:key="index"
>
<view class="goods-item"> <view class="goods-item">
<view class="flex j-start a-center"> <view class="flex j-start a-center">
<image class="cover" src="/static/images/common/bg.png" mode="aspectFit"></image> <image
<view class="title flex-1">text</view> class="cover"
:src="baseUrl + '/' + item.goods_thumb"
mode="aspectFit"
/>
<view class="title flex-1">{{item.goods_name}}</view>
</view> </view>
<view class="mt-2">1</view> <block
<view class="mt-2">1</view> 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"> <view class="mt-2 flex j-between a-center">
<text>1</text> <text>数量:{{s.cart_number}}</text>
<text class="primary">小计:¥9999.99</text> <text class="primary">小计:¥{{s.amount}}</text>
</view> </view>
</block>
</view> </view>
</block>
</view> </view>
<view class="wrap mt-2 flex j-end a-center"> <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>
<view class="mt-2 box"> <view class="mt-2 box" v-if="order_detail.order.shipping_type === '1'">
<view>商家派送: 商家自行派送<text class="primary">联系商家</text></view> <view>商家派送: 商家自行派送<text class="primary ml-1" @click="makePhoneCall()">联系商家</text></view>
<view class="my-2">派送地址: 广东省广州市荔湾区那那那街这这这大厦多少 多少户</view> <view class="mt-2">派送地址: {{order_detail.order.address_json.address1 + order_detail.order.address_json.address2}}</view>
<view> <view class="mt-2">
<text class="mr-2">小格</text> <text class="mr-2">{{order_detail.order.address_json.consignee}}</text>
<text>188 1818 1888</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>
</view> </view>
...@@ -38,14 +65,14 @@ ...@@ -38,14 +65,14 @@
<view class="item w-100 flex j-start a-center"> <view class="item w-100 flex j-start a-center">
<view class="hd">订单编号:</view> <view class="hd">订单编号:</view>
<view class="flex-1 flex j-between a-center"> <view class="flex-1 flex j-between a-center">
<text>1</text> <text>{{order_detail.order.order_sn}}</text>
<text class="primary">2</text> <text class="primary" @click="copyOrderSn">复制</text>
</view> </view>
</view> </view>
<view class="item w-100 flex j-start a-center"> <view class="item w-100 flex j-start a-center">
<view class="hd">订单编号:</view> <view class="hd">创建时间:</view>
<view class="flex-1"> <view class="flex-1">
<text>1</text> <text>{{order_detail.order.add_time | parseTime}}</text>
</view> </view>
</view> </view>
</view> </view>
...@@ -58,6 +85,82 @@ ...@@ -58,6 +85,82 @@
</template> </template>
<script> <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> </script>
<style lang="scss" scoped> <style lang="scss" scoped>
...@@ -70,12 +173,15 @@ ...@@ -70,12 +173,15 @@
.goods { .goods {
background-color: #fff; background-color: #fff;
.goods-item {
@include borderBox(20rpx, 30rpx);
border-bottom: 1rpx solid $line; border-bottom: 1rpx solid $line;
&:first-child {
margin-top: 20rpx;
}
&:last-child { &:last-child {
border-bottom: none; border-bottom: none;
} }
.goods-item {
@include borderBox(20rpx, 30rpx);
.cover { .cover {
flex: 0 0 160rpx; flex: 0 0 160rpx;
width: 160rpx; width: 160rpx;
......
...@@ -4,7 +4,7 @@ ...@@ -4,7 +4,7 @@
<scroll-view class="tab-wrap w-100" scroll-x> <scroll-view class="tab-wrap w-100" scroll-x>
<view <view
class="tab-item mx-3" class="tab-item mx-3"
v-for="(item, index) in list" v-for="(item, index) in tab_list"
:key="index" :key="index"
:class="current_tab === index ? 'tab_active' : ''" :class="current_tab === index ? 'tab_active' : ''"
@click="handleTab(index)" @click="handleTab(index)"
...@@ -13,57 +13,90 @@ ...@@ -13,57 +13,90 @@
<view class="list-wrap"> <view class="list-wrap">
<pull-list <pull-list
ref="pullList"
refresherEnabled refresherEnabled
@refresh="refresh"
@tolower="tolower"
>
<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 list-item">
<view class="w-100 item-inner"> <view class="w-100 item-inner">
<view class="w-100 mb-2">
<view class="flex j-between a-center"> <view class="flex j-between a-center">
<text class="order-item">time</text> <text class="order-item">{{item.add_time | parseTime}}</text>
<text class="order-status">status</text> <text class="order-status">{{item.order_status | orderStatus(item.goods_before_pay)}}</text>
</view> </view>
<view class="flex j-start a-center"> <view
<image class="cover" src="/static/images/common/bg.png" mode="aspectFit"></image> 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="goods-info flex-1 flex j-between flex-column">
<view class="title">title</view> <view class="title">{{good.goods_name}}</view>
<view class="desc">12</view> <view class="desc">{{good.specification}}</view>
<view class="w-100 flex j-between a-center"> <view class="w-100 flex j-between a-center">
<text class="price">¥5555</text> <text class="price">¥{{good.goods_price}}</text>
<text class="desc">x1</text> <text class="desc">x{{good.cart_number}}</text>
</view> </view>
</view> </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>
<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>
</view>
</view>
</view> </view>
<view class="order-info"> <view class="order-info">
<view class="w-100 flex j-end a-center mb-2"> <view class="w-100 flex j-end a-center mb-2">
<text class="mr-2">共<text class="primary">3</text>件</text> <text class="mr-2">共<text class="primary">{{item.sum_counts}}</text>件</text>
<text class="primary">¥333</text> <text class="primary">¥{{item.sum_amount}}</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>
<!-- 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>
</navigator>
</template>
</pull-list> </pull-list>
</view> </view>
</view> </view>
...@@ -71,50 +104,165 @@ ...@@ -71,50 +104,165 @@
<script> <script>
import pullList from '@/components/pull-list/index.vue' 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 { export default {
data() { data() {
return { return {
test: false,
current_tab: 0, current_tab: 0,
list: [ baseUrl,
tab_list: [
{ {
status: 10,
name: '全部', name: '全部',
data: [] data: []
}, },
{ {
status: 0,
name: '待付款', name: '待付款',
data: [] data: []
}, },
{ {
status: 1,
name: '待收货', name: '待收货',
data: [] data: []
}, },
{ {
status: 3,
name: '已收货', name: '已收货',
data: [] data: []
}, },
{ {
status: 5,
name: '退货退款', name: '退货退款',
data: [] data: []
}, },
{ {
status: 4,
name: '交易关闭', name: '交易关闭',
data: [] data: []
} }
] ],
// times: {}, // 存放倒计时 通过key取
} }
}, },
components: { 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) { onLoad(options) {
console.log(options) console.log(options)
const { id } = options const { id } = options
this.current_tab = Number(id) || 0 this.current_tab = Number(id) || 0
}, },
onShow() {
this.init()
},
methods: { methods: {
handleTab(idx) { handleTab(idx) {
if(idx === this.current_tab) return if(idx === this.current_tab) return
this.current_tab = idx 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,15 +2,21 @@ ...@@ -2,15 +2,21 @@
<view class="w-100"> <view class="w-100">
<!-- searbar --> <!-- searbar -->
<view class="search-bar w-100 flex j-between a-center"> <view class="search-bar w-100 flex j-between a-center">
<view class="input-wrap flex j-between a-center flex-1">
<!-- @blur="handleSearch" -->
<input <input
class="input font-28" class="input font-28 flex-1"
type="text" type="text"
v-model="val" v-model="val"
placeholder="搜索商品" placeholder="搜索商品"
confirm-type="search" confirm-type="search"
@confirm="search" @confirm="search"
/> />
<view class="font-28" @click="search">搜索</view> <view
v-show="inputFocus"
class="cancleInput clear-btn"
@click="clearInput"
/>
<image <image
class="search-icon" class="search-icon"
src="/static/images/common/icon-search.png" src="/static/images/common/icon-search.png"
...@@ -18,6 +24,9 @@ ...@@ -18,6 +24,9 @@
/> />
</view> </view>
<view class="search-btn font-28" @click="search">搜索</view>
</view>
<!-- history --> <!-- history -->
<view class="history-wrap w-100"> <view class="history-wrap w-100">
<view class="font-32 flex j-between w-100 font-bold py-2"> <view class="font-32 flex j-between w-100 font-bold py-2">
...@@ -26,7 +35,7 @@ ...@@ -26,7 +35,7 @@
</view> </view>
<view class="w-100 flex j-start a-center flex-wrap"> <view class="w-100 flex j-start a-center flex-wrap">
<view <view
class="history-item font-28 mr-2" class="history-item font-28 mr-2 mb-2"
v-for="(item, index) in list" v-for="(item, index) in list"
:key="index" :key="index"
@click="handleHistory(item)" @click="handleHistory(item)"
...@@ -37,35 +46,54 @@ ...@@ -37,35 +46,54 @@
</template> </template>
<script> <script>
import { removeStorage } from '@/lib/storage/index.js'
import { throttle } from '@/utils/common.js'
let cacheHistory = []
export default { export default {
data() { data() {
return { return {
inputFocus: false,
val: '', val: '',
list: [] list: [], // 在页面显示的历史
} }
}, },
created() { onShow() {
this.list = this.$getStorage('search-history') || [] const localHisotry = this.$getStorage('search-history') || []
this.list = localHisotry
cacheHistory = localHisotry
// this.cancle = false
}, },
onUnload() { onHide() {
this.$setStorage('search-history', this.list)
this.$setStorage('search-history', cacheHistory)
this.cacheHistory = []
},
// onUnload() {
// this.$setStorage('search-history', this.list)
// },
watch: {
val: throttle(function(newVal) {
if(newVal.length > 0) {
this.inputFocus = true
}
}, 800)
}, },
methods: { methods: {
// 搜索 // 搜索
search() { search() {
const { val, list } = this const { val, list } = this
if(!val) return this.$toast({title: '请输入搜索内容'}) if(!val) return this.$toast({title: '请输入搜索内容'})
if(!list.includes(val)) { if(!cacheHistory.includes(val)) {
this.list.push(val) cacheHistory.push(val)
} }
uni.redirectTo({ uni.navigateTo({
url: `/pages/search/list?val=${val}` url: `/pages/search/list?val=${val}`
}) })
}, },
// 点击历史 // 点击历史
handleHistory(val) { handleHistory(val) {
uni.redirectTo({ uni.navigateTo({
url: `/pages/search/list?val=${val}` url: `/pages/search/list?val=${val}`
}) })
}, },
...@@ -73,23 +101,47 @@ export default { ...@@ -73,23 +101,47 @@ export default {
// 清除记录 // 清除记录
clearHistory() { clearHistory() {
this.list = [] this.list = []
cacheHistory = []
removeStorage('search-history')
},
clearInput() {
// this.cancle = true
this.val = ''
// this.timer = setTimeout(() => {
// this.cancle = false
// clearTimeout(this.timer)
// }, 300)
} }
} }
} }
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>
@import "./common/clear.css";
.search-bar { .search-bar {
position: relative; position: relative;
@include borderBox(20rpx, 40rpx); @include borderBox(20rpx, 40rpx);
margin: 0 auto; margin: 0 auto;
background-color: #fff; background-color: #fff;
.input-wrap {
width: 100%;
height: 88rpx;
border-radius: 8rpx;
overflow: hidden;
background-color: $mainBg;
.input { .input {
width: 534rpx; width: 534rpx;
height: 88rpx; height: 88rpx;
padding-left: 70rpx; padding-left: 70rpx;
background-color: $mainBg; background-color: $mainBg;
} }
.cancleInput {
position: relative;
flex: 0 0 50rpx;
width: 50rpx;
height: 88rpx;
}
.search-icon { .search-icon {
position: absolute; position: absolute;
left: 60rpx; left: 60rpx;
...@@ -98,6 +150,14 @@ export default { ...@@ -98,6 +150,14 @@ export default {
width: 34rpx; width: 34rpx;
height: 34rpx; height: 34rpx;
} }
}
.search-btn {
flex: 0 0 60rpx;
height: 88rpx;
line-height: 88rpx;
margin-left: 20rpx;
text-align: center;
}
} }
.history-wrap { .history-wrap {
......
<template> <template>
<view class="w-100"> <view class="w-100">
<!-- searchBar --> <!-- searchBar -->
<viwe class="search-bar w-100 flex j-center a-center"> <viwe class="search-bar w-100 flex j-between a-center">
<view class="input-wrap">
<input <input
class="input font-28 mr-2" class="input font-28 mr-2"
type="text" type="text"
v-model="val" v-model="searchParams.keywords"
placeholder="搜索商品" placeholder="搜索商品"
confirm-type="search" confirm-type="search"
@confirm="search" @confirm="search"
/> />
<image <image
class="search-icon ml-3" src="/static/images/common/icon-search.png" class="search-icon ml-2"
src="/static/images/common/icon-search.png"
mode="aspectFit" mode="aspectFit"
/> />
<view class="clearBtn clear-btn " @click.stop="clearInput" />
</view>
<image <image
class="nav-cart" class="nav-cart"
src="/static/images/common/icon-cart_gray.png" src="/static/images/common/icon-cart_gray.png"
...@@ -87,10 +91,13 @@ ...@@ -87,10 +91,13 @@
<text>销量:{{good.virtual_quantity_sold}}</text> <text>销量:{{good.virtual_quantity_sold}}</text>
</view> </view>
<view class="font-28 flex w-100 j-between a-center"> <view class="font-28 flex w-100 j-between a-center">
<view class="flex j-start a-center">
<price <price
:is_inquiry="good.is_inquiry" :is_inquiry="good.is_inquiry"
:price="good.shop_price" :price="good.shop_price"
/> />
<text class="primaryColor font-28">{{good.least_str}}</text>
</view>
<image <image
class="cart-icon" class="cart-icon"
@click.stop="handlePop(good)" @click.stop="handlePop(good)"
...@@ -142,9 +149,6 @@ export default { ...@@ -142,9 +149,6 @@ export default {
onLoad(options) { onLoad(options) {
this.loadmore = new LoadMore() this.loadmore = new LoadMore()
this.searchParams.keywords = options.val || '' this.searchParams.keywords = options.val || ''
uni.setNavigationBarTitle({
title: options.val
})
this.getData() this.getData()
}, },
...@@ -163,15 +167,36 @@ export default { ...@@ -163,15 +167,36 @@ export default {
this.getData() 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) { search() {
const value = e.detail.value const value = this.searchParams.keywords.trim()
if(!value) return this.$toast({title: '请输入搜索内容'})
this.searchParams.keywords = value
this.loadmore.resetParams() this.loadmore.resetParams()
this.searchList = [] this.searchList = []
uni.setNavigationBarTitle({
title: value
})
this.searchParams.keywords = value
this.getData() this.getData()
}, },
...@@ -214,16 +239,15 @@ export default { ...@@ -214,16 +239,15 @@ export default {
}) })
const { status, data } = await goodsSku(goods.goods_id) const { status, data } = await goodsSku(goods.goods_id)
if(status) { if(status) {
console.log(data)
const params = { const params = {
goodsInfo: { goodsInfo: {
cover: `${this.baseUrl}/${goods.goods_thumb}`, cover: `${this.baseUrl}/${goods.goods_thumb}`,
title: goods.goods_name, title: goods.goods_name,
is_inquiry: goods.is_inquiry is_inquiry: goods.is_inquiry,
unit: goods.goods_unit
}, },
skuData: data skuData: data
} }
console.log(params)
this.$refs.popup.show(params) this.$refs.popup.show(params)
} }
uni.hideLoading() uni.hideLoading()
...@@ -239,29 +263,52 @@ export default { ...@@ -239,29 +263,52 @@ export default {
<style lang="scss" scoped> <style lang="scss" scoped>
@import './common/iconfont.css'; @import './common/iconfont.css';
@import './common/clear.css';
.search-bar { .search-bar {
box-sizing: border-box;
padding: 0 20rpx;
position: relative; position: relative;
width: 100%; width: 100%;
height: 128rpx; height: 128rpx;
background-color: #fff; background-color: #fff;
.input-wrap {
box-sizing: border-box;
position: relative;
width: 654rpx;
height: 88rpx;
border-radius: 8rpx;
background-color: yellow;
.input { .input {
width: 534rpx; width: 500rpx;
padding-left: 70rpx; padding-left: 70rpx;
height: 88rpx; height: 88rpx;
background-color: $mainBg; background-color: $mainBg;
} }
.search-icon { .search-icon {
position: absolute; position: absolute;
left: 40rpx; left: 0;
top: 50%; top: 50%;
z-index: 1; z-index: 1;
width: 34rpx; width: 34rpx;
height: 34rpx; height: 34rpx;
transform: translateY(-50%); 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 { .nav-cart {
width: 34rpx; width: 40rpx;
height: 32rpx; height: 88rpx;
} }
} }
...@@ -289,15 +336,16 @@ export default { ...@@ -289,15 +336,16 @@ export default {
color: $primary!important; color: $primary!important;
} }
.sanjiao-wrap { .sanjiao-wrap {
width: 32rpx; width: 24rpx;
height: 22rpx; height: 18rpx;
color: #333;
line-height: 10rpx; line-height: 10rpx;
.sanjiao { .sanjiao {
display: inline-block; display: inline-block;
font-size: 12rpx!important; font-size: 10rpx!important;
color: #333; color: #333;
&:nth-child(1) { &:nth-child(1) {
margin-bottom: 8rpx; margin-bottom: 5rpx;
} }
} }
...@@ -327,6 +375,7 @@ export default { ...@@ -327,6 +375,7 @@ export default {
.cart-icon { .cart-icon {
width: 44rpx; width: 44rpx;
height: 42rpx; height: 42rpx;
padding: 5rpx 20rpx;
} }
} }
} }
......
...@@ -26,14 +26,16 @@ ...@@ -26,14 +26,16 @@
- 仅次于小程序原生弹窗 zIndex 100 - 仅次于小程序原生弹窗 zIndex 100
#### warning #### warning
+ 2021/6/29,本日起的代码可能会引起不适,但我和代码都能跑(效率和质量不会成正比关系) + 2021/6/29,本日起的代码可能会引起不适,but all can run(效率和质量不会成正比关系)
#### 未完成 #### 未完成
+ 搜索列表
+ 下单 + 下单
+ 支付 + 支付
+ 订单管理 + 订单管理
+ 订单详情 + 订单详情
+ 服务过期处理
+ 购物车 + 购物车
+ sku阶梯价未处理 + 弹窗异步问题
+ 精度处理
#### unFinish, but not important
+ 自定义的导航栏的样式计算可以在vuex中处理(wxs计算)
...@@ -14,7 +14,7 @@ const actions = { ...@@ -14,7 +14,7 @@ const actions = {
setCount: async ({ commit }) => { setCount: async ({ commit }) => {
const { status, data } = await cartCount() const { status, data } = await cartCount()
const count = data.count const count = data.count
if(status && count > 0) { if(status) {
commit('SETCOUNT', count) commit('SETCOUNT', count)
const pages = getCurrentPages() const pages = getCurrentPages()
const curPage = whitePage.find(item => item === pages[pages.length - 1].__route__) 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 store from '@/store/index.js'
import { login, logout, getUserInfo } from '@/apis/user.js' import { login, logout, getUserInfo } from '@/apis/user.js'
import { getStoreInfo } from '@/apis/common.js' import { getStoreInfo } from '@/apis/common.js'
import Toast from '@/lib/toast/index.js' import Toast from '@/lib/toast/index.js'
import { login_wx } from '@/utils/modules/login.js'
const state = { const state = {
token: null, token: null,
openid: null, openid: null,
...@@ -70,7 +72,7 @@ const actions = { ...@@ -70,7 +72,7 @@ const actions = {
try{ try{
const { status, data } = await login(form) const { status, data } = await login(form)
if(status) { if(status) {
setStorageAsync('token', data.token) await setStorage('token', data.token)
// 这里返回了用户名,但后面会有个接口单独返回,所以这里不操作useInfo // 这里返回了用户名,但后面会有个接口单独返回,所以这里不操作useInfo
commit('LOGIN', data.token) commit('LOGIN', data.token)
Toast({ Toast({
...@@ -79,7 +81,10 @@ const actions = { ...@@ -79,7 +81,10 @@ const actions = {
}) })
} }
}catch(e){ }catch(e){
console.log(e)
login_wx()
Toast({title: e.msg || '登录失败'}) Toast({title: e.msg || '登录失败'})
} }
}, },
......
...@@ -5,7 +5,7 @@ page { ...@@ -5,7 +5,7 @@ page {
} }
/* 去除image的间距 */ /* 去除image的间距 */
image { image {
display: block; /* display: block; */
} }
.wrapper { .wrapper {
width: 100%; width: 100%;
......
...@@ -23,7 +23,7 @@ ...@@ -23,7 +23,7 @@
<script> <script>
import { queryCity } from '@/apis/common.js' import { queryCity } from '@/apis/common.js'
const cacheList = [null, null, null, null] // 分别为四级区域,其中第一级是不会变得 const cacheList = [null, null, null, null] // 分别为四级区域,其中第一级是不会变得
const cityCode = { // 四级联动的城市的code,第一级默认是1 let cityCode = { // 四级联动的城市的code,第一级默认是1
"1": 1, "1": 1,
"2": 0, "2": 0,
"3": 0, "3": 0,
...@@ -57,9 +57,20 @@ export default { ...@@ -57,9 +57,20 @@ export default {
"3": form.district || '', "3": form.district || '',
"4": form.street || '' "4": form.street || ''
} }
console.log(cacheList)
this.getDefault() this.getDefault()
}, },
beforeDestroy() {
cityCode = { // 四级联动的城市的code,第一级默认是1
"1": 1,
"2": 0,
"3": 0,
"4": 0
}
},
methods: { methods: {
async getDefault() { async getDefault() {
try{ try{
......
...@@ -73,8 +73,8 @@ ...@@ -73,8 +73,8 @@
</view> </view>
<view class="w-100 btn-wrap flex j-around a-center"> <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 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 normal w-100" @click="handleAdd">保存</view>
</view> </view>
</view> </view>
</template> </template>
...@@ -172,7 +172,7 @@ export default { ...@@ -172,7 +172,7 @@ export default {
.info-wrap { .info-wrap {
background-color: #fff; background-color: #fff;
.item { .item {
@include borderBox(20rpx, 30rpx); @include borderBox(30rpx, 30rpx);
width: 100%; width: 100%;
display: flex; display: flex;
justify-content: space-between; justify-content: space-between;
......
...@@ -11,14 +11,16 @@ ...@@ -11,14 +11,16 @@
@click="handleDetail(address)" @click="handleDetail(address)"
> >
<view class="flex-1"> <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 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>
<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>
<view class="right-arrow" /> <view class="right-arrow" />
<!-- <button type="default" @click="handleDel(address.address_id, index, inneridx)">删除地址</button> -->
</view> </view>
</block> </block>
...@@ -62,43 +64,26 @@ export default { ...@@ -62,43 +64,26 @@ export default {
// 上拉加载更多 // 上拉加载更多
onReachBottom() { onReachBottom() {
console.log('触底') console.log('触底')
this.getAddressList()
}, },
methods: { methods: {
init() { init() {
// 初始化 // 初始化s
this.list = [] this.list = []
this.loadmore.resetParams() this.loadmore.resetParams()
uni.showLoading({title: '加载中...'}) this.getAddressList()
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 || '程序错误'})
}
}, },
// 获取地址列表 // 获取地址列表
async getAddressList() { async getAddressList() {
try{ 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){ }catch(e){
this.$toast({title: e.msg || '程序错误'}) this.$toast({title: e.msg || '程序错误, 获取地址失败'})
} }
}, },
...@@ -124,10 +109,6 @@ export default { ...@@ -124,10 +109,6 @@ export default {
uni.navigateTo({ uni.navigateTo({
url: `/subPages/address/edit?params=${params}` url: `/subPages/address/edit?params=${params}`
}) })
},
confirmCity(e) {
console.log(e)
} }
} }
} }
...@@ -144,6 +125,17 @@ export default { ...@@ -144,6 +125,17 @@ export default {
margin-left: 10rpx; margin-left: 10rpx;
@include right_arrow(16rpx, 34rpx); @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 { .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' ...@@ -5,7 +5,7 @@ import { historyList } from '@/apis/common.js'
async function getCollectData() { async function getCollectData() {
try{ try{
const { status, data } = await this.collectList.getList({}, collectGoodsList) 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) this.$set(this.collect_list, this.collect_list.length, data)
} }
}catch(e){ }catch(e){
......
...@@ -106,7 +106,7 @@ ...@@ -106,7 +106,7 @@
<view <view
class="btn" class="btn"
@click.stop="clearHistory(good, index, goodIdx)" @click.stop="clearHistory(good, index, goodIdx)"
>删除历史</view> >删除</view>
</view> </view>
<view class="desc">规格:{{good.specification}}</view> <view class="desc">规格:{{good.specification}}</view>
<view class="desc">总销量:{{good.virtual_quantity_sold}}</view> <view class="desc">总销量:{{good.virtual_quantity_sold}}</view>
...@@ -234,22 +234,27 @@ export default { ...@@ -234,22 +234,27 @@ export default {
}, },
// 删除单条历史 // 删除单条历史
clearHistory(good, wrapIdx, innerIdx) { async clearHistory(good, wrapIdx, innerIdx) {
try{ 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}) const { status, data } = await delHistory({bro_id: good.bro_id, goods_id: good.goods_id})
if(status) { if(status) {
this.history_list[wrapIdx].date_list.splice(innerIdx, 1) this.history_list[wrapIdx].date_list.splice(innerIdx, 1)
this.$toast({title: '删除成功'}) 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){ }catch(e){
console.log(e) console.log(e)
this.$toast({title: '删除失败'}) this.$toast({title: '删除失败'})
...@@ -315,7 +320,7 @@ export default { ...@@ -315,7 +320,7 @@ export default {
.list-wrap { .list-wrap {
box-sizing: border-box; box-sizing: border-box;
padding: 40rpx 0 0 0; padding: 40rpx 0;
width: 690rpx; width: 690rpx;
height: calc(100vh - 98rpx); height: calc(100vh - 98rpx);
margin: 0 auto; margin: 0 auto;
...@@ -370,8 +375,9 @@ export default { ...@@ -370,8 +375,9 @@ export default {
@include text-ellipsis(1); @include text-ellipsis(1);
} }
.btn { .btn {
text-align: right;
color: $desc; color: $desc;
flex: 0 0 120rpx; flex: 0 0 160rpx;
} }
} }
} }
......
<template>
<view class="wrapper flex flex-column j-start a-center">
<view
class="bg"
:class="pay_success ? 'success' : 'fail'"
/>
<text
class="text-center font-36"
:class="pay_success ? 'primaryColor' : 'descColor'"
>{{pay_success ? '支付成功' : '支付失败'}}</text>
<view class="nav-btn primaryColor">查看订单详情</view>
</view>
</template>
<script>
export default {
data() {
return {
pay_success: true,// 支付成功状态
order_id: null
}
}
}
</script>
<style lang="scss" scoped>
.wrapper {
background-color: #fff;
.bg {
width: 180rpx;
height: 180rpx;
margin: 88rpx auto 40rpx;
background-position: 0 0;
background-size: 100% 100%;
background-repeat: no-repeat;
}
.success {
background-image: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAWgAAAFoCAMAAABNO5HnAAAAk1BMVEUAAAD/ZiX/Zhv/Zxv/Zxr/Zhr/aR7/aB7/cyP/Zhr/Zhv/Zxr/cij/Zxv/Zhr/Zxr/aBz/Zhr/Zxr/Zhr/bhv/Zhv/Zxr/Zxv/Zxv/Zxr/Zxv/Zxz/ezz/Zxv/Zhr/Zxv/Zxv/ah3/Zxr/Zhr/Zxv/Zx3/Zxv/Zxr/aR3/Zhr/Zxr/Zxr/Zxz/Zhv/aBv/Zxv/ZhoCtou1AAAAMHRSTlMAFNKG+9YQIQjNjucMjeqtNN70wBLu415sm3E7BKjIQ3opTKN3MNCSGblWf0mDT2WeTK5uAAANSklEQVR42uzcV5LiMBAG4GZLtgzONjgRTM4wff/T7VbNAzBjFoOT0ncElar9d7cAmGdR7xxnl9QNZ1vNj5xRQEgwciJf285CN71k8dmjFiifshbLxHb7Iyxl1HftZLlQB/4OYxPbBxM/Yh7seGOA8oJ+nk81ghURbTo/66AUo3GqYY20NKagPNpkrokNMN1sA8o3/Zia2CAzPaoyApt5SLBxJJxLfbHHOxNbY+7GIKXxIMKWRQPpztqzI+xEZHsgjWGmYYe0bAgyyKcEO0amOQhuv/aRCf56D+Lyur/MN2QqarVehsiYcAnCMb40ZJD2Jdakb3hykFHOSZwMYp0CZF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mccbs5tI4CXdPjQJ5i58hbVC/tXKIi7LPA1s2zVMXFT43LpHAwcX5qr6L30bPxxV4atqXbqXq4SoaD74Zr3u4ktlDX2m3iz9GGLx6Bdkursh72DdiroGr8h90lVdv4MrCh9y5BB6uzj7gbnwU4nTPCtPZBhane1ZNz9bEzbQe6JuLeccNvT3Md8RhAdegf/jswpId3Jj3EAvqegM3Zx9g8THyoYGamcoLMS0o0bnrrt5cCWp4d9ypXvagiL3XZlNTgTL3uaLOFKBO7Q7nEYMuFLLNe9uQpy106tzVd5dsG2rZ8d3c1CbtQLPSnXy2dRUtng9z0ndwU5txCP3a9PvE6hwU/AH1TW0qWhcb+2bEW/LeDExSpM+P5ITndl4Jm7pSj06SGOte0x3WfSV7VJupyh33CeZU5Y9/7d3pboMwDADgBUjTEA5xH9U4Owqt8Ps/3rYf07R1m7qWgEP7PYIVxZZtycHiY8EbnJSZ3UYI+3T/oedKhNpyVcuB544d+gLEzFTMgec0F3UDROTrCPM7rUd2m/lT1Kv/aXzBUF3f/RAongJ/5GDbaSK1ygXdXwZuAhotR7DmJc2xR/KsjQrVuoYMMV/8DBCtEY8DJ6T1ASyo6HCsLM4ifjFgEUaoVrt5AkMYwcwsrsiMamppXhKYi8HRD7Zl2ro2BemIX8VPd09nBwMkEmO/+lLuYlvGCwLT2+y7x1P+TnfCksJkSDKeHkH+jeZVdURvj3FdOXdULF8tdaqDb8IViAiazltPf3kWz7uusX3RwiXMyB4zNqiwMoeWnnrMzZp9WSTCMil5QyltNyIpSrvmmct2Mf43/ApexhnJcxWc3wAAAABJRU5ErkJggg==);
}
.nav-btn {
display: inline-block;
margin: 77rpx auto 0;
padding: 16rpx 56rpx;
border-radius: 8rpx;
border: 1rpx solid $primary;
}
}
</style>
...@@ -28,33 +28,59 @@ ...@@ -28,33 +28,59 @@
>{{smsMsg}}</view> >{{smsMsg}}</view>
</view> </view>
<view class="item mb-4"> <view class="item flex j-between a-center mb-4">
<input <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" type="password"
placeholder="请输入新密码" placeholder="请输入新密码"
v-model="form.upwd" 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>
<view class="item mb-2"> <!-- 动态改变input的type在真机上会无法切换 -->
<view class="item flex j-between a-center mb-2">
<input <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" type="password"
placeholder="再次输入密码" placeholder="再次输入密码"
v-model="form.upwd2" 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>
<view class="tips">密码由6-12位英文字母或数字组成</view> <view class="tips">密码由6-12位英文字母或数字组成</view>
</view> </view>
<view class="submit font-bold font-32 text-center" @click="handleReset">提交</view> <view class="submit font-bold font-32 text-center" @click="handleReset">提交</view>
</view> </view>
</template> </template>
0
<script> <script>
import { mapState } from 'vuex' import { mapState } from 'vuex'
...@@ -67,6 +93,8 @@ export default { ...@@ -67,6 +93,8 @@ export default {
return { return {
smsMsg: '获取验证码', smsMsg: '获取验证码',
smsDisabled: false, smsDisabled: false,
first: false,
second: false,
form: { form: {
phone: '', phone: '',
f_code: '', f_code: '',
...@@ -75,7 +103,11 @@ export default { ...@@ -75,7 +103,11 @@ export default {
} }
} }
}, },
computed: {
...mapState({
storeInfo: state => state.user.storeInfo
})
},
methods: { methods: {
...common, ...common,
...@@ -106,16 +138,24 @@ export default { ...@@ -106,16 +138,24 @@ export default {
async handleReset() { async handleReset() {
try{ try{
const validateErr = this.validateForm() const validateErr = this.validateForm()
console.log(validateErr)
if(validateErr) return this.$toast({title: validateErr}) if(validateErr) return this.$toast({title: validateErr})
const { status, msg } = await forgetPwd(this.form) const { status, msg } = await forgetPwd(this.form)
console.log(status, msg) if(status) {
this.$toast({title: msg})
}
if(status) { if(status) {
this.$toast({title: msg, cb: () => {uni.navigateBack()}}) this.$toast({title: msg, cb: () => {uni.navigateBack()}})
} }
}catch(e){ }catch(e){
console.log(e)
this.$toast({title: e.msg || '程序错误'}) this.$toast({title: e.msg || '程序错误'})
} }
},
handleShowPsd(key, status) {
uni.hideKeyboard()
this[key] = !status
// this.$set(this.showPsd, key, )
} }
} }
} }
...@@ -141,7 +181,7 @@ export default { ...@@ -141,7 +181,7 @@ export default {
height: 88rpx; height: 88rpx;
border-radius: 8rpx; border-radius: 8rpx;
background-color: #f7f7f7; background-color: #f7f7f7;
.sms-btn, .psd-visibility { .sms-btn {
position: absolute; position: absolute;
right: 20rpx; right: 20rpx;
top: 50%; top: 50%;
...@@ -151,9 +191,53 @@ export default { ...@@ -151,9 +191,53 @@ export default {
transform: translateY(-50%); transform: translateY(-50%);
color: $primary; color: $primary;
} }
.psd-visibility {
flex: 0 0 68rpx;
height: 88rpx;
line-height: 88rpx;
color: $primary;
}
.disabledSmsBtn { .disabledSmsBtn {
color: $desc; 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,iVBORw0KGgoAAAANSUhEUgAAAEQAAAAsCAMAAAD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glbhvkpSTBC81kaDEIbGWS8EJXVU38PqR8AMPul2NQdhqySyK9mCYLM6ot4H5v/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 { .tips {
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
<view class="wrap"> <view class="wrap">
<view class="store-info my-2 flex j-star a-center" v-if="storeInfo"> <view class="store-info my-2 flex j-star a-center" v-if="storeInfo">
<image <image
class="logo" class="logo mr-2"
:src="baseUrl + '/' + storeInfo.shop_img" :src="baseUrl + '/' + storeInfo.shop_img"
mode="aspectFit" mode="aspectFit"
/> />
...@@ -14,31 +14,31 @@ ...@@ -14,31 +14,31 @@
<view class="store-introduct"> <view class="store-introduct">
<view class="font-28 font-bold">基本信息</view> <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="hd">公司名称</text>
<text class="flex-1">{{storeInfo.shop_name}}</text> <text class="flex-1">{{storeInfo.shop_name}}</text>
</view> </view>
<view class="store-item py-2 font-28"> <view class="store-item py-3 font-28">
<text class="hd">所在地</text> <text class="hd">所在地</text>
<text class="flex-1">{{storeInfo.ap + storeInfo.ac + storeInfo.ad }}</text> <text class="flex-1">{{storeInfo.ap + storeInfo.ac + storeInfo.ad }}</text>
</view> </view>
<view class="store-item py-2 font-28"> <view class="store-item py-3 font-28">
<text class="hd">详细地址</text> <text class="hd">详细地址</text>
<text class="flex-1">{{storeInfo.address}}</text> <text class="flex-1">{{storeInfo.address}}</text>
</view> </view>
<view class="store-item py-2 font-28"> <view class="store-item py-3 font-28">
<text class="hd">联系电话</text> <text class="hd">联系电话</text>
<text class="flex-1 theme">{{storeInfo.shop_tel}}</text> <text class="flex-1 theme">{{storeInfo.shop_tel}}</text>
</view> </view>
<view class="store-item py-2 font-28"> <view class="store-item py-3 font-28">
<text class="hd">营业时间</text> <text class="hd">营业时间</text>
<text class="flex-1">{{startT + '至' + endT}}</text> <text class="flex-1">{{startT + '至' + endT}}</text>
</view> </view>
<view class="store-item py-2 font-28"> <view class="store-item py-3 font-28">
<text class="hd">自提时间</text> <text class="hd">自提时间</text>
<text class="flex-1">{{storeInfo.pickup_hours}}</text> <text class="flex-1">{{storeInfo.pickup_hours}}</text>
</view> </view>
<view class="store-item py-2 font-28"> <view class="store-item pt-3 font-28">
<text class="hd">创建时间</text> <text class="hd">创建时间</text>
<text class="flex-1">{{createTime}}</text> <text class="flex-1">{{createTime}}</text>
</view> </view>
...@@ -105,7 +105,7 @@ export default { ...@@ -105,7 +105,7 @@ export default {
} }
.store-introduct { .store-introduct {
@include borderBox(20rpx, 20rpx); @include borderBox(30rpx, 30rpx);
width: 690rpx; width: 690rpx;
margin: 0 auto; margin: 0 auto;
background-color: #fff; background-color: #fff;
......
...@@ -15,7 +15,9 @@ ...@@ -15,7 +15,9 @@
/> />
</template> </template>
<template v-else> <template v-else>
<open-data class="avatar-img" type="userAvatarUrl"></open-data> <view class="avatar-img">
<open-data type="userAvatarUrl"></open-data>
</view>
</template> </template>
</view> </view>
</view> </view>
...@@ -29,6 +31,7 @@ ...@@ -29,6 +31,7 @@
:value="userInfo.nickname" :value="userInfo.nickname"
confirm-type="done" confirm-type="done"
@confirm="changeNickname" @confirm="changeNickname"
@blur="changeNickname"
/> />
</template> </template>
<template v-else> <template v-else>
...@@ -40,7 +43,12 @@ ...@@ -40,7 +43,12 @@
<view class="item w-100 flex j-between a-center"> <view class="item w-100 flex j-between a-center">
<view>手机号</view> <view>手机号</view>
<view class="nickname text-right"> <view class="nickname text-right">
{{userInfo.phone}} <!-- {{userInfo.phone}} -->
<input
type="text"
:value="userInfo.phone"
disabled
/>
</view> </view>
</view> </view>
</view> </view>
...@@ -127,7 +135,9 @@ export default { ...@@ -127,7 +135,9 @@ export default {
async changeNickname(e) { async changeNickname(e) {
try{ 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) { if(status) {
this.setUserInfo() this.setUserInfo()
this.$toast({title: '修改成功'}) this.$toast({title: '修改成功'})
...@@ -149,13 +159,14 @@ export default { ...@@ -149,13 +159,14 @@ export default {
<style lang="scss" scoped> <style lang="scss" scoped>
.wrapper { .wrapper {
margin-bottom: 98rpx; box-sizing: border-box;
padding-bottom: 98rpx;
padding-top: 57rpx; padding-top: 57rpx;
color: #000; color: #000;
.userInfo { .userInfo {
.item { .item {
@include borderBox(20rpx, 30rpx); @include borderBox(30rpx, 30rpx);
background-color: #FFFFFF; background-color: #FFFFFF;
border-bottom: 1rpx solid $line; border-bottom: 1rpx solid $line;
&:last-child { &:last-child {
...@@ -168,6 +179,8 @@ export default { ...@@ -168,6 +179,8 @@ export default {
.avatar-img { .avatar-img {
width: 100%; width: 100%;
height: 100%; height: 100%;
border-radius: 8rpx;
overflow: hidden;
} }
} }
} }
......
...@@ -15,7 +15,7 @@ export default { ...@@ -15,7 +15,7 @@ export default {
if(!url) return this.$toast({title: '缺少地址', cb: () => { if(!url) return this.$toast({title: '缺少地址', cb: () => {
uni.navigateBack() uni.navigateBack()
}}) }})
this.webUrl = `${baseUrl}/{url}` this.webUrl = `${baseUrl}/${url}`
}, },
methods: { methods: {
webViewLoadErr() { webViewLoadErr() {
......
...@@ -52,9 +52,7 @@ export function throttle(callback, wait = 3000) { ...@@ -52,9 +52,7 @@ export function throttle(callback, wait = 3000) {
*/ */
export function debounce(func, wait = 1000, immediate = true) { export function debounce(func, wait = 1000, immediate = true) {
let timeout let timeout
console.log(func, wait)
return function(...args) { return function(...args) {
console.log(args)
let context = this let context = this
if (timeout) clearTimeout(timeout) if (timeout) clearTimeout(timeout)
...@@ -95,16 +93,41 @@ export function makePhoneCall() { ...@@ -95,16 +93,41 @@ export function makePhoneCall() {
/** /**
* @微信支付 * @微信支付
* @param { Functiom } cb 回调函数 * @param { Functiom } successCb 成功回调函数
*/ * @param { Functiom } failCb 失败回调函数
export function wxPay(cb) { * @param { Object } params 支付参数
uni.requestPayment({ *
timeStamp: '', timeStamp: '',
nonceStr: '', nonceStr: '',
package: '', package: '',
signType: 'MD5', signType: 'RSA',
paySign: '', 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 { ...@@ -31,7 +31,8 @@ class LoadMore {
this.total = count this.total = count
this.totalPage = pages this.totalPage = pages
this.flat = false this.flat = false
return { status: true, data: data.list, msg: '成功' } // time是订单用的
return { status: true, data: data.list, time: data.time || 0, msg: '成功' }
} catch (e) { } catch (e) {
console.log(e) console.log(e)
return Toast({title: '获取列表失败'}) return Toast({title: '获取列表失败'})
......
import Vue from "vue" import Vue from "vue"
import { getStorage, setStorage } from "@/lib/storage/index.js" import { getStorage, setStorage } from "@/lib/storage/index.js"
import Toast from "@/lib/toast/index.js" import Toast from "@/lib/toast/index.js"
import Modal from '@/lib/modal/index.js'
import { checkLogin } from '@/utils/modules/login.js' import { checkLogin } from '@/utils/modules/login.js'
import dayjs from 'dayjs'
Vue.prototype.$getStorage = getStorage Vue.prototype.$getStorage = getStorage
Vue.prototype.$setStorage = setStorage Vue.prototype.$setStorage = setStorage
Vue.prototype.$toast = Toast Vue.prototype.$toast = Toast
Vue.prototype.$modal = Modal
Vue.prototype.$checkLogin = checkLogin 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