|
|
@@ -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;
|