This commit is contained in:
zmj 2024-06-25 13:44:10 +08:00
parent 6605fe5571
commit 002937f5a2
4 changed files with 51 additions and 74 deletions

View File

@ -10,6 +10,7 @@ switch (env) {
case 'dev': case 'dev':
BASE_URL = 'https://test-multi-store.lihaink.cn'; BASE_URL = 'https://test-multi-store.lihaink.cn';
WSS_URL = 'wss://test-multi-store.lihaink.cn/pull' WSS_URL = 'wss://test-multi-store.lihaink.cn/pull'
// WSS_URL = 'ws://192.168.1.22:8787'
break; break;
case 'liu': case 'liu':
BASE_URL = 'http://192.168.1.201:8545'; BASE_URL = 'http://192.168.1.201:8545';

View File

@ -214,7 +214,7 @@
}); });
// user-1 // user-1
const user_channel = connection.subscribe(`wechat_mmp_${userInfo.id}}`); const user_channel = connection.subscribe(`wechat_mmp_${userInfo.id}`);
user_channel.on('message', function(data) { user_channel.on('message', function(data) {
console.log("收到消息--", data); console.log("收到消息--", data);
@ -425,6 +425,9 @@
const submit = async () => { const submit = async () => {
if (!formData.real_name) return uni.$u.toast('请填写真实姓名'); if (!formData.real_name) return uni.$u.toast('请填写真实姓名');
if (!formData.mobile) return uni.$u.toast('请填写电话号码'); if (!formData.mobile) return uni.$u.toast('请填写电话号码');
uni.showLoading({
title: '支付中...'
});
formData.store_id = STORE_INFO.id formData.store_id = STORE_INFO.id
if (Role.value == 1) { if (Role.value == 1) {
uni.scanCode({ uni.scanCode({
@ -433,29 +436,10 @@
formData.recharge_type = 'INDUSTRYMEMBERS' formData.recharge_type = 'INDUSTRYMEMBERS'
formData.user_ship = 1 formData.user_ship = 1
vipRechargeApi(formData).then(res => { vipRechargeApi(formData).then(res => {
uni.showLoading({
title: '支付中...'
});
timer = setTimeout(() => { timer = setTimeout(() => {
uni.hideLoading(); uni.hideLoading();
uni.$u.toast('支付超时'); uni.$u.toast('支付超时');
// formData.real_name = ''
// formData.mobile = ''
// formData.address = ''
// formData.label_name = ''
// formData.city = ''
// formData.area = ''
// formData.street = ''
// formData.village = ''
// formData.brigade = ''
// currentAddressIndex.value = 0
// tabsList.forEach(item => {
// item.name = ''
// })
}, 30000) }, 30000)
// uni.$u.toast('');
}) })
getCount() getCount()
getLists() getLists()

View File

@ -109,14 +109,11 @@
</view> </view>
</view> </view>
<view style="width: 200rpx;"> <view style="width: 200rpx;">
<up-button color="#20b128" shape="circle" :disabled="!checkAll || c_price0<500 " <up-button color="#20b128" shape="circle" @click="settleAccounts">
@click="settleAccounts"> <view class="">
<view class="" v-if='c_price0>=500'>
去结算<text v-if="checkAll">({{checkAll}})</text> 去结算<text v-if="checkAll">({{checkAll}})</text>
</view> </view>
<view class="" v-else>
¥500起订
</view>
</up-button> </up-button>
</view> </view>
</view> </view>
@ -206,22 +203,22 @@
// //
const addCart = (id, cart_num) => { // const addCart = (id, cart_num) => { //
if (uni.getStorageSync('STORE_INFO').length) { if (uni.getStorageSync('STORE_INFO').length) {
let data = JSON.parse(uni.getStorageSync('STORE_INFO')) let data = JSON.parse(uni.getStorageSync('STORE_INFO'))
let STORE_INFO = {}; let STORE_INFO = {};
for (let key in data) { for (let key in data) {
STORE_INFO[key] = data[key] STORE_INFO[key] = data[key]
} }
cartCreateApi({ cartCreateApi({
cart_num: +cart_num, cart_num: +cart_num,
product_id: id, product_id: id,
store_id: STORE_INFO.id store_id: STORE_INFO.id
// store_id: // store_id:
}).then(res => { }).then(res => {
getcartList(); getcartList();
}) })
} }
} }
const isAdmin = ref(false); // const isAdmin = ref(false); //
@ -253,10 +250,10 @@
} else { } else {
checkAll.value = 0 checkAll.value = 0
} }
res.data.lists = res.data.lists.map(item => { res.data.lists = res.data.lists.map(item => {
if(!item.price) item.price = item.sell; // price if (!item.price) item.price = item.sell; // price
return item; return item;
}) })
cartList.value = res.data.lists; cartList.value = res.data.lists;
cartInfo.value = { cartInfo.value = {
total_price: res.data?.extend.total_price || '0.00', total_price: res.data?.extend.total_price || '0.00',

View File

@ -148,26 +148,24 @@
<view class="shop-content"> <view class="shop-content">
<view class="title"> <view class="title">
<view class="name u-line-2">{{ item.store_name }}</view> <view class="name u-line-2">{{ item.store_name }}</view>
<view class="tip u-line-1"> </view>
<text>{{ item.spec }}</text> <view class="title">
<view>
<text style="font-size: 22rpx;color: #FC452F;">
活动价: <text style="font-size: 28rpx;">{{ 66.65}}</text>
</text>
<text style="color:grey;font-size: 22rpx;">/{{ item.unit_name }}</text>
</view> </view>
</view> </view>
<view style="display: flex;" v-if='item.batch > 0'> <view class="title">
<view style="color: red;">起批量: {{ item.batch }}{{ item.unit_name }}起卖</view> <view class="name u-line-2"><text> 原价:</text> {{ item.store_name }}</view>
</view>
<view style="display: flex;" v-if='item.batch > 0'>
<view style="color: red;">规格: {{ item.price }}/{{ item.unit_name }}</view>
</view> </view>
<!-- <view style="display: flex;align-items: center;" v-if='userStore?.userInfo?.user_ship == 1'>
<text class='price' style="font-size: 24rpx;">会员价</text>
<text class="price" style="margin-right: 10rpx;">{{ item.vip_price }}
</text>
<text class='price' style="font-size: 24rpx;">/{{ item.unit_name }}</text>
</view> -->
<view class="price-btn"> <view class="price-btn">
<!-- <view class="price" style="font-size: 24rpx;"
v-if='userStore?.userInfo?.user_ship == 1'>
{{ item.price }}/{{ item.unit_name }}
</view> -->
<view class="price"> <view class="price">
{{ item.price }}/{{ item.unit_name }} 起批量 {{ item.batch }}{{ item.unit_name }}起卖
</view> </view>
<view class="btn"> <view class="btn">
<u--icon name="plus-circle-fill" size="20" color="#20b128"></u--icon> <u--icon name="plus-circle-fill" size="20" color="#20b128"></u--icon>
@ -185,19 +183,14 @@
<view>合计</view> <view>合计</view>
<view class="price" v-if='cartInfo.pay_price<=0||userStore?.userInfo?.user_ship !=4'>¥<text <view class="price" v-if='cartInfo.pay_price<=0||userStore?.userInfo?.user_ship !=4'>¥<text
style="font-size: 36rpx;">{{ cartInfo.total_price }}</text></view> style="font-size: 36rpx;">{{ cartInfo.total_price }}</text></view>
<view class="price" v-else>¥<text style="font-size: 30rpx;">{{ cartInfo.total_price }}</text></view>
<view class="price" v-if="cartInfo.pay_price>0 &&userStore?.userInfo?.user_ship == 4"><text
style="font-size: 36rpx;">优惠后
{{ cartInfo.pay_price }}</text></view>
</view> </view>
<!-- <view class="row"> <view style="font-size: 22rpx;text-indent: 3em;color: #F55726;"
<view style="color: #777;">原价 ¥50.00</view> v-if="cartInfo.msg&&cartInfo.total_price>0 ">
<view class="price">优惠 ¥0.00</view> {{cartInfo.msg }}
</view> --> </view>
</view> </view>
<view class="btn"> <view class="btn">
<up-button color="#20b128" :disabled="cartInfo.total_price < 500" @click="settleAccounts"> <up-button color="#20b128" @click="settleAccounts"> 结算</up-button>
{{ cartInfo.total_price < 500 ? "¥500起订" : "结算" }} </up-button>
</view> </view>
<view class="cart" @click="navTo('/pages/cart/cart')"> <view class="cart" @click="navTo('/pages/cart/cart')">
<image src="@/static/icon/cart.png"></image> <image src="@/static/icon/cart.png"></image>
@ -557,7 +550,8 @@
const cartInfo = ref({ const cartInfo = ref({
total_price: '0.00', total_price: '0.00',
pay_price: 0, pay_price: 0,
count: 0 count: 0,
msg: ''
}) })
const getCartList = (res) => { const getCartList = (res) => {
cartListApi({ cartListApi({
@ -567,6 +561,7 @@
cartInfo.value = { cartInfo.value = {
total_price: res.data?.extend?.total_price || '0.00', total_price: res.data?.extend?.total_price || '0.00',
pay_price: res.data?.extend?.pay_price || '0.00', pay_price: res.data?.extend?.pay_price || '0.00',
msg: res.data?.extend?.msg || '',
count: res.data?.count || 0 count: res.data?.count || 0
} }
cartStore.setCartList(res.data?.lists.map(item => item.id)) cartStore.setCartList(res.data?.lists.map(item => item.id))
@ -980,8 +975,8 @@
display: flex; display: flex;
.shop-img { .shop-img {
height: 120rpx; height: 164rpx;
width: 120rpx; width: 164rpx;
margin-right: 20rpx; margin-right: 20rpx;
border-radius: 14rpx; border-radius: 14rpx;
overflow: hidden; overflow: hidden;