Commit 30ace30247856b291f1f756c0d40b0d7b11d7873
Exists in
master
Merge branch 'master' of http://121.40.31.31:8888/jp/gulu-vue
Showing
5 changed files
Show diff stats
src/pages/address/addAddress.vue
| ... | ... | @@ -77,7 +77,11 @@ |
| 77 | 77 | </view> |
| 78 | 78 | <button |
| 79 | 79 | form-type="submit" |
| 80 | + class="button" v-if="addId">编辑</button> | |
| 81 | + <button | |
| 82 | + form-type="submit" | |
| 80 | 83 | class="button" |
| 84 | + v-else | |
| 81 | 85 | >保存并使用</button> |
| 82 | 86 | </form> |
| 83 | 87 | </template> |
| ... | ... | @@ -195,7 +199,11 @@ export default { |
| 195 | 199 | if (this.addId) { |
| 196 | 200 | params.add_id = this.addId |
| 197 | 201 | } |
| 198 | - store.dispatch('address/edit', params) | |
| 202 | + store.dispatch('address/edit', params).then(() => { | |
| 203 | + uni.navigateBack({ | |
| 204 | + delta: 1 | |
| 205 | + }) | |
| 206 | + }) | |
| 199 | 207 | } |
| 200 | 208 | } |
| 201 | 209 | } | ... | ... |
src/pages/address/addressList.vue
| ... | ... | @@ -43,7 +43,7 @@ |
| 43 | 43 | > |
| 44 | 44 | 暂无收货地址 |
| 45 | 45 | </view> |
| 46 | - <button class="add">新建收货地址</button> | |
| 46 | + <button @tap="toAddAddress" class="add">新建收货地址</button> | |
| 47 | 47 | </view> |
| 48 | 48 | </template> |
| 49 | 49 | |
| ... | ... | @@ -65,6 +65,15 @@ export default { |
| 65 | 65 | store.dispatch('address/list') |
| 66 | 66 | }, |
| 67 | 67 | methods: { |
| 68 | + toAddAddress() { | |
| 69 | + console.log('aaaaa-a') | |
| 70 | + uni.navigateTo({ | |
| 71 | + url: 'addAddress', | |
| 72 | + fail: (error) => { | |
| 73 | + console.error('跳转出现错误', error) | |
| 74 | + } | |
| 75 | + }) | |
| 76 | + }, | |
| 68 | 77 | toEditAddress (addId) { |
| 69 | 78 | console.log('addId', addId) |
| 70 | 79 | uni.navigateTo({ | ... | ... |
src/pages/confirmOrder/confirmOrder.vue
| ... | ... | @@ -229,19 +229,17 @@ export default { |
| 229 | 229 | complete: () => {} |
| 230 | 230 | }) |
| 231 | 231 | }, |
| 232 | - // 加入购物车 | |
| 233 | - addCart() { | |
| 234 | - console.log('this', this.$store.state) | |
| 235 | - store.dispatch('cart/') | |
| 236 | - }, | |
| 237 | 232 | // 下单 |
| 238 | 233 | orderBuild() { |
| 239 | 234 | console.log('this', this.$store.state) |
| 240 | 235 | // store.dispatch('order/build', { |
| 236 | + // pid: 2, | |
| 237 | + // sk_id: '23', | |
| 238 | + // number: 2, | |
| 239 | + // mp_id: '201', | |
| 240 | + // totalPrice: 101, | |
| 241 | 241 | // address: this.addressInfo, |
| 242 | - // checkedGoods: [], | |
| 243 | - // sk_id_arr: [], | |
| 244 | - // totalPrice: 101 | |
| 242 | + // dir: 1 | |
| 245 | 243 | // }) |
| 246 | 244 | } |
| 247 | 245 | // 支付 | ... | ... |
src/pages/frameDetail/frameDetail.vue
| ... | ... | @@ -302,7 +302,6 @@ |
| 302 | 302 | </block> --> |
| 303 | 303 | </view> |
| 304 | 304 | </view> |
| 305 | - | |
| 306 | 305 | <!-- 底部菜单 --> |
| 307 | 306 | <view class="botton"> |
| 308 | 307 | <view |
| ... | ... | @@ -336,7 +335,8 @@ export default { |
| 336 | 335 | pid: 0, |
| 337 | 336 | // 购物车数据 |
| 338 | 337 | addCartList: { |
| 339 | - mp_id: 335, | |
| 338 | + mp_id: 0, | |
| 339 | + uid: 0, | |
| 340 | 340 | sk_id: 0, |
| 341 | 341 | num: 1, |
| 342 | 342 | price: '' |
| ... | ... | @@ -394,10 +394,15 @@ export default { |
| 394 | 394 | this.parameter[4].slength = `${this.goodInfo.leg_long}mm` |
| 395 | 395 | this.parameter[5].slength = `${this.goodInfo.weight}mm` |
| 396 | 396 | this.tag = this.goodInfo.tag |
| 397 | - this.addCartList.price = this.goodInfo.p_sale_price | |
| 398 | 397 | this.test = this.goodInfo.prodIntro1 |
| 399 | 398 | this.test = this.test.replace(/\<img/gi, '<img style="max-width:100%;height:auto" ') |
| 399 | + // addCart | |
| 400 | + this.addCartList.price = this.goodInfo.p_sale_price | |
| 401 | + this.addCartList.sk_id = this.goodInfo.skuList[0].sk_id | |
| 402 | + this.addCartList.mp_id = this.goodInfo.glassData.mp_id | |
| 403 | + this.addCartList.uid = this.$store.state.user.userInfo.uid | |
| 400 | 404 | }) |
| 405 | + // console.log(this.$store.state.user.userInfo.uid + 'ssss') | |
| 401 | 406 | }, |
| 402 | 407 | computed: { |
| 403 | 408 | updateGoodType () { |
| ... | ... | @@ -427,8 +432,7 @@ export default { |
| 427 | 432 | sk_id: this.addCartList.sk_id, |
| 428 | 433 | num: this.addCartList.num, |
| 429 | 434 | pid: this.pid, |
| 430 | - price: this.addCartList.price, | |
| 431 | - checkedSKU: {} | |
| 435 | + price: this.addCartList.price | |
| 432 | 436 | }) |
| 433 | 437 | store.dispatch('cart/getCartList', { |
| 434 | 438 | uid: this.$store.state.user.userInfo.uid // 用户id |
| ... | ... | @@ -473,18 +477,6 @@ export default { |
| 473 | 477 | // break |
| 474 | 478 | // } |
| 475 | 479 | }, |
| 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 | - }, | |
| 488 | 480 | tabChange (e) { |
| 489 | 481 | if (this.current !== e) { |
| 490 | 482 | this.current = e | ... | ... |
src/store/modules/address.js
| ... | ... | @@ -19,10 +19,12 @@ const mutations = { |
| 19 | 19 | |
| 20 | 20 | const actions = { |
| 21 | 21 | edit(mutations, param, success) { |
| 22 | - request({ | |
| 22 | + return new Promise((resolve) => request({ | |
| 23 | 23 | url: editAddress, |
| 24 | 24 | data: param, |
| 25 | - success, | |
| 25 | + success: () => { | |
| 26 | + resolve() | |
| 27 | + }, | |
| 26 | 28 | fail: () => { |
| 27 | 29 | uni.showModal({ |
| 28 | 30 | content: '编辑失败', |
| ... | ... | @@ -32,7 +34,7 @@ const actions = { |
| 32 | 34 | complete: (res) => { |
| 33 | 35 | console.log('complete status === > ', res) |
| 34 | 36 | } |
| 35 | - }) | |
| 37 | + })) | |
| 36 | 38 | }, |
| 37 | 39 | list({ commit }) { |
| 38 | 40 | request({ | ... | ... |