瀏覽代碼

商家小程序增加微信支付

calm 2 天之前
父節點
當前提交
e8e10c12f2

+ 5 - 1
api/order.js

@@ -226,6 +226,10 @@ export function orderConfirm(
 export function getCouponsOrderPrice(preOrderNo) {
   return request.get(`coupons/order/${preOrderNo}`);
 }
+// 根据用户和使用位置查询可用优惠券
+export function getUserAvailableCoupons(data) {
+  return request.get("coupons/usable/byScene", data);
+}
 
 /**
  * 订单创建
@@ -277,7 +281,7 @@ export function wechatOrderPay(data) {
  * @param object data
  */
 export function wechatQueryPayResult(data) {
-  return request.get("pay/queryPayResult?orderNo=" + data);
+  return request.get("pay/queryPayResult", data);
 }
 
 /**

+ 153 - 133
components/addressWindow/index.vue

@@ -1,45 +1,58 @@
 <template>
-	<view>
-		<view class="address-window" :class="address.address == true ? 'on' : ''">
-			<view class='title'>
-				<view class=""></view>
-				<view class="">选择地址</view>
-				<image @tap='close' src="/static/images/shop/close@2x.png" mode=""></image>
-			</view>
-			
-			<view class='list'>
-				<view class='item' :class='active == index ? "active" : ""'
-					v-for="(item, index) in addressList" @tap='tapAddress(index, item.id)' :key='index'>
-					<view class='address'>
-						<view class='address-t'><text>{{ item.province }}{{ item.city }}{{ item.district }}{{ item.detail }}</text><view v-if="item.isDefault" class="default">默认</view></view>
-						<view class='name'>{{ item.realName }}<text class='phone'>{{
-							item.phone }}</text></view>
-						
-					</view>
-					
-				</view>
-			</view>
-			<!-- 无地址 -->
-			<view class='pictrue' v-if="!is_loading && !addressList.length">
-				<image src='/static/images/noAddress.png'></image>
-			</view>
-			<view class="addressBnt-btn">
-				<view class='addressBnt' @tap='goAddressPages'>添加地址</view>
-			</view>
-			
-		</view>
-		<view class='mask' catchtouchmove="true" :hidden='address.address == false' @tap='close'></view>
-	</view>
+  <view>
+    <view class="address-window" :class="address.address == true ? 'on' : ''">
+      <view class="title">
+        <view class=""></view>
+        <view class="">选择地址</view>
+        <image
+          @tap="close"
+          src="/static/images/shop/close@2x.png"
+          mode=""
+        ></image>
+      </view>
+
+      <view class="list">
+        <view
+          class="item"
+          :class="active == index ? 'active' : ''"
+          v-for="(item, index) in addressList"
+          @tap="tapAddress(index, item.id)"
+          :key="index"
+        >
+          <view class="address">
+            <view class="address-t"
+              ><text
+                >{{ item.province }}{{ item.city }}{{ item.district
+                }}{{ item.detail }}</text
+              ><view v-if="item.isDefault" class="default">默认</view></view
+            >
+            <view class="name"
+              >{{ item.realName
+              }}<text class="phone">{{ item.phone }}</text></view
+            >
+          </view>
+        </view>
+      </view>
+      <!-- 无地址 -->
+      <view class="pictrue" v-if="!is_loading && !addressList.length">
+        <image src="/static/images/noAddress.png"></image>
+      </view>
+      <view class="addressBnt-btn">
+        <view class="addressBnt" @tap="goAddressPages">添加地址</view>
+      </view>
+    </view>
+    <!-- <view class='mask' catchtouchmove="true" :hidden='address.address == false' @tap='close'></view> -->
+  </view>
 </template>
 
 <script setup>
-import { ref } from 'vue';
-import { getAddressList } from '@/api/user.js';
+import { ref } from "vue";
+import { getAddressList } from "@/api/user.js";
 
 const props = defineProps({
   pagesUrl: {
     type: String,
-    default: '',
+    default: "",
   },
   address: {
     type: Object,
@@ -51,10 +64,15 @@ const props = defineProps({
   isLog: {
     type: Boolean,
     default: false,
-  }
+  },
 });
 
-const emit = defineEmits(['OnChangeAddress', 'changeClose', 'changeTextareaStatus', 'OnDefaultAddress']);
+const emit = defineEmits([
+  "OnChangeAddress",
+  "changeClose",
+  "changeTextareaStatus",
+  "OnDefaultAddress",
+]);
 
 const active = ref(0);
 const is_loading = ref(true);
@@ -62,7 +80,7 @@ const addressList = ref([]);
 
 // 对外暴露获取地址的方法
 defineExpose({
-	fetchAddressList
+  fetchAddressList,
 });
 
 function tapAddress(e, addressid) {
@@ -73,43 +91,45 @@ function tapAddress(e, addressid) {
       a = addressList.value[i];
     }
   }
-  emit('OnChangeAddress', a);
+  emit("OnChangeAddress", a);
 }
 
 function close() {
-  emit('changeClose');
-  emit('changeTextareaStatus');
+  emit("changeClose");
+  emit("changeTextareaStatus");
 }
 
 function goAddressPages() {
-  emit('changeClose');
-  emit('changeTextareaStatus');
+  emit("changeClose");
+  emit("changeTextareaStatus");
   uni.navigateTo({
-    url: props.pagesUrl
+    url: props.pagesUrl,
   });
 }
 
 function fetchAddressList() {
   getAddressList({
     page: 1,
-    limit: 5
-  }).then(res => {
-    let list = res.data.list;
-    addressList.value = list;
-    is_loading.value = false;
-    let defaultAddress = {};
-    // 处理默认选中项
-    if (!props.address.addressId) return;
-    for (let i = 0, leng = list.length; i < leng; i++) {
-      if (list[i].id == props.address.addressId) {
-        active.value = i;
-        defaultAddress = list[i];
+    limit: 5,
+  })
+    .then((res) => {
+      let list = res.data.list;
+      addressList.value = list;
+      is_loading.value = false;
+      let defaultAddress = {};
+      // 处理默认选中项
+      if (!props.address.addressId) return;
+      for (let i = 0, leng = list.length; i < leng; i++) {
+        if (list[i].id == props.address.addressId) {
+          active.value = i;
+          defaultAddress = list[i];
+        }
       }
-    }
-    emit('OnDefaultAddress', defaultAddress);
-  }).catch((error) => {
-		console.error('fetchAddressList', error)
-	})
+      emit("OnDefaultAddress", defaultAddress);
+    })
+    .catch((error) => {
+      console.error("fetchAddressList", error);
+    });
 }
 
 // 监听 address.address 打开时刷新列表
@@ -118,118 +138,118 @@ function fetchAddressList() {
 //     fetchAddressListFn();
 //   }
 // }, { immediate: true });
-
 </script>
 
 <style scoped lang="scss">
 .address-window {
-	background: #FFFFFF;
-	border-radius: 40rpx 40rpx 0 0;
-	position: fixed;
-	bottom: 0;
-	left: 0;
-	width: 100%;
-	z-index: 101;
-	transform: translate3d(0, 100%, 0);
-	transition: all .3s cubic-bezier(.25, .5, .5, .9);
+  background: #ffffff;
+  border-radius: 40rpx 40rpx 0 0;
+  position: fixed;
+  bottom: 0;
+  left: 0;
+  width: 100%;
+  z-index: 101;
+  transform: translate3d(0, 100%, 0);
+  transition: all 0.3s cubic-bezier(0.25, 0.5, 0.5, 0.9);
 }
 
 .address-window.on {
-	transform: translate3d(0, 0, 0);
+  transform: translate3d(0, 0, 0);
 }
 
 .address-window .title {
-	color: #333333;
-	font-size: 36rpx;
-	font-weight: bold;
-	height: 100rpx;
-	padding: 0 20rpx;
-	display: flex;
-	align-items: center;
-	justify-content: space-between;
-	image,view:first-child{
-		width: 32rpx;
-		height: 32rpx;
-	}
+  color: #333333;
+  font-size: 36rpx;
+  font-weight: bold;
+  height: 100rpx;
+  padding: 0 20rpx;
+  display: flex;
+  align-items: center;
+  justify-content: space-between;
+  image,
+  view:first-child {
+    width: 32rpx;
+    height: 32rpx;
+  }
 }
 
 .address-window .list {
-	padding: 0 32rpx;
+  padding: 0 32rpx;
 }
 .address-window .list .item {
-	display: flex;
-	align-items: center;
-	justify-content: space-between;
-	background: #F9F7F0;
-	border-radius: 16rpx;
-	border-bottom: 2px solid transparent;
-	padding: 16rpx;
-	margin-bottom: 24rpx;
-	&:last-child {
-		margin-bottom: 0;
-	}
+  display: flex;
+  align-items: center;
+  justify-content: space-between;
+  background: #f9f7f0;
+  border-radius: 16rpx;
+  border-bottom: 2px solid transparent;
+  padding: 16rpx;
+  margin-bottom: 24rpx;
+  &:last-child {
+    margin-bottom: 0;
+  }
 }
 .address-window .list .active {
-	background: rgba(248,192,8,0.1);
-	border: 2rpx solid #F8C008;
+  background: rgba(248, 192, 8, 0.1);
+  border: 2rpx solid #f8c008;
 }
 .address-window .list .item .address {
-	flex: 1;
-	margin-right: 16rpx;
+  flex: 1;
+  margin-right: 16rpx;
 }
 .default {
-	width: 64rpx;
-	height: 40rpx;
-	color: #333333;
-	font-size: 24rpx;
-	background: #F8C008;
-	border-radius: 8rpx;
-	text-align: center;
-	line-height: 40rpx;
-	flex-shrink: 0;
+  width: 64rpx;
+  height: 40rpx;
+  color: #333333;
+  font-size: 24rpx;
+  background: #f8c008;
+  border-radius: 8rpx;
+  text-align: center;
+  line-height: 40rpx;
+  flex-shrink: 0;
 }
 
 .address-window .list .item .address .name {
-	font-size: 28rpx;
-	
-	color: #666666;
-	margin-top: 16rpx;
+  font-size: 28rpx;
+
+  color: #666666;
+  margin-top: 16rpx;
 }
 
 .address-window .list .item .address .name .phone {
-	margin-left: 18rpx;
+  margin-left: 18rpx;
 }
 .address-t {
-	font-weight: bold;
-	display: flex;
-	justify-content: space-between;
-	align-items: start;
-	flex-wrap: nowrap;
+  font-weight: bold;
+  display: flex;
+  justify-content: space-between;
+  align-items: start;
+  flex-wrap: nowrap;
 }
 .addressBnt-btn {
-	padding: 22rpx 32rpx;
+  padding: 22rpx 32rpx;
 }
 
 .address-window .addressBnt {
-	font-size: 32rpx;
-	font-weight: bold;
-	color: #333333;
-	text-align: center;
-	
-	line-height: 88rpx;
-	
-	background: #F8C008;
-	border-radius: 16rpx;
+  font-size: 32rpx;
+  font-weight: bold;
+  color: #333333;
+  text-align: center;
+
+  line-height: 88rpx;
+
+  background: #f8c008;
+  border-radius: 16rpx;
 }
 
 .address-window .pictrue {
-	width: 414rpx;
-	height: 336rpx;
-	margin: 0 auto;
+  width: 414rpx;
+  height: 336rpx;
+  margin: 0 auto;
 }
 
 .address-window .pictrue image {
-	width: 100%;
-	height: 100%;
+  width: 100%;
+  height: 100%;
 }
 </style>

+ 2 - 2
components/payment/WechatPayment.vue

@@ -74,7 +74,7 @@ const createUniPay = async (options) => {
       openId: options.openId,
       orderNo: options.orderNo,
     });
-
+    // return console.log("payRes", payRes);
     // 订单创建成功,触发回调
     callbacks.value.onUniPayCreate({
       out_trade_no: options.orderNo,
@@ -125,7 +125,7 @@ const confirmPaymentStatus = async () => {
         showPayLoading.value = false;
         paymentInProgress.value = false;
         callbacks.value.onUniPayFail(
-          new Error("支付结果查询超时,请稍后查看订单状态"),
+          new Error("支付结果查询超时,请稍后查看订单状态")
         );
         return;
       }

+ 3 - 3
config/app.js

@@ -1,9 +1,9 @@
 // let domain = "https://www.shuibeibyg.com/front-api"; // 正式环境IP
-let domain = "https://test.shuibeibyg.com/front-api"; // 测试环境IP
+// let domain = "https://test.shuibeibyg.com/front-api"; // 测试环境IP
 // let domain = 'http://192.168.100.199:8081' // 晋守桦IP
 // let domain = 'http://192.168.100.246:8081' // 韩朝龙IP
-// let domain = "http://192.168.3.29:8081"; // 宏广IP
-// let domain = "http://192.168.3.57:8081"; // 张艺IP
+// let domain = "http://192.168.8.29:8081"; // 宏广IP
+let domain = "http://192.168.8.57:8081"; // 张艺IP
 let share = "https://www.shuibeibyg.com";
 
 let imgUrl =

File diff suppressed because it is too large
+ 1341 - 1172
pages/order_details/index.vue


File diff suppressed because it is too large
+ 1651 - 1537
pages/users/order_confirm/index.vue


+ 238 - 233
pages/users/order_confirm/index_bf.vue

@@ -2,24 +2,24 @@
   <view>
     <view class="order-submission">
       <view
-          class="allAddress"
-          :style="store_self_mention ? '' : 'padding-top:10rpx;'"
+        class="allAddress"
+        :style="store_self_mention ? '' : 'padding-top:10rpx;'"
       >
         <view class="nav acea-row">
           <view
-              class="item font-color"
-              :class="shippingType == 0 ? 'on' : 'on2'"
-              @tap="addressType(0)"
-              v-if="store_self_mention"
+            class="item font-color"
+            :class="shippingType == 0 ? 'on' : 'on2'"
+            @tap="addressType(0)"
+            v-if="store_self_mention"
           ></view>
           <!-- <view class="item font-color" :class="shippingType == 1 ? 'on' : 'on2'" @tap="addressType(1)"
 						v-if="store_self_mention"></view> -->
         </view>
         <view
-            class="address acea-row row-between-wrapper"
-            @tap="onAddress"
-            v-if="shippingType == 0"
-            :style="
+          class="address acea-row row-between-wrapper"
+          @tap="onAddress"
+          v-if="shippingType == 0"
+          :style="
             store_self_mention
               ? ''
               : 'border-top-left-radius: 14rpx;border-top-right-radius: 14rpx;'
@@ -27,15 +27,15 @@
         >
           <view class="addressCon" v-if="addressInfo.realName">
             <view class="name"
-            >{{ addressInfo.realName }}
+              >{{ addressInfo.realName }}
               <text class="phone">{{ addressInfo.phone }}</text>
             </view>
             <view class="acea-row">
               <text class="default font-color" v-if="addressInfo.isDefault"
-              >[默认]</text
+                >[默认]</text
               >
               <text class="line2"
-              >{{ addressInfo.province }}{{ addressInfo.city
+                >{{ addressInfo.province }}{{ addressInfo.city
                 }}{{ addressInfo.district }}{{ addressInfo.detail }}</text
               >
             </view>
@@ -46,14 +46,14 @@
           <uni-icons type="right" size="14" color="#333333"></uni-icons>
         </view>
         <view
-            class="address acea-row row-between-wrapper"
-            v-else
-            @tap="showStoreList"
+          class="address acea-row row-between-wrapper"
+          v-else
+          @tap="showStoreList"
         >
           <block v-if="storeList.length > 0">
             <view class="addressCon">
               <view class="name"
-              >{{ system_store.name }}
+                >{{ system_store.name }}
                 <text class="phone">{{ system_store.phone }}</text>
               </view>
               <view class="line1">
@@ -73,19 +73,19 @@
       </view>
       <view class="pad30">
         <orderGoods
-            :mallType="orderInfoVo.mallType"
-            :cartInfo="cartInfo"
-            :orderProNum="orderProNum"
+          :mallType="orderInfoVo.mallType"
+          :cartInfo="cartInfo"
+          :orderProNum="orderProNum"
         ></orderGoods>
         <view class="wrapper borRadius14">
           <view
-              class="item acea-row row-between-wrapper"
-              @tap="couponTap"
-              v-if="orderInfoVo.mallType === 0"
+            class="item acea-row row-between-wrapper"
+            @tap="couponTap"
+            v-if="orderInfoVo.mallType === 0"
           >
             <view>优惠券</view>
             <view class="discount"
-            >{{ couponTitle }}
+              >{{ couponTitle }}
               <uni-icons type="right" size="14" color="#333333"></uni-icons>
             </view>
           </view>
@@ -93,8 +93,8 @@
             <view>快递费用</view>
             <block v-if="orderInfoVo.mallType === 0">
               <view
-                  class="discount"
-                  v-if="
+                class="discount"
+                v-if="
                   parseFloat(orderInfoVo.freightFee) > 0 &&
                   orderInfoVo.mallType === 0
                 "
@@ -108,12 +108,12 @@
           <view class="item" v-if="textareaStatus">
             <view>备注信息</view>
             <textarea
-                v-if="coupon.coupon === false"
-                placeholder-class="placeholder"
-                @input="bindHideKeyboard"
-                value=""
-                name="mark"
-                placeholder="请添加备注(150字以内)"
+              v-if="coupon.coupon === false"
+              placeholder-class="placeholder"
+              @input="bindHideKeyboard"
+              value=""
+              name="mark"
+              placeholder="请添加备注(150字以内)"
             ></textarea>
           </view>
         </view>
@@ -148,16 +148,16 @@
             </view>
             <view class="list">
               <view
-                  v-for="(item, index) in avaliablePayments"
-                  class="payItem acea-row row-middle"
-                  :class="active == index ? 'on' : ''"
-                  @tap="payItem(index)"
-                  :key="index"
+                v-for="(item, index) in avaliablePayments"
+                class="payItem acea-row row-middle"
+                :class="active == index ? 'on' : ''"
+                @tap="payItem(index)"
+                :key="index"
               >
                 <view class="name acea-row row-center-wrapper">
                   <view
-                      class="iconfont animated"
-                      :class="
+                    class="iconfont animated"
+                    :class="
                       item.icon +
                       ' ' +
                       (animated == true && active == index ? 'bounceIn' : '')
@@ -181,16 +181,18 @@
               贝币: {{ Number(orderInfoVo.proTotalFee) || 0 }}
             </view>
           </view>
-		  <view
-		      class="item acea-row row-between-wrapper"
-		      v-if="orderInfoVo?.proTotalWeight && orderInfoVo?.proTotalWeight>0"
-		  >
-		    <view>总克重:</view>
-		    <view class="money">{{orderInfoVo.proTotalWeight}} g</view>
-		  </view>
           <view
-              class="item acea-row row-between-wrapper"
-              v-if="orderInfoVo.couponFee > 0"
+            class="item acea-row row-between-wrapper"
+            v-if="
+              orderInfoVo?.proTotalWeight && orderInfoVo?.proTotalWeight > 0
+            "
+          >
+            <view>总克重:</view>
+            <view class="money">{{ orderInfoVo.proTotalWeight }} g</view>
+          </view>
+          <view
+            class="item acea-row row-between-wrapper"
+            v-if="orderInfoVo.couponFee > 0"
           >
             <view>优惠券抵扣:</view>
             <view class="money">-¥{{ orderInfoVo.couponFee }}</view>
@@ -204,39 +206,39 @@
           </view> -->
 
           <view
-              class="item acea-row row-between-wrapper"
-              v-if="orderInfoVo.mallType === 0"
+            class="item acea-row row-between-wrapper"
+            v-if="orderInfoVo.mallType === 0"
           >
             <view>工费:</view>
             <view class="money">+¥{{ orderInfoVo.totalLaborCost }}</view>
           </view>
 
           <view
-              class="item acea-row row-between-wrapper"
-              v-if="
+            class="item acea-row row-between-wrapper"
+            v-if="
               orderInfoVo.mallType === 0 && orderInfoVo?.totalAdditionalAmount
             "
           >
             <view>附加费:</view>
             <view class="money"
-            >+¥{{ orderInfoVo.totalAdditionalAmount }}</view
+              >+¥{{ orderInfoVo.totalAdditionalAmount }}</view
             >
           </view>
 
           <view
-              class="item acea-row row-between-wrapper"
-              v-if="orderInfoVo.freightFee > 0"
+            class="item acea-row row-between-wrapper"
+            v-if="orderInfoVo.freightFee > 0"
           >
             <view>运费:</view>
             <view class="money">+¥{{ orderInfoVo.freightFee }}</view>
           </view>
 
           <view
-              v-if="
+            v-if="
               orderInfoVo.mallType === 0 &&
               Number(orderInfoVo.vipLevelDis) !== 0
             "
-              class="item acea-row row-between-wrapper"
+            class="item acea-row row-between-wrapper"
           >
             <view>会员折扣:</view>
             <view class="money">-¥{{ orderInfoVo.vipLevelDis }}</view>
@@ -260,25 +262,31 @@
       </view>
     </view>
     <couponListWindow
-        :coupon="coupon"
-        @close="closeCouponPopup"
-        :showPopup="showCouponPopup"
-        :openType="openType"
-        @ChangCoupons="ChangCoupons"
-        :orderShow="orderShow"
+      :coupon="coupon"
+      @close="closeCouponPopup"
+      :showPopup="showCouponPopup"
+      :openType="openType"
+      @ChangCoupons="ChangCoupons"
+      :orderShow="orderShow"
     ></couponListWindow>
-	<addressWindow ref="addressWindowRef" @changeTextareaStatus="changeTextareaStatus" :address="address"
-		:pagesUrl="pagesUrl" @OnDefaultAddress="OnDefaultAddress" @OnChangeAddress="OnChangeAddress"
-		@changeClose="changeClose" />
+    <addressWindow
+      ref="addressWindowRef"
+      @changeTextareaStatus="changeTextareaStatus"
+      :address="address"
+      :pagesUrl="pagesUrl"
+      @OnDefaultAddress="OnDefaultAddress"
+      @OnChangeAddress="OnChangeAddress"
+      @changeClose="changeClose"
+    />
 
     <!-- 余额不足modal -->
     <up-modal
-        :showCancelButton="true"
-        :show="showModal"
-        title="余额不足"
-        confirmText="去充值"
-        @cancel="showModal = false"
-        @confirm="modalConfirm"
+      :showCancelButton="true"
+      :show="showModal"
+      title="余额不足"
+      confirmText="去充值"
+      @cancel="showModal = false"
+      @confirm="modalConfirm"
     ></up-modal>
   </view>
 </template>
@@ -376,10 +384,10 @@ const payments = ref([
 
 // 计算属性:过滤出可用的支付方式(只保留payStatus为1的项)
 const avaliablePayments = computed(() => {
-  console.log(payments.value)
+  console.log(payments.value);
   return payments.value.filter((item) => item.payStatus === 1);
 });
-console.log(avaliablePayments)
+console.log(avaliablePayments);
 
 // 响应式变量:当前选中的支付方式(默认余额支付)
 const payType = ref("yue");
@@ -442,16 +450,16 @@ const userSelectPayTypeItem = ref(payments.value[0]);
 
 // 监听 isLogin
 watch(
-    () => appStore.isLogin, // 监听的数据源:全局登录状态
-    (newV) => {
-      // newV是登录状态的新值(true/false)
-      if (newV) {
-        // 若已登录
-        getloadPreOrder(); // 加载预订单信息
-        this.getaddressInfo(); // 获取地址信息(this指向当前组件实例)
-      }
-    },
-    { deep: true } // 深度监听(确保复杂数据类型变化也能触发)
+  () => appStore.isLogin, // 监听的数据源:全局登录状态
+  (newV) => {
+    // newV是登录状态的新值(true/false)
+    if (newV) {
+      // 若已登录
+      getloadPreOrder(); // 加载预订单信息
+      this.getaddressInfo(); // 获取地址信息(this指向当前组件实例)
+    }
+  },
+  { deep: true } // 深度监听(确保复杂数据类型变化也能触发)
 );
 // 商品总价
 
@@ -524,70 +532,70 @@ const getloadPreOrder = () => {
 
   // 调用加载预订单API,传入预订单号
   loadPreOrderApi(preOrderNo.value)
-      .then((res) => {
-        metalTypeMap[1].balance = res.data.auBalance || 0;
-        metalTypeMap[2].balance = res.data.ptBalance || 0;
-        metalTypeMap[3].balance = res.data.agBalance || 0;
-        metalType.value = res.data.metalType;
-        // 接口成功回调
-        let orderInfoVoData = res.data.orderInfoVo; // 订单基本信息
-        orderInfoVo.value = orderInfoVoData; // 保存订单信息
-        cartInfo.value = orderInfoVoData.orderDetailList; // 保存商品列表
-
-        orderProNum.value = orderInfoVoData.orderProNum; // 保存商品总数
-
-        // 设置地址ID(优先用参数传入的,没有则用订单默认的)
-        address.value.addressId = addressId.value
-            ? addressId.value
-            : orderInfoVoData.addressId;
-
-        // 判断是否支持门店自提(根据接口返回和全局状态)
-        store_self_mention.value =
-            res.data.storeSelfMention == "true" && // 接口返回支持自提
-            appStore.productTypeComputed === "normal" // 全局状态为普通商品
-                ? true
-                : false;
-
-        // 根据商城类型设置是否使用积分(mallType=1时默认使用)
-        useIntegral.value = orderInfoVo.value.mallType === 1;
-        // 根据商城类型设置默认支付方式(mallType=1时用贝币支付)
-        // payType.value = orderInfoVo.value.mallType === 1 ? "yue" : "alipay";
-        payType.value = "yue";
-
-        // 动态更新支付方式状态(根据接口返回的配置)
-        payments.value.forEach((item) => {
-          if (item.name === "余额支付") {
-            // 余额支付:显示可用余额,状态由接口返回的yuePayStatus决定
-            item.title = "可用余额: " + orderInfoVoData.userBalance;
-            item.payStatus = parseInt(res.data.yuePayStatus) === 1 ? 1 : 2;
-          } else if (item.payType === "weixin") {
-            // 微信支付:状态由接口返回的payWeixinOpen决定
-            item.payStatus = parseInt(res.data.payWeixinOpen) === 1 ? 1 : 0;
-          }
-
-          // 贝币支付:仅在mallType=1时可用
-          if (orderInfoVo.value.mallType === 1) {
-            item.title = "可用贝币: " + orderInfoVoData.userIntegral;
-            item.payStatus = item.name === "贝币支付" ? 1 : 0;
-          } else {
-            item.payStatus = item.name === "贝币支付" ? 0 : 1;
-          }
-        });
+    .then((res) => {
+      metalTypeMap[1].balance = res.data.auBalance || 0;
+      metalTypeMap[2].balance = res.data.ptBalance || 0;
+      metalTypeMap[3].balance = res.data.agBalance || 0;
+      metalType.value = res.data.metalType;
+      // 接口成功回调
+      let orderInfoVoData = res.data.orderInfoVo; // 订单基本信息
+      orderInfoVo.value = orderInfoVoData; // 保存订单信息
+      cartInfo.value = orderInfoVoData.orderDetailList; // 保存商品列表
+
+      orderProNum.value = orderInfoVoData.orderProNum; // 保存商品总数
+
+      // 设置地址ID(优先用参数传入的,没有则用订单默认的)
+      address.value.addressId = addressId.value
+        ? addressId.value
+        : orderInfoVoData.addressId;
+
+      // 判断是否支持门店自提(根据接口返回和全局状态)
+      store_self_mention.value =
+        res.data.storeSelfMention == "true" && // 接口返回支持自提
+        appStore.productTypeComputed === "normal" // 全局状态为普通商品
+          ? true
+          : false;
+
+      // 根据商城类型设置是否使用积分(mallType=1时默认使用)
+      useIntegral.value = orderInfoVo.value.mallType === 1;
+      // 根据商城类型设置默认支付方式(mallType=1时用贝币支付)
+      // payType.value = orderInfoVo.value.mallType === 1 ? "yue" : "alipay";
+      payType.value = "yue";
+
+      // 动态更新支付方式状态(根据接口返回的配置)
+      payments.value.forEach((item) => {
+        if (item.name === "余额支付") {
+          // 余额支付:显示可用余额,状态由接口返回的yuePayStatus决定
+          item.title = "可用余额: " + orderInfoVoData.userBalance;
+          item.payStatus = parseInt(res.data.yuePayStatus) === 1 ? 1 : 2;
+        } else if (item.payType === "weixin") {
+          // 微信支付:状态由接口返回的payWeixinOpen决定
+          item.payStatus = parseInt(res.data.payWeixinOpen) === 1 ? 1 : 0;
+        }
 
-        if (addressId.value) {
-          computedPrice();
+        // 贝币支付:仅在mallType=1时可用
+        if (orderInfoVo.value.mallType === 1) {
+          item.title = "可用贝币: " + orderInfoVoData.userIntegral;
+          item.payStatus = item.name === "贝币支付" ? 1 : 0;
+        } else {
+          item.payStatus = item.name === "贝币支付" ? 0 : 1;
         }
-        // 调用子页面方法授权后执行获取地址列表
-        nextTick(() => {
-          addressWindowRef.value.fetchAddressList();
-        });
-      })
-      .catch((err) => {
-        // 接口失败回调
-        console.error(err); // 打印错误
-        uni.navigateTo({ url: "/pages/order_list/index" }); // 跳转到订单列表
-        Toast({ title: err }); // 提示错误信息
       });
+
+      if (addressId.value) {
+        computedPrice();
+      }
+      // 调用子页面方法授权后执行获取地址列表
+      nextTick(() => {
+        addressWindowRef.value.fetchAddressList();
+      });
+    })
+    .catch((err) => {
+      // 接口失败回调
+      console.error(err); // 打印错误
+      uni.navigateTo({ url: "/pages/order_list/index" }); // 跳转到订单列表
+      Toast({ title: err }); // 提示错误信息
+    });
 };
 // 授权回调事件(用户授权后触发,预留)
 const onLoadFun = () => {
@@ -610,16 +618,16 @@ const getList = () => {
   };
   // 调用门店列表API
   storeListApi(data)
-      .then((res) => {
-        // 成功回调
-        let list = res.data.list || []; // 门店列表
-        storeList.value = list; // 保存门店列表
-        system_store.value = list[0]; // 默认选中第一个门店
-      })
-      .catch((err) => {
-        // 失败回调
-        Toast({ title: err }); // 提示错误
-      });
+    .then((res) => {
+      // 成功回调
+      let list = res.data.list || []; // 门店列表
+      storeList.value = list; // 保存门店列表
+      system_store.value = list[0]; // 默认选中第一个门店
+    })
+    .catch((err) => {
+      // 失败回调
+      Toast({ title: err }); // 提示错误
+    });
 };
 
 // 关闭地址弹窗
@@ -649,24 +657,24 @@ function computedPrice() {
     preOrderNo: preOrderNo.value, // 预订单号
     goldNum: appStore.userInfo.goldBalance, // 余料数量
   })
-      .then((res) => {
-        // 成功回调
-        let data = res.data; // 计算后的价格数据
-        // 更新订单费用信息
-        orderInfoVo.value.couponFee = data.couponFee; // 优惠券抵扣
-        orderInfoVo.value.userIntegral = data.surplusIntegral; // 剩余积分
-        orderInfoVo.value.deductionPrice = data.deductionPrice; // 积分抵扣金额
-        orderInfoVo.value.freightFee = data.freightFee; // 运费
-        orderInfoVo.value.payFee = data.payFee; // 实付金额
-        orderInfoVo.value.proTotalFee = data.proTotalFee; // 商品总价
-        orderInfoVo.value.useIntegral = data.useIntegral; // 是否使用积分
-        orderInfoVo.value.usedIntegral = data.usedIntegral; // 已用积分
-        orderInfoVo.value.surplusIntegral = data.surplusIntegral; // 剩余积分
-      })
-      .catch((err) => {
-        // 失败回调
-        Toast({ title: err }); // 提示错误
-      });
+    .then((res) => {
+      // 成功回调
+      let data = res.data; // 计算后的价格数据
+      // 更新订单费用信息
+      orderInfoVo.value.couponFee = data.couponFee; // 优惠券抵扣
+      orderInfoVo.value.userIntegral = data.surplusIntegral; // 剩余积分
+      orderInfoVo.value.deductionPrice = data.deductionPrice; // 积分抵扣金额
+      orderInfoVo.value.freightFee = data.freightFee; // 运费
+      orderInfoVo.value.payFee = data.payFee; // 实付金额
+      orderInfoVo.value.proTotalFee = data.proTotalFee; // 商品总价
+      orderInfoVo.value.useIntegral = data.useIntegral; // 是否使用积分
+      orderInfoVo.value.usedIntegral = data.usedIntegral; // 已用积分
+      orderInfoVo.value.surplusIntegral = data.surplusIntegral; // 剩余积分
+    })
+    .catch((err) => {
+      // 失败回调
+      Toast({ title: err }); // 提示错误
+    });
 }
 
 // 切换配送方式(快递/自提)
@@ -710,9 +718,9 @@ const ChangCoupons = (e) => {
   // this.usableCoupon = e
   // this.coupon.coupon = false
   let index = e,
-      list = coupon.value.list,
-      couponTitleValue = "请选择",
-      couponIdValue = 0;
+    list = coupon.value.list,
+    couponTitleValue = "请选择",
+    couponIdValue = 0;
   console.log("list", list);
   for (let i = 0, len = list.length; i < len; i++) {
     if (i != index) {
@@ -836,7 +844,7 @@ const onAddress = () => {
   address.value.address = true; // 显示地址弹窗
   // 设置地址页面跳转链接(携带预订单号)
   pagesUrl.value =
-      "/pages/users/user_address_list/index?preOrderNo=" + preOrderNo.value;
+    "/pages/users/user_address_list/index?preOrderNo=" + preOrderNo.value;
 };
 
 // 联系人输入事件(保存联系人)
@@ -853,17 +861,17 @@ const phone = (e) => {
 const payment = (data) => {
   // 调用创建订单API
   orderCreate(data)
-      .then((res) => {
-        // 订单创建成功
-        // 调用支付流程,传入订单号和成功提示
-        getOrderPay(res.data.orderNo, "支付成功");
-      })
-      .catch((err) => {
-        // 订单创建失败
-        console.error("payment error", err); // 打印错误
-        uni.hideLoading(); // 隐藏加载中
-        Toast({ title: err }); // 提示错误
-      });
+    .then((res) => {
+      // 订单创建成功
+      // 调用支付流程,传入订单号和成功提示
+      getOrderPay(res.data.orderNo, "支付成功");
+    })
+    .catch((err) => {
+      // 订单创建失败
+      console.error("payment error", err); // 打印错误
+      uni.hideLoading(); // 隐藏加载中
+      Toast({ title: err }); // 提示错误
+    });
 };
 
 // 处理支付流程(根据支付类型发起支付并处理结果)
@@ -905,23 +913,23 @@ const getOrderPay = async (orderNo, message) => {
           console.log("alipayPaymentResult", res);
           // 提示成功并跳转到结果页
           return Toast(
-              { title: paymentConfig.PAYMENT_STATUS.SUCCESS, icon: "success" },
-              { tab: 4, url: goPages }
+            { title: paymentConfig.PAYMENT_STATUS.SUCCESS, icon: "success" },
+            { tab: 4, url: goPages }
           );
         } else if (result.status === paymentConfig.PAYMENT_STATUS.FAIL) {
           // 支付失败:提示并跳转
           return Toast(
-              { title: paymentConfig.PAYMENT_STATUS.FAIL },
-              { tab: 5, url: `${goPages}&msg=${failMsg}` }
+            { title: paymentConfig.PAYMENT_STATUS.FAIL },
+            { tab: 5, url: `${goPages}&msg=${failMsg}` }
           );
         } else if (result.status === paymentConfig.PAYMENT_STATUS.CANCEL) {
           // 支付取消:提示并跳转
           return Toast(
-              { title: paymentConfig.PAYMENT_STATUS.CANCEL },
-              {
-                tab: 5,
-                url: `${goPages}&msg=${paymentConfig.PAYMENT_STATUS.CANCEL}`,
-              }
+            { title: paymentConfig.PAYMENT_STATUS.CANCEL },
+            {
+              tab: 5,
+              url: `${goPages}&msg=${paymentConfig.PAYMENT_STATUS.CANCEL}`,
+            }
           );
         }
         break;
@@ -929,8 +937,8 @@ const getOrderPay = async (orderNo, message) => {
         // 余额支付:直接提示成功并跳转
         console.log("余额支付");
         return Toast(
-            { title: message },
-            { tab: 5, url: goPages + "&status=1" }
+          { title: message },
+          { tab: 5, url: goPages + "&status=1" }
         );
         break;
       case "weixinApp":
@@ -939,7 +947,7 @@ const getOrderPay = async (orderNo, message) => {
           orderInfo: res.data.prepayWithRequestPaymentResponse,
         });
         let wxPayFailMsg =
-            wxPayResult?.message || paymentConfig.PAYMENT_STATUS.FAIL;
+          wxPayResult?.message || paymentConfig.PAYMENT_STATUS.FAIL;
         if (wxPayResult.status === paymentConfig.PAYMENT_STATUS.SUCCESS) {
           // 查询后端支付状态接口
           let params = {
@@ -948,21 +956,21 @@ const getOrderPay = async (orderNo, message) => {
           };
           let res = await alipayPaymentResult(params);
           return Toast(
-              { title: paymentConfig.PAYMENT_STATUS.SUCCESS, icon: "success" },
-              { tab: 4, url: goPages }
+            { title: paymentConfig.PAYMENT_STATUS.SUCCESS, icon: "success" },
+            { tab: 4, url: goPages }
           );
         } else if (wxPayResult.status === paymentConfig.PAYMENT_STATUS.FAIL) {
           return Toast(
-              { title: paymentConfig.PAYMENT_STATUS.FAIL },
-              { tab: 5, url: `${goPages}&msg=${wxPayFailMsg}` }
+            { title: paymentConfig.PAYMENT_STATUS.FAIL },
+            { tab: 5, url: `${goPages}&msg=${wxPayFailMsg}` }
           );
         } else if (wxPayResult.status === paymentConfig.PAYMENT_STATUS.CANCEL) {
           return Toast(
-              { title: paymentConfig.PAYMENT_STATUS.CANCEL },
-              {
-                tab: 5,
-                url: `${goPages}&msg=${paymentConfig.PAYMENT_STATUS.CANCEL}`,
-              }
+            { title: paymentConfig.PAYMENT_STATUS.CANCEL },
+            {
+              tab: 5,
+              url: `${goPages}&msg=${paymentConfig.PAYMENT_STATUS.CANCEL}`,
+            }
           );
         }
         break;
@@ -992,7 +1000,7 @@ const getOrderPay = async (orderNo, message) => {
 function modalConfirm() {
   showModal.value = false;
   const webviewPageUrl = `/pages/webview/index?path=/pages/users/vault/rechargeRmb`;
-  
+
   uni.navigateTo({
     url: webviewPageUrl,
     fail: (err) => {
@@ -1027,8 +1035,6 @@ const SubOrder = async (e) => {
     const channels = await getAvailableChannels();
     if (payType.value === "alipay" && !channels.includes("alipay")) {
       return Toast({ title: "设备不支持支付宝支付" });
-    } else if (payType.value === "weixin" && !channels.includes("wxpay")) {
-      return Toast({ title: "设备不支持微信支付" });
     }
   } catch (error) {
     console.error("获取支付渠道失败", error);
@@ -1056,15 +1062,15 @@ const SubOrder = async (e) => {
 
   // 验证:贝币支付时余额是否充足
   if (
-      orderInfoVo.value.mallType === 1 &&
-      Number(orderInfoVo.value.proTotalFee) > orderInfoVo.value.userIntegral
+    orderInfoVo.value.mallType === 1 &&
+    Number(orderInfoVo.value.proTotalFee) > orderInfoVo.value.userIntegral
   ) {
     return Toast({ title: "贝币余额不足!" });
   }
   // 验证:余额支付时余额是否充足
   else if (
-      data.payType == "yue" &&
-      parseFloat(appStore.$userInfo.nowMoney) <
+    data.payType == "yue" &&
+    parseFloat(appStore.$userInfo.nowMoney) <
       parseFloat(orderInfoVo.value.payFee)
   ) {
     // 余额不足
@@ -1072,22 +1078,21 @@ const SubOrder = async (e) => {
     return;
   }
   uni.showModal({
-  	title: "提示",
-	content: "确认支付吗",
-	success: res=>{
-		console.log(res);
-		if(res.confirm){
-			uni.showLoading({
-			  title: "订单支付中",
-			});
-			// 发起支付
-			payment(data);
-		}else{
-			return
-		}
-	},
-  })
-  
+    title: "提示",
+    content: "确认支付吗",
+    success: (res) => {
+      console.log(res);
+      if (res.confirm) {
+        uni.showLoading({
+          title: "订单支付中",
+        });
+        // 发起支付
+        payment(data);
+      } else {
+        return;
+      }
+    },
+  });
 };
 </script>
 
@@ -1416,7 +1421,7 @@ const SubOrder = async (e) => {
     left: 0;
 
     .settlement {
-		font-weight: bold;
+      font-weight: bold;
       font-size: 30rpx;
       color: #fff;
       width: 240rpx;