Commit 3a0878cc773855146d390a935b133980a5c0ee88

Authored by 范牧
Exists in master

冲突修改

src/pages/cart/cart.vue
... ... @@ -93,8 +93,8 @@ export default {
93 93 computed: {
94 94  
95 95 cartList() {
96   - // console.log('cart-list', this.$store.state.cart.cartList);
97   - return this.$store.state.cart.cartList
  96 + // console.log('cart-list', this.$store.state.cart.cartList);
  97 + return this.$store.state.cart.cartList
98 98 },
99 99 childIsOpen() {
100 100 const temp = []
... ... @@ -107,8 +107,8 @@ export default {
107 107 }
108 108 },
109 109 onLoad: function() {
110   - // store.dispatch('cart/addCart', {
111   - // uid: this.$store.state.user.userInfo.uid,
  110 + // store.dispatch('cart/addCart', {
  111 + // uid: this.$store.state.user.userInfo.uid,
112 112 // openid: this.$store.state.user.userInfo.openid,
113 113 // mp_id: 7,
114 114 // sk_id: 7,
... ... @@ -116,11 +116,10 @@ export default {
116 116 // pid: 8,
117 117 // price: 128,
118 118 // checkedSKU:{},
119   - // })
  119 + // })
120 120 store.dispatch('cart/getCartList', {
121 121 uid: this.$store.state.user.userInfo.uid // 用户id
122 122 })
123   -
124 123 },
125 124  
126 125 methods: {
... ... @@ -181,7 +180,7 @@ export default {
181 180 } else {
182 181 this.addDisabled = true
183 182 // 修改num
184   - if(this.childIsOpen[index]){
  183 + if (this.childIsOpen[index]) {
185 184 this.totalPrice = this.totalPrice + this.$store.state.cart.cartList[index].nowPrice
186 185 }
187 186 store.dispatch('cart/modiCart', {
... ... @@ -204,8 +203,8 @@ export default {
204 203 } else {
205 204 this.desDisabled = false
206 205 // post 请求修改相关参数
207   - if(this.childIsOpen[index]){
208   - this.totalPrice = this.totalPrice - this.$store.state.cart.cartList[index].nowPrice
  206 + if (this.childIsOpen[index]) {
  207 + this.totalPrice = this.totalPrice - this.$store.state.cart.cartList[index].nowPrice
209 208 }
210 209 store.dispatch('cart/modiCart', {
211 210 uid: this.$store.state.user.userInfo.uid,
... ... @@ -277,7 +276,7 @@ export default {
277 276 // this.$store.state.cart.cartList.splice(index,1)
278 277 store.dispatch('cart/delCart', {
279 278 uid: this.$store.state.user.userInfo.uid,
280   - openid: this.$store.state.user.userInfo.openid,
  279 + openid: this.$store.state.user.userInfo.openid,
281 280 cart_id: cart_id, // 要修改的购物车id
282 281 arg: index // 由于action 传参是能接收两参数,因此将index放入对象
283 282 })
... ... @@ -291,7 +290,7 @@ export default {
291 290 </script>
292 291  
293 292 <style lang="scss">
294   - .content {
  293 +.content {
295 294 min-height: 100vh;
296 295 background-color: #f2f2f2;
297 296 display: flex;
... ...
src/pages/frameDetail/frameDetail.vue
... ... @@ -315,7 +315,7 @@
315 315 <view class="botton_2">
316 316 <view
317 317 class="botton_input"
318   - @tap="toCart()"
  318 + @tap="addCart()"
319 319 >加入购物车</view>
320 320 <view
321 321 class="botton_now"
... ... @@ -334,6 +334,13 @@ export default {
334 334 test: '',
335 335 goodType: 2,
336 336 pid: 0,
  337 + // 购物车数据
  338 + addCartList: {
  339 + mp_id: 335,
  340 + sk_id: 0,
  341 + num: 1,
  342 + price: ''
  343 + },
337 344 screenItems: [
338 345 { current: 0, text: '商品介绍' },
339 346 { current: 1, text: '规格参数' },
... ... @@ -387,6 +394,7 @@ export default {
387 394 this.parameter[4].slength = `${this.goodInfo.leg_long}mm`
388 395 this.parameter[5].slength = `${this.goodInfo.weight}mm`
389 396 this.tag = this.goodInfo.tag
  397 + this.addCartList.price = this.goodInfo.p_sale_price
390 398 this.test = this.goodInfo.prodIntro1
391 399 this.test = this.test.replace(/\<img/gi, '<img style="max-width:100%;height:auto" ')
392 400 })
... ... @@ -410,6 +418,22 @@ export default {
410 418 complete: () => { console.log('toCart') }
411 419 })
412 420 },
  421 + // 加入购物车
  422 + addCart () {
  423 + store.dispatch('cart/addCart', {
  424 + uid: this.$store.state.user.userInfo.uid,
  425 + openid: this.$store.state.user.userInfo.openid,
  426 + mp_id: this.addCartList.mp_id,
  427 + sk_id: this.addCartList.sk_id,
  428 + num: this.addCartList.num,
  429 + pid: this.pid,
  430 + price: this.addCartList.price,
  431 + checkedSKU: {}
  432 + })
  433 + store.dispatch('cart/getCartList', {
  434 + uid: this.$store.state.user.userInfo.uid // 用户id
  435 + })
  436 + },
413 437 goPerchase () {
414 438 // switch (this.updateGoodType) {
415 439 // case '1':
... ... @@ -449,6 +473,18 @@ export default {
449 473 // break
450 474 // }
451 475 },
  476 + // 加入购物车
  477 + addCart () {
  478 + store.dispatch('cart/addCart', {
  479 + uid: this.$store.state.user.userInfo.uid,
  480 + openid: this.$store.state.user.userInfo.openid,
  481 + pid: this.pid,
  482 + checkedSKU: {}
  483 + })
  484 + store.dispatch('cart/getCartList', {
  485 + uid: this.$store.state.user.userInfo.uid // 用户id
  486 + })
  487 + },
452 488 tabChange (e) {
453 489 if (this.current !== e) {
454 490 this.current = e
... ... @@ -472,10 +508,10 @@ export default {
472 508 box-sizing: border-box;
473 509 .swiperImage {
474 510 width: 684rpx;
475   - height: 512rpx;
  511 + height: 480rpx;
476 512 image {
477   - width: 100%;
478   - height: 100%;
  513 + max-width: 100%;
  514 + max-height: 100%;
479 515 border-radius: 16rpx;
480 516 }
481 517 }
... ...
src/pages/myOrderPaying/myOrderPaying.vue
... ... @@ -233,7 +233,6 @@ export default {
233 233 timerChange: function(value) {
234 234 var newDate = new Date()
235 235 newDate.setTime(value * 1000)
236   - console.log(newDate.toLocaleString())
237 236 return newDate.toLocaleString()
238 237 }
239 238 }
... ...
src/store/modules/cart.js
... ... @@ -20,7 +20,7 @@ const mutations = {
20 20 MODI: (state, args) => {
21 21 console.log('the num', state.cartList[args.index].num)
22 22 console.log('mutations====>isadd', args)
23   - state.cartList[args.index].num = args.num
  23 + state.cartList[args.index].num = args.num
24 24 console.log('the num', state.cartList[args.index].num)
25 25 }
26 26  
... ... @@ -55,7 +55,7 @@ const actions = {
55 55 url: cartModi,
56 56 data: param,
57 57 success: (res) => {
58   - console.log('modiCart-res=====>',res.data)
  58 + console.log('modiCart-res=====>', res.data)
59 59 console.log('modi-parm', param)
60 60 commit('MODI', arg)
61 61 },
... ...