Procházet zdrojové kódy

feat(confirm-order): 添加订单总价和邮费字段支持

- 在Api.shoppingCartOrderConfirm接口中新增totalPrice和transfee字段
- 在AppletOrderSkuVo接口中调整字段定义,将transfee改为totalPrice
- 修改开发环境配置,启用157测试服务器地址,注释线上地址
- 移除页面中重复的totalMoney计算逻辑
- 更新getOrderPayMent函数参数,支持传入运费参数
- 修改订单确认页面显示逻辑,使用接口返回的totalPrice字段
- 调整支付流程中的运费参数传递方式
zhangtao před 2 dny
rodič
revize
b358175032

+ 11 - 2
src/api/api.type.d.ts

@@ -843,6 +843,14 @@ namespace Api {
     [property: string]: any
   }
   interface shoppingCartOrderConfirm {
+    /**
+     * 总计
+     */
+    totalPrice: number
+    /**
+     * 邮费
+     */
+    transfee: number
     offsetPoints: number
     shopName: string
     /**
@@ -857,9 +865,10 @@ namespace Api {
   }
   interface AppletOrderSkuVo {
     /**
-     * 邮费
+     * 总计
      */
-    transfee: number
+    totalPrice: number
+
     /**
      * offsetPoints
      */

+ 2 - 2
src/config/index.ts

@@ -13,11 +13,11 @@ const mapEnvVersion = {
    */
   // develop: 'http://192.168.1.166:8080', // 张
   // develop: 'http://192.168.1.101:8080',
-  // develop: 'http://192.168.0.157:8080',
+  develop: 'http://192.168.0.157:8080',
   // develop: 'http://192.168.1.253:8080',
   // develop: 'http://192.168.1.89:8080', // 田
   // develop: 'http://47.109.84.152:8081',
-  develop: 'https://smqjh.api.zswlgz.com',
+  // develop: 'https://smqjh.api.zswlgz.com',
   /**
    * 体验版
    */

+ 3 - 6
src/subPack-xsb/confirmOrder/index.vue

@@ -22,9 +22,6 @@ const offsetPoints = computed(() => {
   }
   return Number(unref(orderInfo)?.offsetPoints)
 })
-const totalMoney = computed(() => {
-  return unref(offsetPoints) > (Number(unref(orderInfo)?.price) * 100) ? '0.00' : (((Number(unref(orderInfo)?.price) * 1000) + (Number(unref(orderInfo)?.transfee) * 1000)) - unref(offsetPoints)) / 1000
-})
 const deliveryType = ref(1)
 onLoad((options: any) => {
   console.log(options.data)
@@ -61,7 +58,7 @@ async function handlePay() {
       }
     })
 
-    const orderNumber = await getOrderPayMent('XSB', deliveryType.value, Number(orderInfo.value?.skuList[0].shopId), orderItemList, unref(remarks))
+    const orderNumber = await getOrderPayMent(orderInfo.value.transfee, 'XSB', deliveryType.value, Number(orderInfo.value?.skuList[0].shopId), orderItemList, unref(remarks))
     const res = await handleCommonPayMent(orderNumber)
     await clearCart(orderInfo.value.skuList)
     if (res.payType !== 1) {
@@ -176,7 +173,7 @@ async function handlePay() {
           总计:
         </view>
         <view class="text-#FF4D3A font-semibold">
-          ¥ {{ totalMoney }}
+          ¥ {{ orderInfo?.totalPrice }}
         </view>
       </view>
     </view>
@@ -194,7 +191,7 @@ async function handlePay() {
           <view class="font-semibold10 flex items-baseline text-36rpx">
             <text class="text-24rpx">
-            </text> {{ totalMoney }}
+            </text> {{ orderInfo?.totalPrice }}
           </view>
           <view class="ml20rpx text-22rpx">
             共减¥{{ offsetPoints / 100 }}

+ 2 - 2
src/subPack-xsb/utils/confirm-order.ts

@@ -25,7 +25,7 @@ const { selectedAddress, userInfo } = storeToRefs(useUserStore())
  * @param orderItemList
  * @returns 下单获取待支付订单号
  */
-export function getOrderPayMent(businessType: string, dvyType: number, shopId: number, orderItemList: {
+export function getOrderPayMent(freightFee: number, businessType: string, dvyType: number, shopId: number, orderItemList: {
   prodCount?: number
   skuId?: number
 }[], remarks?: string): Promise<string> {
@@ -41,7 +41,7 @@ export function getOrderPayMent(businessType: string, dvyType: number, shopId: n
         businessType,
         addressId: selectedAddress.value.id,
         dvyType,
-        freightAmount: Number(userInfo.value.freightFee),
+        freightAmount: freightFee,
         shopId,
         orderItemList,
         remarks,