From 7c039b6f9a93bf342cb7baaf37f6dbd6609f8f21 Mon Sep 17 00:00:00 2001 From: mullins <476823686@qq.com> Date: Thu, 18 Jun 2020 12:06:26 +0800 Subject: [PATCH] =?UTF-8?q?=E8=AE=A2=E5=8D=95=E8=AF=A6=E6=83=85=E9=A1=B5?= =?UTF-8?q?=E8=A7=84=E6=A0=BC=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/pages/myOrderPaying/myOrderPaying.vue | 75 ++++++++++++++++++++----------- src/pages/user/user.vue | 27 ++++++++--- src/store/modules/orderRead.js | 47 ++++++++++++++----- 3 files changed, 107 insertions(+), 42 deletions(-) diff --git a/src/pages/myOrderPaying/myOrderPaying.vue b/src/pages/myOrderPaying/myOrderPaying.vue index 407390d..d873f1a 100644 --- a/src/pages/myOrderPaying/myOrderPaying.vue +++ b/src/pages/myOrderPaying/myOrderPaying.vue @@ -60,7 +60,7 @@ <view class="order-info"> <view class="order-info-head" - v-for="(orderInfoListItem,index) in orderInfoList" + v-for="(orderInfoListItem, index) in orderInfoList" :key="index" > <image @@ -73,11 +73,13 @@ class="p2" style="margin: 0;" > - 规格:玫瑰金 / 钛合金 / 防日光防紫外线 / 超薄超轻 + <!-- {{index}} --> + {{skuList[index] ? skuList[0].sku_name.replace('_', '/') : ''}} + <!-- {{skuList.length === 0 ? '' : skuList[0].sku_name.replace('_', '/')}} --> <!-- <view class="arrow"></view> --> </view> <view class="infoText-bottom"> - <view class="markPrice">{{Number(orderInfoListItem.nowPrice)/100}}</view> + <view class="markPrice">¥{{Number(orderInfoListItem.nowPrice)/100}}</view> <view class="buy-num">X {{orderInfoListItem.num}}</view> </view> </view> @@ -181,6 +183,13 @@ export default { uid: uid, openid: openid, }) + const { list } = this.orderInfo.order_info + for (let index = 0; index < list.length; index++) { + await store.dispatch('orderRead/goodDetails', { + pid: list[index].pid, + skId: list[index].sk_id, + }) + } this.totalPrice = this.orderInfo.total_fee }, // 若从支付页面跳转过来,返回直接返回到首页 @@ -193,6 +202,10 @@ export default { } }, computed: { + // 规格列表 + skuList () { + return this.$store.state.orderRead.skuList + }, orderInfo() { return this.$store.state.orderRead.orderInfo }, @@ -235,28 +248,29 @@ export default { this.cancleOrder() }, cancleOrder() { - const uid = this.uid - const openid = this.openid - const keyname = this.orderInfo.order_info.keyname - // console.log('keyname',this.orderInfo.keyname) - uni.showModal({ - title: '提示', - content: '现在取消,订单不可恢复哦,确认取消吗?', - success: function(res) { - if (res.confirm) { - store.dispatch('cancelOrder/cancel', { - keyname: keyname, - uid: uid, - openid: openid, - }) - uni.navigateBack({ - delta: 1, - }) - } else if (res.cancel) { - console.log('用户点击取消') - } - }, - }) + console.log('dddd', this.skuList) + // const uid = this.uid + // const openid = this.openid + // const keyname = this.orderInfo.order_info.keyname + // // console.log('keyname',this.orderInfo.keyname) + // uni.showModal({ + // title: '提示', + // content: '现在取消,订单不可恢复哦,确认取消吗?', + // success: function(res) { + // if (res.confirm) { + // store.dispatch('cancelOrder/cancel', { + // keyname: keyname, + // uid: uid, + // openid: openid, + // }) + // uni.navigateBack({ + // delta: 1, + // }) + // } else if (res.cancel) { + // console.log('用户点击取消') + // } + // }, + // }) }, paylog() { console.log('pay', this.orderInfo) @@ -588,6 +602,7 @@ export default { .buy-num { font-size: 12px; color: #999999; + margin-left: 0; } } } @@ -695,13 +710,21 @@ export default { width: 19px; height: 16px; } - text { + button { // font-family: PingFangSC-Regular; + border: none; + border-radius: 0; + text-align: left; margin-left: 20rpx; font-size: 14px; color: #333333; letter-spacing: -0.26px; line-height: 18px; + background-color: #fff; + padding: 0; + &::after { + border: 0; + } } } } diff --git a/src/pages/user/user.vue b/src/pages/user/user.vue index 9150b6a..3b54951 100644 --- a/src/pages/user/user.vue +++ b/src/pages/user/user.vue @@ -77,7 +77,10 @@ ></image> </view> <view class="myOrder"> - <view class="orderHeader" @click="toMyOrder('10')" > + <view + class="orderHeader" + @click="toMyOrder('10')" + > <text>我的订单</text> <view class="btn"> 全部 @@ -188,7 +191,10 @@ mode="aspectFit" ></image> <view class="left lastLeft"> - <text>联系客服</text> + <button + class="contact" + open-type="contact" + >联系客服</button> <image src="../../static/right.png" mode="aspectFit" @@ -374,6 +380,20 @@ export default { </script> <style lang="scss"> +// 联系客服 +.contact { + border: 0; + padding: 0; + font-size: 14px; + text-align: left; + background-color: #fff; + color: #333; + margin: 0; + padding-right: 450rpx; + &::after { + border: 0; + } +} .warp { font-size: 24rpx; background-color: #f2f2f2; @@ -561,9 +581,6 @@ export default { width: 40rpx; height: 44rpx; } - .lastLeft { - border-bottom: none; - } } } .recommend { diff --git a/src/store/modules/orderRead.js b/src/store/modules/orderRead.js index e47a50c..f322ae2 100644 --- a/src/store/modules/orderRead.js +++ b/src/store/modules/orderRead.js @@ -2,36 +2,61 @@ import urlAlias from '../url' import request from '../request' const { - orderRead + orderRead, + detailStandardList, } = urlAlias const state = { - orderInfo: {} + orderInfo: {}, + skuList: [], } const mutations = { INIT: (state, orderInfo) => { state.orderInfo = orderInfo - } + }, + SKU: (state, skuList) => { + state.skuList = skuList + }, } const actions = { getOrderInfo({ commit }, param) { - return new Promise ((resolve) => request({ + return new Promise((resolve) => request({ url: orderRead, data: param, - success: (res) => { - console.log(res) - commit("INIT", res.data.data) - resolve(res.data.data) - } + success: (res) => { + console.log(res) + commit('INIT', res.data.data) + resolve(res.data.data) + }, })) - } + }, + goodDetails({ commit, rootState }, param) { + return new Promise((resolve) => request({ + url: detailStandardList, + data: param, + success: ({ data }) => { + const { data: { skuList: list } } = data + const { skId } = param + const { skuList } = rootState.orderRead + console.log('data', list, skId) + for (let index = 0; index < list.length; index++) { + const element = list[index] + if (skId === element.sk_id) { + skuList.push(element) + } + } + commit('SKU', skuList) + resolve() + }, + })) + }, } export default { namespaced: true, state, mutations, - actions + actions, } -- 2.0.0