2024-04-28 18:08:57 +08:00
|
|
|
|
<template>
|
2024-06-05 18:45:30 +08:00
|
|
|
|
<view class="">
|
2024-06-18 19:03:33 +08:00
|
|
|
|
<!-- <view class="m-card m-address">
|
2024-06-12 13:55:17 +08:00
|
|
|
|
<view class="address-info" @click="showAddress = true" v-if='orderInfo.shipping_type == 1'>
|
2024-06-05 18:45:30 +08:00
|
|
|
|
<view class="top">
|
|
|
|
|
<up-icon name="account"></up-icon>
|
2024-06-12 13:55:17 +08:00
|
|
|
|
<view class="t-name">{{ addressInfo.real_name }}</view>
|
|
|
|
|
<view>{{ addressInfo.phone }}</view>
|
2024-06-05 18:45:30 +08:00
|
|
|
|
</view>
|
|
|
|
|
<view class="bottom u-line-2">
|
2024-06-12 13:55:17 +08:00
|
|
|
|
{{ addressInfo.detail }}
|
2024-06-05 18:45:30 +08:00
|
|
|
|
</view>
|
|
|
|
|
</view>
|
2024-06-11 15:12:49 +08:00
|
|
|
|
<view class="address-info" v-else>
|
|
|
|
|
<view class="top">
|
2024-06-12 13:55:17 +08:00
|
|
|
|
{{ STORE_INFO.name }}
|
2024-06-11 15:12:49 +08:00
|
|
|
|
</view>
|
|
|
|
|
<view class="bottom u-line-2">
|
2024-06-12 13:55:17 +08:00
|
|
|
|
{{ STORE_INFO.detailed_address }}
|
2024-06-11 15:12:49 +08:00
|
|
|
|
</view>
|
|
|
|
|
</view>
|
2024-06-08 15:27:58 +08:00
|
|
|
|
<view class="address-btn item-center">
|
|
|
|
|
<view class='ship-type' style="">
|
2024-06-12 13:55:17 +08:00
|
|
|
|
<view class="ship-type-item" :class='{ actShipItem: orderInfo.shipping_type == 2 }'
|
|
|
|
|
@click='orderInfo.shipping_type = 2'>
|
2024-06-08 15:27:58 +08:00
|
|
|
|
自提
|
|
|
|
|
</view>
|
2024-06-12 13:55:17 +08:00
|
|
|
|
<view class="ship-type-item" @click='orderInfo.shipping_type = 1'
|
|
|
|
|
:class='{ actShipItem: orderInfo.shipping_type == 1 }' v-if='orderInfo.default_delivery == 1'>
|
2024-06-08 15:27:58 +08:00
|
|
|
|
配送
|
|
|
|
|
</view>
|
|
|
|
|
</view>
|
2024-06-05 18:45:30 +08:00
|
|
|
|
</view>
|
2024-06-18 19:03:33 +08:00
|
|
|
|
</view> -->
|
2024-06-12 13:55:17 +08:00
|
|
|
|
<view class="m-card m-good" v-for="(item, index) in cartList" :key="index">
|
2024-06-05 18:45:30 +08:00
|
|
|
|
<view class="image">
|
|
|
|
|
<up-image width="160rpx" height="160rpx" :src="item.imgs"></up-image>
|
|
|
|
|
</view>
|
|
|
|
|
<view class="body-content">
|
|
|
|
|
<view>
|
|
|
|
|
<view class="title">
|
2024-06-12 13:55:17 +08:00
|
|
|
|
<view>{{ item.name }}</view>
|
|
|
|
|
<view>¥{{ item.price }}</view>
|
2024-06-05 18:45:30 +08:00
|
|
|
|
</view>
|
|
|
|
|
<view class="tips">
|
2024-06-12 13:55:17 +08:00
|
|
|
|
<view>{{ item.unit_name }}</view>
|
|
|
|
|
<view>x{{ item.cart_num }}</view>
|
2024-06-05 18:45:30 +08:00
|
|
|
|
</view>
|
|
|
|
|
</view>
|
|
|
|
|
<view class="time">
|
2024-06-12 13:55:17 +08:00
|
|
|
|
{{ orderInfo.delivery_msg }}
|
2024-06-05 18:45:30 +08:00
|
|
|
|
</view>
|
|
|
|
|
</view>
|
|
|
|
|
</view>
|
|
|
|
|
<view class="m-card good-info">
|
|
|
|
|
<view class="head-title">价格明细</view>
|
|
|
|
|
<view class="row">
|
2024-06-12 13:55:17 +08:00
|
|
|
|
<view>商品总价 <text>共计{{ cartList.length }}款商品</text></view>
|
2024-06-08 17:04:53 +08:00
|
|
|
|
<view>
|
2024-06-12 13:55:17 +08:00
|
|
|
|
<text>¥</text>{{ c_price(orderInfo.total_price, 0) }}<text>.{{ c_price(orderInfo.total_price, 1) }}</text>
|
2024-06-05 18:45:30 +08:00
|
|
|
|
</view>
|
|
|
|
|
</view>
|
|
|
|
|
<view class="row">
|
|
|
|
|
<view>运费</view>
|
|
|
|
|
<view><text>¥</text>0<text>.00</text></view>
|
|
|
|
|
</view>
|
2024-06-18 10:15:10 +08:00
|
|
|
|
<view class="row" v-if="[4,5,6].includes(userInfo.user_ship)" style="color: red;">
|
2024-06-17 17:16:09 +08:00
|
|
|
|
<view>优惠减免</view>
|
|
|
|
|
<view>
|
2024-06-22 11:27:11 +08:00
|
|
|
|
<text>-¥</text>{{ c_price(orderInfo.activity_price, 0) }}<text>.{{ c_price(orderInfo.activity_price, 1) }}</text>
|
2024-06-17 17:16:09 +08:00
|
|
|
|
</view>
|
|
|
|
|
</view>
|
2024-06-18 10:15:10 +08:00
|
|
|
|
<view class="row" v-if="userInfo.user_ship==1 ">
|
|
|
|
|
<view>消费返利</view>
|
2024-06-18 19:03:33 +08:00
|
|
|
|
<view>
|
|
|
|
|
<text>¥</text>{{ c_price(orderInfo.activity_price, 0) }}<text>.{{ c_price(orderInfo.activity_price, 1) }}</text>
|
2024-06-08 15:27:58 +08:00
|
|
|
|
</view>
|
2024-06-18 10:15:10 +08:00
|
|
|
|
</view>
|
2024-06-05 18:45:30 +08:00
|
|
|
|
</view>
|
|
|
|
|
<view class="m-card good-info">
|
|
|
|
|
<view class="head-title">支付方式</view>
|
2024-06-06 18:26:47 +08:00
|
|
|
|
<view class="row">
|
|
|
|
|
<view class="icon-text">
|
2024-06-08 15:27:58 +08:00
|
|
|
|
<up-icon name="weixin-circle-fill" color="#20b128" size="22"></up-icon>
|
2024-06-06 18:26:47 +08:00
|
|
|
|
<text style="margin-left: 20rpx;font-size: 26rpx;">微信支付</text>
|
|
|
|
|
</view>
|
2024-06-08 22:50:09 +08:00
|
|
|
|
<view class="icon" @click="onChoosePaytype(7)">
|
|
|
|
|
<image v-if="pay_type == 7" src="@/static/icon/check.png" />
|
2024-06-15 14:15:45 +08:00
|
|
|
|
<image v-if="pay_type != 7 || pay_type == 3 || pay_type == 18 || !pay_type"
|
|
|
|
|
src="@/static/icon/n-check.png" />
|
2024-06-06 18:26:47 +08:00
|
|
|
|
</view>
|
|
|
|
|
</view>
|
|
|
|
|
|
2024-06-19 18:41:03 +08:00
|
|
|
|
<view class="row"
|
|
|
|
|
v-if="userInfo.user_ship == 4 || userInfo.user_ship == 5 || userInfo.user_ship == 6 || userInfo.user_ship == 1">
|
2024-06-21 11:40:32 +08:00
|
|
|
|
<!-- <view class="row"> -->
|
2024-06-08 15:27:58 +08:00
|
|
|
|
<view class="icon-text">
|
|
|
|
|
<image src="@/static/icon/YEZF.png" style="width:40rpx;height: 40rpx;" />
|
2024-06-06 18:26:47 +08:00
|
|
|
|
<text style="margin-left: 20rpx;font-size: 26rpx;">余额支付</text>
|
2024-06-21 11:40:32 +08:00
|
|
|
|
<text style="margin-left: 20rpx;font-size: 22rpx;color: #FFB76D;">( 可用¥{{userInfo.now_money}}
|
|
|
|
|
)</text>
|
2024-06-06 18:26:47 +08:00
|
|
|
|
</view>
|
|
|
|
|
<view class="icon" @click="onChoosePaytype(3)">
|
2024-06-08 13:42:16 +08:00
|
|
|
|
<image v-if="pay_type == 3" src="@/static/icon/check.png" />
|
2024-06-15 14:15:45 +08:00
|
|
|
|
<image v-if="pay_type != 3 || pay_type == 7 || pay_type == 18 || !pay_type"
|
|
|
|
|
src="@/static/icon/n-check.png" />
|
|
|
|
|
</view>
|
|
|
|
|
</view>
|
|
|
|
|
|
|
|
|
|
<view class="row" v-if="userInfo.user_ship == 1">
|
|
|
|
|
<view class="icon-text">
|
|
|
|
|
<image src="@/static/icon/cgkzf.png" style="width:40rpx;height: 40rpx;" />
|
|
|
|
|
<text style="margin-left: 20rpx;font-size: 26rpx;">采购款支付</text>
|
2024-06-21 11:40:32 +08:00
|
|
|
|
<text style="margin-left: 20rpx;font-size: 22rpx;color: #1296DB;">( 可用¥{{userInfo.purchase_funds}}
|
|
|
|
|
)</text>
|
2024-06-15 14:15:45 +08:00
|
|
|
|
</view>
|
|
|
|
|
<view class="icon" @click="onChoosePaytype(18)">
|
|
|
|
|
<image v-if="pay_type == 18" src="@/static/icon/check.png" />
|
|
|
|
|
<image v-if="pay_type != 18 || pay_type == 3 || pay_type == 7 || !pay_type"
|
|
|
|
|
src="@/static/icon/n-check.png" />
|
2024-06-05 18:45:30 +08:00
|
|
|
|
</view>
|
|
|
|
|
</view>
|
|
|
|
|
</view>
|
2024-06-08 15:27:58 +08:00
|
|
|
|
|
|
|
|
|
<view class="m-card order-remark">
|
|
|
|
|
<view class="head-title">
|
|
|
|
|
<text>订单备注</text>
|
|
|
|
|
<text>0/200</text>
|
|
|
|
|
</view>
|
|
|
|
|
<up-textarea style="background-color: #F6F6F6;" v-model="formData.remark" placeholder="暂无备注内容"
|
|
|
|
|
:height="40"></up-textarea>
|
|
|
|
|
</view>
|
2024-06-05 18:45:30 +08:00
|
|
|
|
<view style="width: 100%;height: 200rpx;"></view>
|
2024-06-08 17:32:52 +08:00
|
|
|
|
<view class="fiexd-btn-box" style="z-index: 999;">
|
2024-06-05 18:45:30 +08:00
|
|
|
|
<view class="tips">
|
|
|
|
|
<view style="margin-right: 20rpx;">共 {{ cartList.length }} 款</view>
|
|
|
|
|
<view class="all">
|
|
|
|
|
<text style="color: #000;">合计: </text>
|
|
|
|
|
<text>¥</text>
|
|
|
|
|
<block v-if="orderInfo.total_price">
|
2024-06-12 13:55:17 +08:00
|
|
|
|
<text style="font-size: 32rpx;font-weight: bold;">{{ c_price(orderInfo.pay_price, 0) }}</text>
|
|
|
|
|
<text>.{{ c_price(orderInfo.pay_price, 1) }}</text>
|
2024-06-05 18:45:30 +08:00
|
|
|
|
</block>
|
|
|
|
|
</view>
|
|
|
|
|
</view>
|
|
|
|
|
<view style="width: 200rpx;">
|
|
|
|
|
<up-button color="#20B128" shape="circle" @click="submitOrder" :throttleTime="1000">预付款提交</up-button>
|
|
|
|
|
</view>
|
|
|
|
|
</view>
|
|
|
|
|
|
2024-06-12 13:55:17 +08:00
|
|
|
|
<addressPopup ref="addressRef" :show="showAddress" :list="addressList" @close="showAddress = false"
|
2024-06-05 18:45:30 +08:00
|
|
|
|
@change="changeAddress" />
|
2024-06-12 13:55:17 +08:00
|
|
|
|
<shopListPopupVue ref="shopRef" :show="shopListShow" :list="merchantList" @close="shopListShow = false"
|
2024-06-05 18:45:30 +08:00
|
|
|
|
@change="changeShop" @search="searchShop" />
|
|
|
|
|
<modal title="尚未设置收货地址" content="您还没有添加收货地址,请点击添加" cancleText="添加地址" confirmText="继续支付" :show="toastAddressShow"
|
|
|
|
|
@close="addAddress" @change="goPay" />
|
2024-06-21 14:27:24 +08:00
|
|
|
|
<ZyPasswordboard v-if='passwordBoardVisible' v-model:visible="passwordBoardVisible" v-bind="passwordBoardProps"
|
|
|
|
|
@close='closeKeyBord' />
|
|
|
|
|
<up-modal :show="showModal" title="您还没设置密码" :closeOnClickOverlay="true" zoom confirmText='去设置' showCancelButton
|
|
|
|
|
@close='showModal=false' @cancel='showModal=false' @confirm="navgo('/pagesOrder/setPayPassword/index')"
|
|
|
|
|
confirmColor='#27B52F' cancelText='取消'></up-modal>
|
2024-06-05 18:45:30 +08:00
|
|
|
|
</view>
|
2024-04-28 18:08:57 +08:00
|
|
|
|
</template>
|
|
|
|
|
|
|
|
|
|
<script setup>
|
2024-06-13 18:08:15 +08:00
|
|
|
|
import {
|
|
|
|
|
onLoad,
|
|
|
|
|
onShow
|
|
|
|
|
} from "@dcloudio/uni-app"
|
|
|
|
|
import {
|
|
|
|
|
nextTick,
|
|
|
|
|
ref
|
|
|
|
|
} from "vue"
|
2024-06-15 14:15:45 +08:00
|
|
|
|
import useUserStore from "@/store/user";
|
2024-06-13 18:08:15 +08:00
|
|
|
|
import addressPopup from "@/components/addressPopup.vue";
|
|
|
|
|
import shopListPopupVue from "@/components/shopListPopup.vue";
|
|
|
|
|
import useCartStore from "@/store/cart.js";
|
|
|
|
|
import modal from "@/components/modal.vue";
|
|
|
|
|
import {
|
|
|
|
|
checkOrderApi
|
|
|
|
|
} from "@/api/cart.js";
|
|
|
|
|
import {
|
2024-06-21 14:27:24 +08:00
|
|
|
|
userInfoApi,
|
2024-06-13 18:08:15 +08:00
|
|
|
|
addressListsApi,
|
|
|
|
|
merchantListApi
|
|
|
|
|
} from "@/api/user.js";
|
|
|
|
|
import {
|
|
|
|
|
createOrderApi
|
|
|
|
|
} from "@/api/order.js";
|
2024-06-21 11:40:32 +08:00
|
|
|
|
import ZyPasswordboard from '@/uni_modules/zy-passwordboard/components/zy-passwordboard/zy-passwordboard.vue';
|
2024-06-13 18:08:15 +08:00
|
|
|
|
|
2024-06-15 14:15:45 +08:00
|
|
|
|
const userInfo = useUserStore().userInfo;
|
2024-06-13 18:08:15 +08:00
|
|
|
|
// 用户选择的门店信息
|
|
|
|
|
let STORE_INFO = uni.getStorageSync('STORE_INFO');
|
|
|
|
|
if (STORE_INFO)
|
|
|
|
|
STORE_INFO = JSON.parse(STORE_INFO)
|
|
|
|
|
|
|
|
|
|
const cartStore = useCartStore();
|
|
|
|
|
const reservation_time = ref('')
|
|
|
|
|
|
|
|
|
|
const formData = ref({
|
|
|
|
|
remark: ""
|
2024-06-05 18:45:30 +08:00
|
|
|
|
})
|
2024-06-13 18:08:15 +08:00
|
|
|
|
|
|
|
|
|
const isAddress = ref(false);
|
|
|
|
|
const toastAddressShow = ref(false);
|
|
|
|
|
|
|
|
|
|
const onChoosePaytype = (e) => {
|
|
|
|
|
pay_type.value = e;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// 选择地址
|
|
|
|
|
const addressRef = ref(null);
|
|
|
|
|
const showAddress = ref(false);
|
|
|
|
|
const addressInfo = ref({});
|
|
|
|
|
const changeAddress = (e) => {
|
|
|
|
|
addressInfo.value = e;
|
|
|
|
|
showAddress.value = false;
|
|
|
|
|
isAddress.value = true;
|
|
|
|
|
}
|
|
|
|
|
const openAddress = () => {
|
|
|
|
|
if (addressList.length > 0) showAddress.value = true;
|
|
|
|
|
else uni.navigateTo({
|
|
|
|
|
url: '/pagesOrder/addressEdit/addressEdit'
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// 地址相关
|
|
|
|
|
const addressList = ref([]);
|
|
|
|
|
const getAddressList = () => {
|
|
|
|
|
addressListsApi().then(res => {
|
|
|
|
|
addressList.value = res.data.lists;
|
|
|
|
|
addressList.value.forEach(item => {
|
|
|
|
|
if (item.is_default) {
|
|
|
|
|
addressInfo.value = item;
|
|
|
|
|
isAddress.value = true;
|
|
|
|
|
}
|
|
|
|
|
})
|
|
|
|
|
if (!isAddress.value && addressList.value.length > 0) {
|
|
|
|
|
addressInfo.value = addressList.value[0];
|
2024-06-05 18:45:30 +08:00
|
|
|
|
isAddress.value = true;
|
|
|
|
|
}
|
2024-06-13 18:08:15 +08:00
|
|
|
|
if (addressInfo.value.address_id) {
|
|
|
|
|
nextTick(() => {
|
|
|
|
|
addressRef.value.setCheck(addressInfo.value.address_id);
|
|
|
|
|
})
|
|
|
|
|
}
|
2024-06-05 18:45:30 +08:00
|
|
|
|
})
|
2024-06-13 18:08:15 +08:00
|
|
|
|
}
|
2024-06-05 18:45:30 +08:00
|
|
|
|
|
2024-06-13 18:08:15 +08:00
|
|
|
|
// 提货点相关
|
|
|
|
|
const shopRef = ref(null);
|
|
|
|
|
const shopListShow = ref(false);
|
|
|
|
|
const merchantList = ref([]);
|
|
|
|
|
const myAddressInfo = ref({
|
|
|
|
|
long: "",
|
|
|
|
|
lat: ""
|
2024-06-12 13:55:17 +08:00
|
|
|
|
})
|
2024-06-13 18:08:15 +08:00
|
|
|
|
const shopInfo = ref({
|
|
|
|
|
mer_id: ''
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
const getMerchantList = (mer_name = null) => {
|
|
|
|
|
merchantListApi({
|
|
|
|
|
...myAddressInfo.value,
|
|
|
|
|
mer_name: mer_name ? mer_name : ''
|
|
|
|
|
}).then(res => {
|
|
|
|
|
merchantList.value = res.data.lists;
|
|
|
|
|
if (mer_name === null && myAddressInfo.value.long && merchantList.value.length > 0 && !shopInfo
|
|
|
|
|
.value.mer_id) {
|
|
|
|
|
shopInfo.value = merchantList.value[0];
|
|
|
|
|
shopInfo.value.recommend = 1;
|
|
|
|
|
nextTick(() => {
|
|
|
|
|
shopRef.value.setCheck(shopInfo.value.mer_id);
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// getMerchantList();
|
|
|
|
|
// 定位
|
|
|
|
|
const LoadAddress = () => {
|
|
|
|
|
uni.getLocation({
|
|
|
|
|
success: (res) => {},
|
|
|
|
|
fail: (err) => {
|
|
|
|
|
uni.$u.toast('定位失败, 请手动选择提货点!')
|
|
|
|
|
},
|
|
|
|
|
complete: (res) => {
|
|
|
|
|
myAddressInfo.value.long = res.longitude || "";
|
|
|
|
|
myAddressInfo.value.lat = res.latitude || "";
|
|
|
|
|
getMerchantList();
|
|
|
|
|
}
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
// LoadAddress();
|
|
|
|
|
|
|
|
|
|
const changeShop = (e) => {
|
|
|
|
|
shopInfo.value = e;
|
|
|
|
|
shopListShow.value = false;
|
|
|
|
|
}
|
|
|
|
|
const searchShop = (e) => {
|
|
|
|
|
getMerchantList(e)
|
|
|
|
|
}
|
|
|
|
|
const onCall = (e) => {
|
|
|
|
|
uni.makePhoneCall({
|
|
|
|
|
phoneNumber: e,
|
|
|
|
|
success() {
|
|
|
|
|
callShow.value = false
|
|
|
|
|
}
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// 选择地址
|
|
|
|
|
const addAddress = () => {
|
|
|
|
|
toastAddressShow.value = false;
|
|
|
|
|
nextTick(() => {
|
|
|
|
|
showAddress.value = true;
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
// 继续支付
|
|
|
|
|
const goPay = () => {
|
|
|
|
|
toastAddressShow.value = false;
|
|
|
|
|
isAddress.value = true;
|
|
|
|
|
submitOrder();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// 提交订单
|
|
|
|
|
const submitOrder = () => {
|
|
|
|
|
if (orderInfo.value.pay_price == 0) {
|
|
|
|
|
pay_type.value = 3;
|
|
|
|
|
return uni.$u.toast('当前支付金额为0,暂不能使用微信支付')
|
2024-06-12 13:55:17 +08:00
|
|
|
|
}
|
2024-06-13 18:08:15 +08:00
|
|
|
|
|
|
|
|
|
if (!isAddress.value && orderInfo.value.shipping_type == 1) return toastAddressShow.value = true;
|
|
|
|
|
createOrder();
|
|
|
|
|
}
|
2024-06-14 16:31:41 +08:00
|
|
|
|
|
2024-06-13 18:08:15 +08:00
|
|
|
|
// 订单相关
|
|
|
|
|
const cartList = ref([]);
|
|
|
|
|
const orderInfo = ref({});
|
|
|
|
|
const checkOrder = () => {
|
|
|
|
|
checkOrderApi({
|
|
|
|
|
cart_id: cartStore.cartList,
|
|
|
|
|
store_id: STORE_INFO.id || 0
|
|
|
|
|
}).then(res => {
|
|
|
|
|
cartList.value = res.data.cart_list;
|
|
|
|
|
orderInfo.value = res.data.order;
|
|
|
|
|
if (orderInfo.value.default_delivery == 0) {
|
|
|
|
|
orderInfo.value.shipping_type = 2
|
2024-06-11 15:12:49 +08:00
|
|
|
|
}
|
2024-06-13 18:08:15 +08:00
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
|
2024-06-19 18:41:03 +08:00
|
|
|
|
const pay_type = ref('7');
|
2024-06-13 18:08:15 +08:00
|
|
|
|
|
2024-06-21 11:40:32 +08:00
|
|
|
|
|
|
|
|
|
// 支付密码
|
|
|
|
|
const passwordBoardVisible = ref(false);
|
2024-06-21 14:27:24 +08:00
|
|
|
|
|
2024-06-21 11:40:32 +08:00
|
|
|
|
const passwordBoardProps = {
|
|
|
|
|
title: '输入支付密码',
|
|
|
|
|
onComplete(value) {
|
2024-06-21 14:27:24 +08:00
|
|
|
|
password.value = value
|
|
|
|
|
passwordBoardVisible.value = false
|
|
|
|
|
payFn()
|
2024-06-21 11:40:32 +08:00
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
|
2024-06-21 14:27:24 +08:00
|
|
|
|
const closeKeyBord = () => {
|
|
|
|
|
password.value = ''
|
|
|
|
|
}
|
2024-06-21 11:40:32 +08:00
|
|
|
|
|
2024-06-21 14:27:24 +08:00
|
|
|
|
const password = ref('')
|
|
|
|
|
const payFn = () => {
|
2024-06-15 18:41:12 +08:00
|
|
|
|
let shareInfo = uni.getStorageSync('SHARE_INFO');
|
2024-06-13 18:08:15 +08:00
|
|
|
|
createOrderApi({
|
2024-06-21 14:27:24 +08:00
|
|
|
|
password: password.value,
|
2024-06-15 18:41:12 +08:00
|
|
|
|
spread_uid: (shareInfo && shareInfo.uid) ? shareInfo.uid : '',
|
2024-06-13 18:08:15 +08:00
|
|
|
|
cart_id: cartStore.cartList,
|
|
|
|
|
address_id: addressInfo.value.address_id,
|
|
|
|
|
pay_type: pay_type.value,
|
|
|
|
|
store_id: STORE_INFO.id || 0,
|
|
|
|
|
reservation_time: reservation_time.value,
|
|
|
|
|
shipping_type: orderInfo.value.shipping_type,
|
|
|
|
|
mark: formData.value.remark
|
|
|
|
|
}).then(res => {
|
2024-06-15 14:15:45 +08:00
|
|
|
|
if (pay_type.value == 3 || pay_type.value == 18) {
|
2024-06-13 18:08:15 +08:00
|
|
|
|
if (res.code == 1) {
|
|
|
|
|
uni.showToast({
|
|
|
|
|
title: res.msg,
|
|
|
|
|
icon: "none",
|
|
|
|
|
success() {
|
|
|
|
|
setTimeout(() => {
|
|
|
|
|
uni.redirectTo({
|
2024-06-05 18:45:30 +08:00
|
|
|
|
url: '/pagesOrder/order/order?back=-1&type=2'
|
|
|
|
|
})
|
2024-06-13 18:08:15 +08:00
|
|
|
|
}, 1500)
|
|
|
|
|
}
|
2024-06-05 18:45:30 +08:00
|
|
|
|
})
|
2024-06-13 18:08:15 +08:00
|
|
|
|
} else {
|
|
|
|
|
uni.$u.toast(res.msg);
|
2024-06-05 18:45:30 +08:00
|
|
|
|
}
|
2024-06-13 18:08:15 +08:00
|
|
|
|
} else {
|
|
|
|
|
if (!res.data?.nonceStr) return uni.$u.toast('支付失败!');
|
|
|
|
|
uni.requestPayment({
|
|
|
|
|
provider: 'wxpay',
|
|
|
|
|
timeStamp: res.data.timeStamp,
|
|
|
|
|
nonceStr: res.data.nonceStr,
|
|
|
|
|
package: res.data.package,
|
|
|
|
|
signType: res.data.signType,
|
|
|
|
|
paySign: res.data.paySign,
|
|
|
|
|
success: (e) => {
|
|
|
|
|
if (e.errMsg == 'requestPayment:ok') {
|
|
|
|
|
uni.showModal({
|
|
|
|
|
title: '订单支付成功',
|
|
|
|
|
confirmText: '查看订单',
|
|
|
|
|
cancelText: '继续购买',
|
|
|
|
|
success: (e) => {
|
|
|
|
|
if (e.confirm) uni.redirectTo({
|
|
|
|
|
url: '/pagesOrder/order/order?back=-1&type=2'
|
|
|
|
|
})
|
|
|
|
|
else uni.navigateBack();
|
|
|
|
|
}
|
|
|
|
|
})
|
|
|
|
|
} else uni.$u.toast('支付失败')
|
|
|
|
|
},
|
|
|
|
|
fail: (e) => {
|
|
|
|
|
uni.$u.toast('用户取消支付');
|
|
|
|
|
uni.redirectTo({
|
|
|
|
|
url: '/pagesOrder/order/order?back=-1&type=1'
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
})
|
2024-06-05 18:45:30 +08:00
|
|
|
|
}
|
2024-06-13 18:08:15 +08:00
|
|
|
|
}).catch(err => {
|
|
|
|
|
uni.$u.toast(err.msg || '网络错误')
|
|
|
|
|
})
|
|
|
|
|
}
|
2024-06-05 18:45:30 +08:00
|
|
|
|
|
2024-06-21 14:27:24 +08:00
|
|
|
|
const showModal = ref(false)
|
|
|
|
|
const navgo = (url) => {
|
|
|
|
|
showModal.value &&= false
|
|
|
|
|
uni.navigateTo({
|
|
|
|
|
url
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
const createOrder = async () => {
|
|
|
|
|
if (!pay_type.value) return uni.$u.toast('请选择支付方式');
|
|
|
|
|
if (pay_type.value == 3 || pay_type.value == 18) {
|
|
|
|
|
let res = await userInfoApi()
|
|
|
|
|
return res.data.pay_password ? passwordBoardVisible.value = true : showModal.value = true
|
|
|
|
|
}
|
|
|
|
|
payFn()
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2024-06-13 18:08:15 +08:00
|
|
|
|
const c_price = (price, index = 0) => {
|
|
|
|
|
price = price + '';
|
|
|
|
|
return price.split('.')[index] || (index ? '00' : '0');
|
2024-06-05 18:45:30 +08:00
|
|
|
|
}
|
2024-06-12 13:55:17 +08:00
|
|
|
|
|
2024-06-13 18:08:15 +08:00
|
|
|
|
onLoad(options => {
|
|
|
|
|
checkOrder();
|
|
|
|
|
})
|
|
|
|
|
onShow(() => {
|
|
|
|
|
getAddressList();
|
|
|
|
|
})
|
|
|
|
|
</script>
|
2024-06-05 18:45:30 +08:00
|
|
|
|
|
2024-06-13 18:08:15 +08:00
|
|
|
|
<style lang="scss">
|
|
|
|
|
.m-card {
|
|
|
|
|
margin: 20rpx;
|
2024-06-12 13:55:17 +08:00
|
|
|
|
border-radius: 14rpx;
|
2024-06-13 18:08:15 +08:00
|
|
|
|
background-color: #fff;
|
|
|
|
|
padding: 20rpx;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.row {
|
|
|
|
|
padding: 0;
|
2024-06-12 13:55:17 +08:00
|
|
|
|
overflow: hidden;
|
|
|
|
|
}
|
|
|
|
|
|
2024-06-13 18:08:15 +08:00
|
|
|
|
.m-address {
|
|
|
|
|
margin-bottom: 20rpx;
|
2024-06-05 18:45:30 +08:00
|
|
|
|
display: flex;
|
|
|
|
|
justify-content: space-between;
|
2024-06-13 18:08:15 +08:00
|
|
|
|
color: #999999;
|
2024-06-05 18:45:30 +08:00
|
|
|
|
|
2024-06-13 18:08:15 +08:00
|
|
|
|
.address-info {
|
|
|
|
|
width: 450rpx;
|
|
|
|
|
|
|
|
|
|
.top {
|
|
|
|
|
display: flex;
|
|
|
|
|
font-size: 28rpx;
|
|
|
|
|
|
|
|
|
|
.t-name {
|
|
|
|
|
color: #444;
|
|
|
|
|
margin: 0 10rpx;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.bottom {
|
|
|
|
|
font-size: 24rpx;
|
|
|
|
|
}
|
2024-06-05 18:45:30 +08:00
|
|
|
|
}
|
2024-06-13 18:08:15 +08:00
|
|
|
|
}
|
2024-06-05 18:45:30 +08:00
|
|
|
|
|
2024-06-13 18:08:15 +08:00
|
|
|
|
.m-good {
|
|
|
|
|
display: flex;
|
|
|
|
|
justify-content: space-between;
|
|
|
|
|
margin-bottom: 20rpx;
|
|
|
|
|
|
|
|
|
|
.image {
|
|
|
|
|
width: 160rpx;
|
|
|
|
|
height: 160rpx;
|
|
|
|
|
margin-right: 20rpx;
|
|
|
|
|
border-radius: 14rpx;
|
|
|
|
|
overflow: hidden;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.body-content {
|
|
|
|
|
width: 490rpx;
|
2024-06-05 18:45:30 +08:00
|
|
|
|
display: flex;
|
2024-06-13 18:08:15 +08:00
|
|
|
|
flex-direction: column;
|
2024-06-05 18:45:30 +08:00
|
|
|
|
justify-content: space-between;
|
2024-06-13 18:08:15 +08:00
|
|
|
|
color: #989898;
|
2024-06-05 18:45:30 +08:00
|
|
|
|
|
2024-06-13 18:08:15 +08:00
|
|
|
|
.title {
|
|
|
|
|
display: flex;
|
|
|
|
|
justify-content: space-between;
|
|
|
|
|
font-size: 28rpx;
|
|
|
|
|
color: #444;
|
|
|
|
|
}
|
2024-06-05 18:45:30 +08:00
|
|
|
|
|
2024-06-13 18:08:15 +08:00
|
|
|
|
.tips {
|
|
|
|
|
display: flex;
|
|
|
|
|
justify-content: space-between;
|
|
|
|
|
font-size: 24rpx;
|
|
|
|
|
margin-top: 10rpx;
|
|
|
|
|
}
|
2024-06-05 18:45:30 +08:00
|
|
|
|
|
2024-06-13 18:08:15 +08:00
|
|
|
|
.time {
|
|
|
|
|
background-color: #F6F6F6;
|
|
|
|
|
padding: 5rpx 10rpx;
|
|
|
|
|
font-size: 26rpx;
|
|
|
|
|
color: #444;
|
|
|
|
|
border-radius: 10rpx;
|
|
|
|
|
}
|
|
|
|
|
}
|
2024-06-12 13:55:17 +08:00
|
|
|
|
}
|
2024-06-05 18:45:30 +08:00
|
|
|
|
|
2024-06-13 18:08:15 +08:00
|
|
|
|
.good-info {
|
|
|
|
|
margin-bottom: 20rpx;
|
2024-06-12 13:55:17 +08:00
|
|
|
|
|
2024-06-13 18:08:15 +08:00
|
|
|
|
.head-title {
|
|
|
|
|
margin-bottom: 18rpx;
|
|
|
|
|
color: #000;
|
|
|
|
|
font-weight: bold;
|
2024-06-05 18:45:30 +08:00
|
|
|
|
}
|
|
|
|
|
|
2024-06-13 18:08:15 +08:00
|
|
|
|
.row {
|
2024-06-12 13:55:17 +08:00
|
|
|
|
display: flex;
|
|
|
|
|
align-items: center;
|
2024-06-13 18:08:15 +08:00
|
|
|
|
justify-content: space-between;
|
|
|
|
|
margin-bottom: 18rpx;
|
|
|
|
|
|
|
|
|
|
.red {
|
|
|
|
|
color: #F55726;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.icon-text {
|
|
|
|
|
display: flex;
|
|
|
|
|
align-items: center;
|
|
|
|
|
}
|
2024-06-05 18:45:30 +08:00
|
|
|
|
|
2024-06-13 18:08:15 +08:00
|
|
|
|
.icon {
|
|
|
|
|
image {
|
|
|
|
|
width: 40rpx;
|
|
|
|
|
height: 40rpx;
|
|
|
|
|
}
|
2024-06-12 13:55:17 +08:00
|
|
|
|
}
|
2024-06-05 18:45:30 +08:00
|
|
|
|
}
|
2024-06-13 18:08:15 +08:00
|
|
|
|
|
|
|
|
|
.row-need {
|
|
|
|
|
display: flex;
|
|
|
|
|
justify-content: flex-end;
|
|
|
|
|
color: #F55726;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
text {
|
|
|
|
|
font-size: 22rpx;
|
|
|
|
|
}
|
2024-06-05 18:45:30 +08:00
|
|
|
|
}
|
|
|
|
|
|
2024-06-13 18:08:15 +08:00
|
|
|
|
.order-remark {
|
|
|
|
|
.head-title {
|
|
|
|
|
margin-bottom: 18rpx;
|
|
|
|
|
display: flex;
|
|
|
|
|
justify-content: space-between;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.tips {
|
|
|
|
|
font-size: 28rpx;
|
|
|
|
|
color: #999;
|
2024-06-05 18:45:30 +08:00
|
|
|
|
display: flex;
|
|
|
|
|
justify-content: flex-end;
|
2024-06-13 18:08:15 +08:00
|
|
|
|
align-items: center;
|
|
|
|
|
flex: 1;
|
|
|
|
|
margin-right: 20rpx;
|
2024-06-08 15:27:58 +08:00
|
|
|
|
|
2024-06-13 18:08:15 +08:00
|
|
|
|
.all {
|
|
|
|
|
color: #F55726;
|
|
|
|
|
}
|
2024-06-08 15:27:58 +08:00
|
|
|
|
}
|
|
|
|
|
|
2024-06-13 18:08:15 +08:00
|
|
|
|
.item-center {
|
2024-06-08 15:27:58 +08:00
|
|
|
|
display: flex;
|
2024-06-13 18:08:15 +08:00
|
|
|
|
align-items: center;
|
|
|
|
|
position: relative;
|
2024-06-12 13:55:17 +08:00
|
|
|
|
}
|
2024-06-13 18:08:15 +08:00
|
|
|
|
|
|
|
|
|
.ship-type {
|
|
|
|
|
display: flex;
|
|
|
|
|
z-index: 9;
|
|
|
|
|
background-color: #F6F6F6;
|
2024-06-08 15:27:58 +08:00
|
|
|
|
border-radius: 30rpx;
|
|
|
|
|
|
2024-06-13 18:08:15 +08:00
|
|
|
|
.ship-type-item {
|
|
|
|
|
width: 82rpx;
|
|
|
|
|
height: 54rpx;
|
|
|
|
|
line-height: 54rpx;
|
|
|
|
|
text-align: center;
|
|
|
|
|
transition: background-color 0.3s ease;
|
|
|
|
|
border-radius: 30rpx;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.actShipItem {
|
|
|
|
|
background-color: #27B52F;
|
|
|
|
|
color: white;
|
|
|
|
|
}
|
2024-06-08 15:27:58 +08:00
|
|
|
|
}
|
2024-04-28 18:08:57 +08:00
|
|
|
|
</style>
|