From 96c4135cc0b3fbd59958988b03102c8d9efeb72b Mon Sep 17 00:00:00 2001
From: xuxy <1059738716@qq.com>
Date: 星期六, 27 七月 2024 00:32:03 +0800
Subject: [PATCH] 1

---
 sub_pages/customer/shopping/confirm.vue |  101 ++++++++++++++++++++++++++++----------------------
 1 files changed, 57 insertions(+), 44 deletions(-)

diff --git a/sub_pages/customer/shopping/confirm.vue b/sub_pages/customer/shopping/confirm.vue
index 1fa2c45..19f2098 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">
@@ -153,7 +165,7 @@
           <view class="item-each m-t-12 flex">
             <image class="img img100 m-r-6" :src="item.url||item.cover"></image>
             <view>
-              <view class="title"><span>{{ item.levelStr || '-' }}</span>&nbsp;&nbsp;{{ item.name || '-' }}</view>
+              <view class="title"><span class="m-r-5" style="display: inline-block;">{{item.categoryStr||''}}</span><span v-if="item.levelStr" class="m-r-5" style="display: inline-block;">{{ item.levelStr || '' }}</span>{{ item.name || '-' }}</view>
               <view class="price">
                 {{ item.price || 0 }}*{{ item.num }}扎
               </view>
@@ -170,7 +182,7 @@
         </view>
       </view>
       <!--    查看商品列表,和选择运费 -->
-      <view class="br-4 transform-container p10">
+      <view class="br-4 transform-container m-t-12 p10">
         <view class="title">
           <view>运输方式:</view>
           <view class="flex transform-list">
@@ -245,7 +257,7 @@
     </view>
     <view class="bottom-price flex">
       <view class="m-t-12 m-l-0 m-r-a">
-        合计:¥ {{ (dto.totalAmount || 0) + (current_transport.fee || 0) || 0 }} 元
+        合计 <span class="t-red">¥ {{ (dto.totalAmount || 0) + (current_transport.fee || 0) || 0 }} </span>元
       </view>
       <view class="button-green-1 m-l-a m-r-0" style="min-width: 240rpx" @click="submitOrder">
         提交订单
@@ -257,6 +269,7 @@
 <style scoped lang="scss">
 .page-confirm {
   padding: 20rpx 30rpx;
+
   .bottom-price {
     position: fixed;
     background-color: #ffffff;

--
Gitblit v1.9.3