Commit cd8561baec1722c6874a76f4610010f490289a3c
Exists in
master
Merge branch 'master' of 121.40.31.31:jp/gulu-vue
Showing
4 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/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({ | ... | ... |