From 480a7eb5fa89aa602167a7b5f42df5c6d79053b2 Mon Sep 17 00:00:00 2001
From: xuxueyang <xuxy@fengyuntec.com>
Date: 星期五, 26 七月 2024 16:20:55 +0800
Subject: [PATCH] fix bug 接口对接和样式调整
---
sub_pages/customer/shopping/confirm.vue | 97 +++++++++++++++++++++++++++---------------------
1 files changed, 55 insertions(+), 42 deletions(-)
diff --git a/sub_pages/customer/shopping/confirm.vue b/sub_pages/customer/shopping/confirm.vue
index 14e7dbf..2887293 100644
--- a/sub_pages/customer/shopping/confirm.vue
+++ b/sub_pages/customer/shopping/confirm.vue
@@ -89,48 +89,60 @@
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);
}
- }
+ });
+
}
}
@@ -143,7 +155,7 @@
<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">
@@ -170,7 +182,7 @@
</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">
@@ -257,6 +269,7 @@
<style scoped lang="scss">
.page-confirm {
padding: 20rpx 30rpx;
+
.bottom-price {
position: fixed;
background-color: #ffffff;
--
Gitblit v1.9.3