Commit 7c039b6f9a93bf342cb7baaf37f6dbd6609f8f21
1 parent
9394b5df70
Exists in
master
订单详情页规格修改
Showing
3 changed files
with
107 additions
and
42 deletions
Show diff stats
src/pages/myOrderPaying/myOrderPaying.vue
| ... | ... | @@ -60,7 +60,7 @@ |
| 60 | 60 | <view class="order-info"> |
| 61 | 61 | <view |
| 62 | 62 | class="order-info-head" |
| 63 | - v-for="(orderInfoListItem,index) in orderInfoList" | |
| 63 | + v-for="(orderInfoListItem, index) in orderInfoList" | |
| 64 | 64 | :key="index" |
| 65 | 65 | > |
| 66 | 66 | <image |
| ... | ... | @@ -73,11 +73,13 @@ |
| 73 | 73 | class="p2" |
| 74 | 74 | style="margin: 0;" |
| 75 | 75 | > |
| 76 | - 规格:玫瑰金 / 钛合金 / 防日光防紫外线 / 超薄超轻 | |
| 76 | + <!-- {{index}} --> | |
| 77 | + {{skuList[index] ? skuList[0].sku_name.replace('_', '/') : ''}} | |
| 78 | + <!-- {{skuList.length === 0 ? '' : skuList[0].sku_name.replace('_', '/')}} --> | |
| 77 | 79 | <!-- <view class="arrow"></view> --> |
| 78 | 80 | </view> |
| 79 | 81 | <view class="infoText-bottom"> |
| 80 | - <view class="markPrice">{{Number(orderInfoListItem.nowPrice)/100}}</view> | |
| 82 | + <view class="markPrice">¥{{Number(orderInfoListItem.nowPrice)/100}}</view> | |
| 81 | 83 | <view class="buy-num">X {{orderInfoListItem.num}}</view> |
| 82 | 84 | </view> |
| 83 | 85 | </view> |
| ... | ... | @@ -181,6 +183,13 @@ export default { |
| 181 | 183 | uid: uid, |
| 182 | 184 | openid: openid, |
| 183 | 185 | }) |
| 186 | + const { list } = this.orderInfo.order_info | |
| 187 | + for (let index = 0; index < list.length; index++) { | |
| 188 | + await store.dispatch('orderRead/goodDetails', { | |
| 189 | + pid: list[index].pid, | |
| 190 | + skId: list[index].sk_id, | |
| 191 | + }) | |
| 192 | + } | |
| 184 | 193 | this.totalPrice = this.orderInfo.total_fee |
| 185 | 194 | }, |
| 186 | 195 | // 若从支付页面跳转过来,返回直接返回到首页 |
| ... | ... | @@ -193,6 +202,10 @@ export default { |
| 193 | 202 | } |
| 194 | 203 | }, |
| 195 | 204 | computed: { |
| 205 | + // 规格列表 | |
| 206 | + skuList () { | |
| 207 | + return this.$store.state.orderRead.skuList | |
| 208 | + }, | |
| 196 | 209 | orderInfo() { |
| 197 | 210 | return this.$store.state.orderRead.orderInfo |
| 198 | 211 | }, |
| ... | ... | @@ -235,28 +248,29 @@ export default { |
| 235 | 248 | this.cancleOrder() |
| 236 | 249 | }, |
| 237 | 250 | cancleOrder() { |
| 238 | - const uid = this.uid | |
| 239 | - const openid = this.openid | |
| 240 | - const keyname = this.orderInfo.order_info.keyname | |
| 241 | - // console.log('keyname',this.orderInfo.keyname) | |
| 242 | - uni.showModal({ | |
| 243 | - title: '提示', | |
| 244 | - content: '现在取消,订单不可恢复哦,确认取消吗?', | |
| 245 | - success: function(res) { | |
| 246 | - if (res.confirm) { | |
| 247 | - store.dispatch('cancelOrder/cancel', { | |
| 248 | - keyname: keyname, | |
| 249 | - uid: uid, | |
| 250 | - openid: openid, | |
| 251 | - }) | |
| 252 | - uni.navigateBack({ | |
| 253 | - delta: 1, | |
| 254 | - }) | |
| 255 | - } else if (res.cancel) { | |
| 256 | - console.log('用户点击取消') | |
| 257 | - } | |
| 258 | - }, | |
| 259 | - }) | |
| 251 | + console.log('dddd', this.skuList) | |
| 252 | + // const uid = this.uid | |
| 253 | + // const openid = this.openid | |
| 254 | + // const keyname = this.orderInfo.order_info.keyname | |
| 255 | + // // console.log('keyname',this.orderInfo.keyname) | |
| 256 | + // uni.showModal({ | |
| 257 | + // title: '提示', | |
| 258 | + // content: '现在取消,订单不可恢复哦,确认取消吗?', | |
| 259 | + // success: function(res) { | |
| 260 | + // if (res.confirm) { | |
| 261 | + // store.dispatch('cancelOrder/cancel', { | |
| 262 | + // keyname: keyname, | |
| 263 | + // uid: uid, | |
| 264 | + // openid: openid, | |
| 265 | + // }) | |
| 266 | + // uni.navigateBack({ | |
| 267 | + // delta: 1, | |
| 268 | + // }) | |
| 269 | + // } else if (res.cancel) { | |
| 270 | + // console.log('用户点击取消') | |
| 271 | + // } | |
| 272 | + // }, | |
| 273 | + // }) | |
| 260 | 274 | }, |
| 261 | 275 | paylog() { |
| 262 | 276 | console.log('pay', this.orderInfo) |
| ... | ... | @@ -588,6 +602,7 @@ export default { |
| 588 | 602 | .buy-num { |
| 589 | 603 | font-size: 12px; |
| 590 | 604 | color: #999999; |
| 605 | + margin-left: 0; | |
| 591 | 606 | } |
| 592 | 607 | } |
| 593 | 608 | } |
| ... | ... | @@ -695,13 +710,21 @@ export default { |
| 695 | 710 | width: 19px; |
| 696 | 711 | height: 16px; |
| 697 | 712 | } |
| 698 | - text { | |
| 713 | + button { | |
| 699 | 714 | // font-family: PingFangSC-Regular; |
| 715 | + border: none; | |
| 716 | + border-radius: 0; | |
| 717 | + text-align: left; | |
| 700 | 718 | margin-left: 20rpx; |
| 701 | 719 | font-size: 14px; |
| 702 | 720 | color: #333333; |
| 703 | 721 | letter-spacing: -0.26px; |
| 704 | 722 | line-height: 18px; |
| 723 | + background-color: #fff; | |
| 724 | + padding: 0; | |
| 725 | + &::after { | |
| 726 | + border: 0; | |
| 727 | + } | |
| 705 | 728 | } |
| 706 | 729 | } |
| 707 | 730 | } | ... | ... |
src/pages/user/user.vue
| ... | ... | @@ -77,7 +77,10 @@ |
| 77 | 77 | ></image> |
| 78 | 78 | </view> |
| 79 | 79 | <view class="myOrder"> |
| 80 | - <view class="orderHeader" @click="toMyOrder('10')" > | |
| 80 | + <view | |
| 81 | + class="orderHeader" | |
| 82 | + @click="toMyOrder('10')" | |
| 83 | + > | |
| 81 | 84 | <text>我的订单</text> |
| 82 | 85 | <view class="btn"> |
| 83 | 86 | 全部 |
| ... | ... | @@ -188,7 +191,10 @@ |
| 188 | 191 | mode="aspectFit" |
| 189 | 192 | ></image> |
| 190 | 193 | <view class="left lastLeft"> |
| 191 | - <text>联系客服</text> | |
| 194 | + <button | |
| 195 | + class="contact" | |
| 196 | + open-type="contact" | |
| 197 | + >联系客服</button> | |
| 192 | 198 | <image |
| 193 | 199 | src="../../static/right.png" |
| 194 | 200 | mode="aspectFit" |
| ... | ... | @@ -374,6 +380,20 @@ export default { |
| 374 | 380 | </script> |
| 375 | 381 | |
| 376 | 382 | <style lang="scss"> |
| 383 | +// 联系客服 | |
| 384 | +.contact { | |
| 385 | + border: 0; | |
| 386 | + padding: 0; | |
| 387 | + font-size: 14px; | |
| 388 | + text-align: left; | |
| 389 | + background-color: #fff; | |
| 390 | + color: #333; | |
| 391 | + margin: 0; | |
| 392 | + padding-right: 450rpx; | |
| 393 | + &::after { | |
| 394 | + border: 0; | |
| 395 | + } | |
| 396 | +} | |
| 377 | 397 | .warp { |
| 378 | 398 | font-size: 24rpx; |
| 379 | 399 | background-color: #f2f2f2; |
| ... | ... | @@ -561,9 +581,6 @@ export default { |
| 561 | 581 | width: 40rpx; |
| 562 | 582 | height: 44rpx; |
| 563 | 583 | } |
| 564 | - .lastLeft { | |
| 565 | - border-bottom: none; | |
| 566 | - } | |
| 567 | 584 | } |
| 568 | 585 | } |
| 569 | 586 | .recommend { | ... | ... |
src/store/modules/orderRead.js
| ... | ... | @@ -2,36 +2,61 @@ import urlAlias from '../url' |
| 2 | 2 | import request from '../request' |
| 3 | 3 | |
| 4 | 4 | const { |
| 5 | - orderRead | |
| 5 | + orderRead, | |
| 6 | + detailStandardList, | |
| 6 | 7 | } = urlAlias |
| 7 | 8 | |
| 8 | 9 | const state = { |
| 9 | - orderInfo: {} | |
| 10 | + orderInfo: {}, | |
| 11 | + skuList: [], | |
| 10 | 12 | } |
| 11 | 13 | |
| 12 | 14 | const mutations = { |
| 13 | 15 | INIT: (state, orderInfo) => { |
| 14 | 16 | state.orderInfo = orderInfo |
| 15 | - } | |
| 17 | + }, | |
| 18 | + SKU: (state, skuList) => { | |
| 19 | + state.skuList = skuList | |
| 20 | + }, | |
| 16 | 21 | } |
| 17 | 22 | |
| 18 | 23 | const actions = { |
| 19 | 24 | getOrderInfo({ commit }, param) { |
| 20 | - return new Promise ((resolve) => request({ | |
| 25 | + return new Promise((resolve) => request({ | |
| 21 | 26 | url: orderRead, |
| 22 | 27 | data: param, |
| 23 | - success: (res) => { | |
| 24 | - console.log(res) | |
| 25 | - commit("INIT", res.data.data) | |
| 26 | - resolve(res.data.data) | |
| 27 | - } | |
| 28 | + success: (res) => { | |
| 29 | + console.log(res) | |
| 30 | + commit('INIT', res.data.data) | |
| 31 | + resolve(res.data.data) | |
| 32 | + }, | |
| 28 | 33 | })) |
| 29 | - } | |
| 34 | + }, | |
| 35 | + goodDetails({ commit, rootState }, param) { | |
| 36 | + return new Promise((resolve) => request({ | |
| 37 | + url: detailStandardList, | |
| 38 | + data: param, | |
| 39 | + success: ({ data }) => { | |
| 40 | + const { data: { skuList: list } } = data | |
| 41 | + const { skId } = param | |
| 42 | + const { skuList } = rootState.orderRead | |
| 43 | + console.log('data', list, skId) | |
| 44 | + for (let index = 0; index < list.length; index++) { | |
| 45 | + const element = list[index] | |
| 46 | + if (skId === element.sk_id) { | |
| 47 | + skuList.push(element) | |
| 48 | + } | |
| 49 | + } | |
| 50 | + commit('SKU', skuList) | |
| 51 | + resolve() | |
| 52 | + }, | |
| 53 | + })) | |
| 54 | + }, | |
| 30 | 55 | } |
| 31 | 56 | |
| 32 | 57 | export default { |
| 33 | 58 | namespaced: true, |
| 34 | 59 | state, |
| 35 | 60 | mutations, |
| 36 | - actions | |
| 61 | + actions, | |
| 37 | 62 | } | ... | ... |