Commit 36e5592037888e5b54ebfd4874c987d8f671e68f
1 parent
56ccc089ea
Exists in
master
逻辑完善
Showing
8 changed files
with
149 additions
and
113 deletions
Show diff stats
src/components/BottomSheet/BottomSheet.vue
... | ... | @@ -492,10 +492,11 @@ import store from '@/store' |
492 | 492 | j += this.current[i] |
493 | 493 | } |
494 | 494 | } |
495 | + const price = this.skuList.filter(item=>item.sk_id == this.skuList[j].sk_id)[0].real_price | |
495 | 496 | let sk_id = this.skuList[j].sk_id |
496 | - console.log('选择的商品sk_id',sk_id,'选择的商品参数',checkedSKU) | |
497 | - console.log('mp_id',this.mp_id,'数量',this.count) | |
498 | - this.$emit("addCart",this.mp_id,this.count,checkedSKU,sk_id)//添加购物车 | |
497 | + // console.log('选择的商品sk_id',sk_id,'选择的商品参数',checkedSKU) | |
498 | + // console.log('mp_id',this.mp_id,'数量',this.count) | |
499 | + this.$emit("addCart",this.mp_id,this.count,checkedSKU,sk_id,price)//添加购物车 | |
499 | 500 | this.$emit("closeBottom")//关闭弹窗 |
500 | 501 | }, |
501 | 502 | onClickLoveItem(index,name){ | ... | ... |
src/pages.json
... | ... | @@ -153,6 +153,14 @@ |
153 | 153 | "pages/address/addAddress", |
154 | 154 | "pages/address/addressList" |
155 | 155 | ] |
156 | + }, | |
157 | + { | |
158 | + "root": "pages/myOrder", | |
159 | + "name": "pack3", | |
160 | + "pages": [ | |
161 | + "pages/myOrder/myOrder", | |
162 | + "pages/myOrderPaying/myOrderPaying" | |
163 | + ] | |
156 | 164 | } |
157 | 165 | ], |
158 | 166 | "globalStyle": { | ... | ... |
src/pages/cart/cart.vue
... | ... | @@ -180,13 +180,14 @@ export default { |
180 | 180 | args: { |
181 | 181 | index: index, |
182 | 182 | }, |
183 | + }) | |
184 | + this.$nextTick(function(){ | |
185 | + store.dispatch('cart/getCartList', { | |
186 | + uid: this.$store.state.user.userInfo.uid, // 用户id | |
187 | + }).then(()=>{ | |
188 | + this.cartList = this.$store.state.cart.cartList; | |
189 | + }) | |
183 | 190 | }) |
184 | - store.dispatch('cart/getCartList', { | |
185 | - uid: this.$store.state.user.userInfo.uid, // 用户id | |
186 | - }) | |
187 | - | |
188 | - this.$forceUpdate() | |
189 | - // console.log('21212121212',this.cartList) | |
190 | 191 | }, |
191 | 192 | //底部弹窗开关 |
192 | 193 | showBottom(isCart,pid,skId,mp_id,cart_id,index){ | ... | ... |
src/pages/confirmOrder/confirmOrder.vue
... | ... | @@ -451,7 +451,7 @@ export default { |
451 | 451 | }) |
452 | 452 | // 跳转订单详情页->状态 待收货 |
453 | 453 | uni.reLaunch({ |
454 | - url: `../myOrderPaying/myOrderPaying?payId=${payId}&state=1&isPay=1`, | |
454 | + url: `../myOrderPaying/myOrderPaying?payId=${payId}&status=1&isPay=1`, | |
455 | 455 | }) |
456 | 456 | }, |
457 | 457 | fail: (res) => { |
... | ... | @@ -462,7 +462,7 @@ export default { |
462 | 462 | }) |
463 | 463 | // 跳转订单详情页->状态 待付款 |
464 | 464 | uni.reLaunch({ |
465 | - url: `../myOrderPaying/myOrderPaying?payId=${payId}&state=0&isPay=1`, | |
465 | + url: `../myOrderPaying/myOrderPaying?payId=${payId}&status=0&isPay=1`, | |
466 | 466 | }) |
467 | 467 | }, |
468 | 468 | complete: () => { | ... | ... |
src/pages/details/details.vue
... | ... | @@ -420,13 +420,16 @@ export default { |
420 | 420 | }) |
421 | 421 | }, |
422 | 422 | // 加入购物车 |
423 | - addCart (mpId, num, checkedSKU, skId) { | |
424 | - this.addCartList.mp_id = mpId | |
425 | - this.addCartList.sk_id = skId | |
426 | - this.addCartList.num = num | |
427 | - this.addCartList.checkedSKU = checkedSKU | |
428 | - console.log('添加购物车的参数', this.addCartList) | |
429 | - store.dispatch('cart/addCart', this.addCartList).then((res) => { | |
423 | + addCart (mpId, num, checkedSKU, skId,price) { | |
424 | + const addCartList = {} | |
425 | + addCartList.mp_id = mpId | |
426 | + addCartList.sk_id = skId | |
427 | + addCartList.num = num | |
428 | + addCartList.checkedSKU = checkedSKU | |
429 | + addCartList.pid = this.pid | |
430 | + addCartList.price = price | |
431 | + console.log('添加购物车的参数', addCartList) | |
432 | + store.dispatch('cart/addCart', addCartList).then((res) => { | |
430 | 433 | if (res.code === 1) { |
431 | 434 | uni.showToast({ |
432 | 435 | title: '添加成功~', | ... | ... |
src/pages/myOrder/components/OrderCard.vue
... | ... | @@ -30,7 +30,7 @@ |
30 | 30 | </view> |
31 | 31 | <view |
32 | 32 | class="orderCardInfo" |
33 | - v-for="(orderInfo, index) in order.order_info.list" | |
33 | + v-for="(orderInfo, index) in orderInfoList" | |
34 | 34 | :key="index" |
35 | 35 | > |
36 | 36 | <image |
... | ... | @@ -80,7 +80,7 @@ |
80 | 80 | <text class="orderType" v-if="status == '2'||status == '3'">已完成</text> |
81 | 81 | <!-- <text class="orderType" v-if="status == '3'">已评价</text> --> |
82 | 82 | </view> |
83 | - <view class="orderCardInfo" v-for="(orderInfo) in orderInfoList.list" :key="orderInfo"> | |
83 | + <view class="orderCardInfo" v-for="(orderInfo) in orderInfoList" :key="orderInfo"> | |
84 | 84 | <image :src="orderInfo.imgUrl" mode="aspectFill"></image> |
85 | 85 | <view class="infoText"> |
86 | 86 | <view class="orderName">{{orderInfo.p_name}}</view> |
... | ... | @@ -116,74 +116,7 @@ |
116 | 116 | /** |
117 | 117 | * 订单数据 |
118 | 118 | */ |
119 | - order: { | |
120 | - // orderId: Number, | |
121 | - // img: String, | |
122 | - // name: String, | |
123 | - // originCost:String, | |
124 | - // price: String, | |
125 | - // orderType:Number, | |
126 | - // buyNum:Number, | |
127 | - finished_time: null, | |
128 | - is_refound: String, | |
129 | - mch_id: String, | |
130 | - money_of_dcw: String, | |
131 | - money_of_partner: String, | |
132 | - money_of_shop: String, | |
133 | - orderJudge: Boolean, | |
134 | - order_info: { | |
135 | - address:{ | |
136 | - cityName: String, | |
137 | - countyName: String, | |
138 | - detailInfo: String, | |
139 | - errMsg: String, | |
140 | - nationalCode: String, | |
141 | - postalCode: String, | |
142 | - provinceName: String, | |
143 | - telNumber: String, | |
144 | - userName: String, | |
145 | - }, | |
146 | - cartinfo: ["127"], | |
147 | - keyname: "330_1588911391", | |
148 | - lefttime: Number, | |
149 | - list:[ | |
150 | - { | |
151 | - cart_id: "127", | |
152 | - imgUrl: String, | |
153 | - img_index_url: null, | |
154 | - memo: String, | |
155 | - mp_id: String, | |
156 | - nowPrice: String, | |
157 | - num: String, | |
158 | - oldPrice: Number, | |
159 | - p_discount: String, | |
160 | - p_name: String, | |
161 | - p_root_index: String, | |
162 | - p_sale_price: String, | |
163 | - peopleName: String, | |
164 | - pics: ["79_0_D122D2.jpg","79_1_E0A1ED.jpg","79_2_B00B3D.jpg","79_3_B2CF21.jpg","79_4_33AD1B.jpg"], | |
165 | - pid: String, | |
166 | - sk_id: String, | |
167 | - } | |
168 | - ], | |
169 | - orderDesc: String, | |
170 | - total_fee: Number, | |
171 | - }, | |
172 | - partner_uid: String, | |
173 | - pay_cate: String, | |
174 | - pay_id: String, | |
175 | - pay_time: String, | |
176 | - pay_wood_desc: String, | |
177 | - pay_wood_id: String, | |
178 | - prepay_id: String, | |
179 | - re_check_staus: String, | |
180 | - shopid: String, | |
181 | - split_userid: String, | |
182 | - status: String, | |
183 | - // status0待付款 1已付款 待收货 2 已收货待评价 3 已评价 | |
184 | - total_fee: String, | |
185 | - uid: String, | |
186 | - }, | |
119 | + order: {}, | |
187 | 120 | /** |
188 | 121 | * 当前选择 |
189 | 122 | */ |
... | ... | @@ -200,7 +133,7 @@ |
200 | 133 | return this.order.status |
201 | 134 | }, |
202 | 135 | orderInfoList(){ |
203 | - console.log('this.order.order_info', this.order) | |
136 | + console.log('orderInfoList', this.order.order_info) | |
204 | 137 | return this.order.order_info |
205 | 138 | } |
206 | 139 | }, | ... | ... |
src/pages/myOrderPaying/myOrderPaying.vue
... | ... | @@ -139,24 +139,26 @@ export default { |
139 | 139 | uid: "", |
140 | 140 | openid: "", |
141 | 141 | lefttime: 0, |
142 | - isPay: 0 | |
142 | + isPay: 0, | |
143 | + orderInfo:Object | |
143 | 144 | }; |
144 | 145 | }, |
145 | - onLoad: function ({payId,state,isPay}) { | |
146 | - console.log('++++++++++++++++++',payId,state,isPay) | |
146 | + onLoad:async function ({payId,status,isPay}) { | |
147 | + // console.log('++++++++++++++++++',payId,status,isPay) | |
147 | 148 | this.payId = payId |
148 | - this.status = state | |
149 | + this.status = status | |
149 | 150 | this.isPay = isPay |
150 | 151 | const openid = uni.getStorageSync('openid') |
151 | - const uid = this.$store.state.user.uid | |
152 | + const uid = this.$store.state.user.userInfo.uid | |
152 | 153 | this.uid = uid |
153 | 154 | this.openid = openid |
154 | - store.dispatch('orderRead/getOrderInfo', { | |
155 | + await store.dispatch('orderRead/getOrderInfo', { | |
155 | 156 | pay_id: this.payId, |
156 | - uid: "1", | |
157 | + uid: uid, | |
157 | 158 | openid: openid |
158 | - }); | |
159 | - // this.orderInfo = this.$store.state.orderRead.orderInfo | |
159 | + }); | |
160 | + console.log(this.$store.state.orderRead.orderInfo) | |
161 | + this.orderInfo = this.$store.state.orderRead.orderInfo | |
160 | 162 | }, |
161 | 163 | // 若从支付页面跳转过来,返回直接返回到首页 |
162 | 164 | onBackPress(option) { |
... | ... | @@ -168,14 +170,8 @@ export default { |
168 | 170 | } |
169 | 171 | }, |
170 | 172 | computed: { |
171 | - // 获取订单详细信息 | |
172 | - orderInfo() { | |
173 | - console.log("orderInfo", this.$store.state.orderRead.orderInfo); | |
174 | - return this.$store.state.orderRead.orderInfo || {}; | |
175 | - }, | |
176 | 173 | orderInfoList () { |
177 | - const orderInfoList = this.$store.state.orderRead.orderInfo.order_info.list | |
178 | - return orderInfoList | |
174 | + return this.orderInfo.order_info.list | |
179 | 175 | }, |
180 | 176 | // 获取订单地址信息 |
181 | 177 | orderAddressInfo () { |
... | ... | @@ -206,25 +202,119 @@ export default { |
206 | 202 | }, |
207 | 203 | cancleOrder() { |
208 | 204 | const uid = this.uid; |
209 | - const openid = this.openid; | |
205 | + const openid = this.openid; | |
206 | + const keyname = this.orderInfo.keyname | |
207 | + console.log(this.orderInfo) | |
210 | 208 | uni.showModal({ |
211 | 209 | title: "提示", |
212 | 210 | content: "现在取消,订单不可恢复哦,确认取消吗?", |
213 | 211 | success: function(res) { |
214 | 212 | if (res.confirm) { |
215 | 213 | store.dispatch("cancelOrder/cancel", { |
216 | - keyname: "1", | |
214 | + keyname: keyname, | |
217 | 215 | uid: uid, |
218 | 216 | openid: openid |
219 | - }); | |
217 | + }); | |
218 | + uni.navigateBack({ | |
219 | + delta:1 | |
220 | + }) | |
220 | 221 | } else if (res.cancel) { |
221 | 222 | console.log("用户点击取消"); |
222 | 223 | } |
223 | 224 | } |
224 | 225 | }); |
225 | 226 | }, |
226 | - paylog() {}, | |
227 | - confirmOrder() { | |
227 | + paylog() { | |
228 | + console.log('pay',this.orderInfo) | |
229 | + // const { data, exKeyName: keyName } = res | |
230 | + // const uid = uni.getStorageSync('uid') | |
231 | + // const timeStamp = new Date().getTime().toString() | |
232 | + // const nonceStr = 'asfafasfasfasfasf' | |
233 | + // // 支付参数 | |
234 | + // const fieldSet = { | |
235 | + // openid: this.$store.state.user.userInfo.openid, | |
236 | + // uid: this.$store.state.user.userInfo.uid, | |
237 | + // shopid: 0, | |
238 | + // payCate: 2020, | |
239 | + // payMoney: this.totalPrice, | |
240 | + // payWoodId: `fcdj-${uid}-${keyName}`, | |
241 | + // payWoodDesc: '在【非常戴镜】的微信付款凭证', | |
242 | + // nonceStr, | |
243 | + // signType: 'MD5', | |
244 | + // app_uid: 2020, | |
245 | + // timeStamp, | |
246 | + // keyname: keyName, | |
247 | + // billInfo: JSON.stringify(data), | |
248 | + // } | |
249 | + // // 请求后台支付接口 | |
250 | + // store.dispatch('order/pay', fieldSet).then(({ data, data2, pay_id: payId }) => { | |
251 | + // if (data.return_code === 'SUCCESS' && data.result_code === 'SUCCESS') { | |
252 | + // const stringA = `appId=wx115b25aa396d27ac&nonceStr=${nonceStr}&package=prepay_id=${data.prepay_id}&signType=MD5&timeStamp=${timeStamp}` | |
253 | + // const stringSignTemp = stringA + '&key=NewMoney2017hatemydaddy123456789' | |
254 | + | |
255 | + // // 微信支付接口 | |
256 | + // uni.requestPayment({ | |
257 | + // appId: data.appid, | |
258 | + // timeStamp, | |
259 | + // nonceStr, | |
260 | + // total_fee: this.totalPrice, | |
261 | + // package: `prepay_id=${data.prepay_id}`, | |
262 | + // signType: 'MD5', | |
263 | + // paySign: MD5Util.MD5(stringSignTemp).toUpperCase(), | |
264 | + // success: (res) => { | |
265 | + // // 支付成功 | |
266 | + // uni.showModal({ | |
267 | + // content: '支付成功', | |
268 | + // showCancel: false, | |
269 | + // }) | |
270 | + // // 跳转订单详情页->状态 待收货 | |
271 | + // uni.reLaunch({ | |
272 | + // url: `../myOrderPaying/myOrderPaying?payId=${payId}&status=1&isPay=1`, | |
273 | + // }) | |
274 | + // }, | |
275 | + // fail: (res) => { | |
276 | + // // 支付失败 | |
277 | + // uni.showModal({ | |
278 | + // content: '支付失败', | |
279 | + // showCancel: false, | |
280 | + // }) | |
281 | + // // 跳转订单详情页->状态 待付款 | |
282 | + // uni.reLaunch({ | |
283 | + // url: `../myOrderPaying/myOrderPaying?payId=${payId}&status=0&isPay=1`, | |
284 | + // }) | |
285 | + // }, | |
286 | + // complete: () => { | |
287 | + // uni.hideLoading() | |
288 | + // }, | |
289 | + // }) | |
290 | + // } else { | |
291 | + // uni.showModal({ | |
292 | + // content: '支付失败', | |
293 | + // showCancel: false, | |
294 | + // }) | |
295 | + // console.log('支付失败') | |
296 | + // uni.hideLoading() | |
297 | + // } | |
298 | + // }) | |
299 | + | |
300 | + //修改订单状态 待付款==>待收货 | |
301 | + store.dispatch("statusConfirm/confirm", { | |
302 | + uid: this.uid, | |
303 | + openid: this.openid, | |
304 | + oldway: "0", | |
305 | + way: "1", | |
306 | + pay_id: this.payId, | |
307 | + judgeContent: "", | |
308 | + orderInfo: this.orderInfo.order_info | |
309 | + }) | |
310 | + .then( | |
311 | + setTimeout(() => { | |
312 | + uni.navigateBack(); | |
313 | + }, 1500) | |
314 | + ); | |
315 | + }, | |
316 | + confirmOrder() { | |
317 | + //确认收货 way1 ==>way2 | |
228 | 318 | store |
229 | 319 | .dispatch("statusConfirm/confirm", { |
230 | 320 | uid: this.uid, | ... | ... |
src/store/modules/orderRead.js
... | ... | @@ -17,14 +17,14 @@ const mutations = { |
17 | 17 | |
18 | 18 | const actions = { |
19 | 19 | getOrderInfo({ commit }, param) { |
20 | - request({ | |
20 | + return new Promise ((resolve) => request({ | |
21 | 21 | url: orderRead, |
22 | 22 | data: param, |
23 | 23 | success: (res) => { |
24 | 24 | commit("INIT", res.data.data) |
25 | - console.log('res',res) | |
25 | + resolve(res.data.data) | |
26 | 26 | } |
27 | - }) | |
27 | + })) | |
28 | 28 | } |
29 | 29 | } |
30 | 30 | ... | ... |