| | |
| | | return |
| | | } |
| | | this.dto.addressId = this.address.id |
| | | this.$message.showLoading() |
| | | const {code, data} = await this.$http.request('post', '/api/customer/flower/order/commit', { |
| | | data: { |
| | | ...this.dto |
| | | } |
| | | }) |
| | | this.$message.hideLoading() |
| | | if (code === 0) { |
| | | //提交信息 |
| | | console.log('pay,', data) |
| | | if (data && data['_testOrderId']) { |
| | | //回调 |
| | | this.$message.showLoading() |
| | | const {code, data} = await this.$http.request('get', '/api/customer/flower/order/callback/tmp', { |
| | | params: { |
| | | id: data['_testOrderId'] |
| | | } |
| | | }) |
| | | this.$message.hideLoading() |
| | | } else if (data) { |
| | | //微信接口 |
| | | let that = this |
| | | wx.requestPayment({ |
| | | ...data, |
| | | async success(res) { |
| | | console.log('pay success', res) |
| | | this.$message.showToast('支付成功') |
| | | //返回上一页 |
| | | await this.$store.dispatch('sign_add', 'shopping') |
| | | uni.navigateBack() |
| | | // uni.navigateTo({ |
| | | // url: '/pages/canteen/canteen-success/canteen-success' |
| | | // }) |
| | | }, |
| | | fail(err) { |
| | | console.error('pay fail', err) |
| | | that.$message.showToast('支付失败') |
| | | } |
| | | }) |
| | | |
| | | let tmp = this |
| | | wx.login({ |
| | | success: async res => { |
| | | console.log(res) |
| | | if (res.code) { |
| | | tmp.$message.showLoading() |
| | | const {code, data} = await tmp.$http.request('post', '/api/customer/flower/order/commit', { |
| | | data: { |
| | | ...tmp.dto, |
| | | wxcode: res.code |
| | | } |
| | | }) |
| | | tmp.$message.hideLoading() |
| | | if (code === 0) { |
| | | //提交信息 |
| | | console.log('pay,', data) |
| | | if (data && data['_testOrderId']) { |
| | | //回调 |
| | | tmp.$message.showLoading() |
| | | const res2 = await tmp.$http.request('get', '/api/customer/flower/order/callback/tmp', { |
| | | params: { |
| | | id: res2.data['_testOrderId'] |
| | | } |
| | | }) |
| | | tmp.$message.hideLoading() |
| | | } else if (data) { |
| | | wx.requestPayment({ |
| | | ...data, |
| | | async success(res) { |
| | | console.log('pay success', res) |
| | | tmp.$message.showToast('支付成功') |
| | | //返回上一页 |
| | | await tmp.$store.dispatch('sign_add', 'shopping') |
| | | uni.navigateBack() |
| | | }, |
| | | fail(err) { |
| | | console.error('pay fail', err) |
| | | tmp.$message.showToast('支付失败') |
| | | } |
| | | }) |
| | | |
| | | } |
| | | } |
| | | |
| | | } else { |
| | | tmp.$message.showToast('获取微信信息失败'); |
| | | } |
| | | }, |
| | | error: res => { |
| | | tmp.$message.showToast('获取微信信息失败:' + res); |
| | | } |
| | | } |
| | | }); |
| | | |
| | | |
| | | } |
| | | } |
| | |
| | | <common-address-select ref="addressselect"></common-address-select> |
| | | </view> |
| | | <view> |
| | | <view class="flower-container br-4 p10"> |
| | | <view class="flower-container m-t-12 br-4 p10"> |
| | | <view class="shopping-item m-b-20" v-for="(item,index) of dto.flowers" :key="index"> |
| | | <u-divider v-if="index>0"></u-divider> |
| | | <view class="sup-title flex"> |
| | |
| | | </view> |
| | | </view> |
| | | <!-- 查看商品列表,和选择运费 --> |
| | | <view class="br-4 transform-container p10"> |
| | | <view class="br-4 transform-container p10" style="padding-top: 0rpx"> |
| | | <view class="title"> |
| | | <view>运输方式:</view> |
| | | <view class="flex transform-list"> |
| | |
| | | <style scoped lang="scss"> |
| | | .page-confirm { |
| | | padding: 20rpx 30rpx; |
| | | |
| | | .bottom-price { |
| | | position: fixed; |
| | | background-color: #ffffff; |