Compare commits
10 Commits
6e2161fc5e
...
test
| Author | SHA1 | Date | |
|---|---|---|---|
| 0f15137c7f | |||
| b637a6dea9 | |||
| d5c42f2092 | |||
| 129bc1276a | |||
| 5c2aa2b617 | |||
| 3f6b39f413 | |||
| 036f557c9a | |||
| 427f32ded7 | |||
| a6174a036c | |||
| 1264286269 |
11
common/api/account/index.js
Normal file
11
common/api/account/index.js
Normal file
@@ -0,0 +1,11 @@
|
|||||||
|
// 引入 request 文件
|
||||||
|
import request from '@/common/api/request.js'
|
||||||
|
import {prveUrl} from './config.js'
|
||||||
|
|
||||||
|
export const shopUserConfirm = (data) => {
|
||||||
|
return request({
|
||||||
|
url: prveUrl + '/user/shopUser/confirm',
|
||||||
|
method: 'post',
|
||||||
|
data: data
|
||||||
|
})
|
||||||
|
}
|
||||||
@@ -122,4 +122,6 @@ export const cancelRefund = (data) => {
|
|||||||
method: 'post',
|
method: 'post',
|
||||||
data: data
|
data: data
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export const exchange=()=>{}
|
||||||
@@ -54,4 +54,14 @@ export const productRelated = (data) => {
|
|||||||
method: 'get',
|
method: 'get',
|
||||||
data: data
|
data: data
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//获取相关推荐商品
|
||||||
|
export const getConsStock = (data) => {
|
||||||
|
return request({
|
||||||
|
url: urlProduct + '/user/product/consStock',
|
||||||
|
method: 'get',
|
||||||
|
data: data
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
|||||||
540
components/registermember.vue
Normal file
540
components/registermember.vue
Normal file
@@ -0,0 +1,540 @@
|
|||||||
|
<template>
|
||||||
|
<!-- 店铺详情 -->
|
||||||
|
<u-popup :show="show" :round="20" overlayOpacity="0.8" mode="bottom" @close="showClose" height="500">
|
||||||
|
<view class="register-member-wrap">
|
||||||
|
<view class="register-title">欢迎加入{{shopUserInfo.shopName?shopUserInfo.shopName:'本店'}}</view>
|
||||||
|
<!-- <view class="register-tip">请完善个人信息完成会员注册</view> -->
|
||||||
|
<view class="register-tip">请先完成股东信息提交</view>
|
||||||
|
|
||||||
|
|
||||||
|
<view class="register-content">
|
||||||
|
<view class="reg-head">
|
||||||
|
<view class="reg-head-img">
|
||||||
|
<!-- #ifdef MP-WEIXIN || H5 -->
|
||||||
|
<button class="reg-head-img" type="default" open-type="chooseAvatar"
|
||||||
|
@chooseavatar="onChooseAvatar">
|
||||||
|
<image class="reg-head-img"
|
||||||
|
:src="userHeadImg || 'https://czg-qr-order.oss-cn-beijing.aliyuncs.com/menber/head_default.png'"
|
||||||
|
mode="aspectFill"></image>
|
||||||
|
</button>
|
||||||
|
<!-- #endif -->
|
||||||
|
<!-- #ifdef MP-ALIPAY -->
|
||||||
|
<button class="reg-head-img" @click="onChooseAvatar">
|
||||||
|
<image class="reg-head-img"
|
||||||
|
:src="userHeadImg || 'https://czg-qr-order.oss-cn-beijing.aliyuncs.com/menber/head_default.png'"
|
||||||
|
mode="aspectFill"></image>
|
||||||
|
</button>
|
||||||
|
<!-- #endif -->
|
||||||
|
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
<view class="reg-cell">
|
||||||
|
<view class="lable">昵称<text style="color: #CD1A1A;">*</text></view>
|
||||||
|
<u-input class="value" v-model="formInfo.nickName" fontSize="14px" type="text" input-align="left"
|
||||||
|
placeholder="请输入昵称" :custom-style="{border:'none'}"
|
||||||
|
placeholderStyle="color:#999;font-size: 28rpx" />
|
||||||
|
</view>
|
||||||
|
<view class="reg-cell" @click="calendarShow = true">
|
||||||
|
<view class="lable">生日</view>
|
||||||
|
<view class="value" :style="{color: formInfo.birthDay ? '#333' : '#999'}">
|
||||||
|
{{ formInfo.birthDay || '请选择日期'}}
|
||||||
|
</view>
|
||||||
|
<!-- <u-calendar @close="calendarShow = false" monthNum="99" minDate="1945-01-01" maxDate="2055-12-12" :show="calendarShow" mode="single" @confirm="confirmCalendar"></u-calendar> -->
|
||||||
|
<!-- <u-picker :show="calendarShow" ref="uPicker" :columns="columns" @confirm="confirm" @change="changeHandler"></u-picker> -->
|
||||||
|
<!-- <picker :show="calendarShow" mode="date"></picker> -->
|
||||||
|
<up-datetime-picker mode="date" @cancel="calendarShow = false" :show="calendarShow"
|
||||||
|
:minDate="-2208988800000" v-model="value1" itemHeight="66" visibleItemCount="5"
|
||||||
|
@confirm="confirmTime"></up-datetime-picker>
|
||||||
|
<up-icon name="arrow-down-fill" color="#000" size="10"></up-icon>
|
||||||
|
</view>
|
||||||
|
<view class="reg-cell">
|
||||||
|
<view class="lable">性别<text style="color: #CD1A1A;">*</text></view>
|
||||||
|
<up-radio-group v-model="formInfo.sex" active-color="#E3AD7F">
|
||||||
|
<up-radio :name="1" label="男"></up-radio>
|
||||||
|
<up-radio :name="0" label="女"></up-radio>
|
||||||
|
</up-radio-group>
|
||||||
|
</view>
|
||||||
|
<view class="reg-cell">
|
||||||
|
<view class="lable">手机号</view>
|
||||||
|
<up-input class="value" v-model="formInfo.telephone" fontSize="14px" type="text" input-align="left"
|
||||||
|
readonly placeholder="获取手机号" :custom-style="{border:'none'}"
|
||||||
|
placeholder-style="color:#999;font-size: 28rpx" />
|
||||||
|
<!-- #ifdef MP-WEIXIN || H5 -->
|
||||||
|
<button class="getPhone" size="10" open-type="getPhoneNumber" @getphonenumber="getPhone">
|
||||||
|
<!-- #endif -->
|
||||||
|
<!-- #ifdef MP-ALIPAY -->
|
||||||
|
<button class="getPhone" size="10" open-type="getAuthorize" scope='phoneNumber'
|
||||||
|
@getAuthorize="getPhone">
|
||||||
|
<!-- #endif -->
|
||||||
|
<view class="text">{{'获取手机号'}}</view>
|
||||||
|
</button>
|
||||||
|
</view>
|
||||||
|
<view class="agreement">
|
||||||
|
<view class="agreement_tip">我已阅读并同意以下内容</view>
|
||||||
|
<view class="agreement_item" @click="isProtocol = !isProtocol">
|
||||||
|
<up-checkbox-group>
|
||||||
|
<up-checkbox :checked="isProtocol" shape="circle" activeColor="#E3AD7F"
|
||||||
|
@change="radioChange" size="15" iconSize="10"></up-checkbox>
|
||||||
|
</up-checkbox-group>
|
||||||
|
<text @click.stop="viewProtocol(1)" class="agreement_item_text">用户协议/隐私条款</text>
|
||||||
|
</view>
|
||||||
|
<!-- <view class="agreement_item">
|
||||||
|
<u-checkbox-group>
|
||||||
|
<u-checkbox shape="circle" activeColor="#E3AD7F" @change="radioChange" size="30"></u-checkbox>
|
||||||
|
</u-checkbox-group>
|
||||||
|
<text class="agreement_item_text">隐私条款</text>
|
||||||
|
</view> -->
|
||||||
|
</view>
|
||||||
|
<view class="register_btn" @tap="$u.debounce(registerMember, 500)">确认提交</view>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</u-popup>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script setup>
|
||||||
|
import {
|
||||||
|
defineProps,
|
||||||
|
reactive,
|
||||||
|
ref,
|
||||||
|
defineEmits,
|
||||||
|
watch,
|
||||||
|
watchEffect
|
||||||
|
} from 'vue';
|
||||||
|
|
||||||
|
import {
|
||||||
|
APIshopUser,
|
||||||
|
APIshopUserInfo
|
||||||
|
} from '@/common/api/member.js'
|
||||||
|
import {
|
||||||
|
shopUserConfirm
|
||||||
|
} from '@/common/api/account/index.js'
|
||||||
|
import {
|
||||||
|
APIuserphone
|
||||||
|
} from '@/common/api/api.js'
|
||||||
|
|
||||||
|
const props = defineProps({
|
||||||
|
shopUserInfo: {
|
||||||
|
type: Object,
|
||||||
|
default: () => ({})
|
||||||
|
},
|
||||||
|
detailtype: {
|
||||||
|
type: String,
|
||||||
|
default: ''
|
||||||
|
},
|
||||||
|
shopId: {
|
||||||
|
type: String,
|
||||||
|
default: ''
|
||||||
|
},
|
||||||
|
});
|
||||||
|
const show=defineModel(false)
|
||||||
|
// 定义事件发射器
|
||||||
|
const emits = defineEmits(['emitsmemberOpen','update']);
|
||||||
|
|
||||||
|
// 定义要触发的事件
|
||||||
|
|
||||||
|
const formInfo = reactive({
|
||||||
|
nickName: "",
|
||||||
|
telephone: "",
|
||||||
|
birthDay: "",
|
||||||
|
sex:1,
|
||||||
|
})
|
||||||
|
const userHeadImg = ref('')
|
||||||
|
|
||||||
|
watchEffect(()=>{
|
||||||
|
formInfo.nickName= `${props.shopUserInfo.nickName}`.trim() ==='微信用户' ? '' :(props.shopUserInfo.nickName||'')
|
||||||
|
formInfo.telephone=props.shopUserInfo.phone||''
|
||||||
|
formInfo.birthDay=props.shopUserInfo.birthDay||''
|
||||||
|
formInfo.sex=props.shopUserInfo.sex||1
|
||||||
|
userHeadImg.value=props.shopUserInfo.headImg||''
|
||||||
|
})
|
||||||
|
const value1 = Number(new Date())
|
||||||
|
|
||||||
|
const calendarShow = ref(false)
|
||||||
|
|
||||||
|
// 用户图片
|
||||||
|
|
||||||
|
|
||||||
|
//显示隐藏
|
||||||
|
const isProtocol = ref(false)
|
||||||
|
|
||||||
|
const init = async () => {
|
||||||
|
|
||||||
|
// if (uni.cache.get('shopUserInfo') && props.shopId||uni.cache.get('shopId') == uni.cache.get('shopUserInfo').id) {
|
||||||
|
// shopUserInfo = uni.cache.get('shopUserInfo');
|
||||||
|
// } else {
|
||||||
|
// let res = await this.api.shopUserInfo({
|
||||||
|
// "shopId": props.shopId||uni.cache.get('shopId'),
|
||||||
|
// "userId": uni.cache.get('userInfo').id,
|
||||||
|
// })
|
||||||
|
// if (res.code == 0) {
|
||||||
|
// shopUserInfo = res.data;
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
// memberOpen.value = shopUserInfo.isVip == 0 ? true : false;
|
||||||
|
// userHeadImg.value = shopUserInfo.headImg;
|
||||||
|
// formInfo.nickName = shopUserInfo.nickName && shopUserInfo.nickName != '微信用户' ? shopUserInfo
|
||||||
|
// .nickName : '';
|
||||||
|
// formInfo.telephone = shopUserInfo.telephone;
|
||||||
|
// formInfo.birthDay = shopUserInfo.birthDay
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
// 返回
|
||||||
|
const showClose = () => {
|
||||||
|
// uni.navigateBack()
|
||||||
|
show.value=false
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
const radioChange = (n) => {
|
||||||
|
isProtocol.value = n;
|
||||||
|
}
|
||||||
|
|
||||||
|
// 查看协议
|
||||||
|
const viewProtocol = () => {
|
||||||
|
wx.openPrivacyContract({
|
||||||
|
success: () => {}, // 打开成功
|
||||||
|
fail: () => {}, // 打开失败
|
||||||
|
complete: () => {}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
//上传头像
|
||||||
|
const onChooseAvatar = (e) => {
|
||||||
|
//#ifdef MP-WEIXIN
|
||||||
|
let avatarUrl = e.detail.avatarUrl
|
||||||
|
uni.uploadFile({
|
||||||
|
url: uni.conf.baseUrl + '/account/user/common/upload',
|
||||||
|
filePath: avatarUrl,
|
||||||
|
header: {
|
||||||
|
shopId: props.shopId||uni.cache.get('shopId'),
|
||||||
|
token: uni.cache.get('token') || '',
|
||||||
|
'content-type': 'multipart/form-data'
|
||||||
|
},
|
||||||
|
fileType: 'image',
|
||||||
|
name: "file",
|
||||||
|
formData: {
|
||||||
|
file: avatarUrl,
|
||||||
|
},
|
||||||
|
success: (uploadFileRes) => {
|
||||||
|
let {
|
||||||
|
data
|
||||||
|
} = JSON.parse(uploadFileRes.data)
|
||||||
|
userHeadImg.value = data
|
||||||
|
},
|
||||||
|
fail: (res) => {
|
||||||
|
console.log(res)
|
||||||
|
}
|
||||||
|
});
|
||||||
|
// #endif
|
||||||
|
//#ifdef MP-ALIPAY
|
||||||
|
uni.chooseImage({
|
||||||
|
count: 1, // 默认9,设置图片的数量
|
||||||
|
sizeType: ['original', 'compressed'], // 可以指定是原图还是压缩图,默认二者都有
|
||||||
|
sourceType: ['album', 'camera'], // 可以指定来源是相册还是相机,默认二者都有
|
||||||
|
success: function(res) {
|
||||||
|
// 成功选择图片后
|
||||||
|
let avatarUrl = res.tempFilePaths[0]; // 获取文件路径
|
||||||
|
|
||||||
|
my.uploadFile({
|
||||||
|
url: uni.conf.baseUrl + '/account/user/common/upload',
|
||||||
|
filePath: avatarUrl,
|
||||||
|
header: {
|
||||||
|
environment: 'app',
|
||||||
|
type: 'android',
|
||||||
|
version: '1.7.3',
|
||||||
|
'content-type': 'multipart/form-data'
|
||||||
|
},
|
||||||
|
fileType: 'image',
|
||||||
|
name: "file",
|
||||||
|
formData: {
|
||||||
|
file: avatarUrl,
|
||||||
|
},
|
||||||
|
success: (uploadFileRes) => {
|
||||||
|
let {
|
||||||
|
data
|
||||||
|
} = JSON.parse(uploadFileRes.data)
|
||||||
|
userHeadImg.value = data
|
||||||
|
},
|
||||||
|
fail: (res) => {
|
||||||
|
console.log(res)
|
||||||
|
}
|
||||||
|
});
|
||||||
|
},
|
||||||
|
fail: (res) => {
|
||||||
|
console.log(res)
|
||||||
|
}
|
||||||
|
});
|
||||||
|
// #endif
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// 确定生日
|
||||||
|
const confirmTime = (e) => {
|
||||||
|
calendarShow.value = false;
|
||||||
|
formInfo.birthDay = getDate(e.value);
|
||||||
|
}
|
||||||
|
|
||||||
|
// 获取手机号
|
||||||
|
const getPhone = (d) => {
|
||||||
|
// #ifdef MP-WEIXIN
|
||||||
|
if (d.detail.iv) {
|
||||||
|
uni.login({
|
||||||
|
provider: 'weixin',
|
||||||
|
success: async (data) => {
|
||||||
|
let res = await APIuserphone({
|
||||||
|
code: data.code,
|
||||||
|
encryptedData: d.detail.encryptedData,
|
||||||
|
iv: d.detail.iv,
|
||||||
|
source: "wechar"
|
||||||
|
})
|
||||||
|
formInfo.telephone = res
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
// #endif
|
||||||
|
// #ifdef MP-ALIPAY
|
||||||
|
// 支付宝小程序环境
|
||||||
|
my.getAuthCode({
|
||||||
|
scopes: 'auth_user',
|
||||||
|
success: (res) => {
|
||||||
|
console.log(res)
|
||||||
|
my.getPhoneNumber({
|
||||||
|
success: async (data) => {
|
||||||
|
let res = await APIuserphone({
|
||||||
|
encryptedData: JSON.parse(data.response).response,
|
||||||
|
source: "alipay"
|
||||||
|
})
|
||||||
|
formInfo.telephone = res
|
||||||
|
// console.log(this.phonetitle)
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
});
|
||||||
|
// #endif
|
||||||
|
}
|
||||||
|
|
||||||
|
// 格式化时间戳
|
||||||
|
const getDate = (time) => {
|
||||||
|
const date = new Date(time);
|
||||||
|
// const date = new Date();
|
||||||
|
let year = date.getFullYear();
|
||||||
|
let month = date.getMonth() + 1;
|
||||||
|
let day = date.getDate();
|
||||||
|
|
||||||
|
|
||||||
|
month = month > 9 ? month : '0' + month;
|
||||||
|
day = day > 9 ? day : '0' + day;
|
||||||
|
return `${year}-${month}-${day}`;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
const registerMember = async () => {
|
||||||
|
if (formInfo.nickName == "" || formInfo.nickName == null) {
|
||||||
|
uni.showToast({
|
||||||
|
title: '请输入会员昵称',
|
||||||
|
icon: 'none'
|
||||||
|
});
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (formInfo.telephone == "" || formInfo.telephone == null) {
|
||||||
|
uni.showToast({
|
||||||
|
title: '请获取手机号',
|
||||||
|
icon: 'none'
|
||||||
|
});
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (!isProtocol.value) {
|
||||||
|
uni.showToast({
|
||||||
|
title: '请勾选协议',
|
||||||
|
icon: 'none'
|
||||||
|
});
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
let idSet = new Set(
|
||||||
|
props.shopUserInfo.shopConfirm
|
||||||
|
? props.shopUserInfo.shopConfirm.split(',')
|
||||||
|
: []
|
||||||
|
);
|
||||||
|
|
||||||
|
const shopIdToAdd = props.shopId || uni.cache.get('shopId');
|
||||||
|
if (shopIdToAdd) {
|
||||||
|
idSet.add(shopIdToAdd);
|
||||||
|
}
|
||||||
|
let idArr = Array.from(idSet).filter(v=>v!=='');
|
||||||
|
const submitForm={
|
||||||
|
// id: uni.cache.get('userInfo').id,
|
||||||
|
shopId: props.shopId||uni.cache.get('shopId'),
|
||||||
|
nickName: formInfo.nickName,
|
||||||
|
headImg: userHeadImg.value,
|
||||||
|
phone: formInfo.telephone,
|
||||||
|
birthDay: formInfo.birthDay,
|
||||||
|
sex:formInfo.sex,
|
||||||
|
shopConfirm:idArr.join(',')
|
||||||
|
}
|
||||||
|
// await APIshopUser(submitForm)
|
||||||
|
await shopUserConfirm({
|
||||||
|
id:props.shopUserInfo.id,
|
||||||
|
shopId: props.shopId||uni.cache.get('shopId'),
|
||||||
|
nickName: formInfo.nickName,
|
||||||
|
headImg: userHeadImg.value,
|
||||||
|
phone: formInfo.telephone,
|
||||||
|
birthDay: formInfo.birthDay,
|
||||||
|
sex:formInfo.sex,
|
||||||
|
shopConfirm:idArr.join(',')
|
||||||
|
})
|
||||||
|
let APIshopUserInfores = await APIshopUserInfo({
|
||||||
|
shopId: props.shopId||uni.cache.get('shopId')
|
||||||
|
})
|
||||||
|
uni.cache.set('orderVIP', APIshopUserInfores)
|
||||||
|
uni.cache.set('ordershopUserInfo', APIshopUserInfores.shopInfo)
|
||||||
|
|
||||||
|
uni.showToast({
|
||||||
|
title:props.shopUserInfo.phone? '修改成功': '注册成功',
|
||||||
|
icon: 'none'
|
||||||
|
})
|
||||||
|
emits('update',APIshopUserInfores)
|
||||||
|
show.value=false
|
||||||
|
// 定义自定义事件
|
||||||
|
// setTimeout(() => {
|
||||||
|
// uni.navigateBack()
|
||||||
|
// }, 1500)
|
||||||
|
emits('emitsmemberOpen',submitForm);
|
||||||
|
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style lang="scss" scoped>
|
||||||
|
.u-datetime-picker {
|
||||||
|
height: 300px !important;
|
||||||
|
}
|
||||||
|
|
||||||
|
.register-member-wrap {
|
||||||
|
padding: 64rpx 24rpx;
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
|
||||||
|
.register-title {
|
||||||
|
font-weight: bold;
|
||||||
|
font-size: 36rpx;
|
||||||
|
color: #333333;
|
||||||
|
margin-bottom: 16rpx;
|
||||||
|
}
|
||||||
|
|
||||||
|
.register-tip {
|
||||||
|
font-weight: 400;
|
||||||
|
font-size: 24rpx;
|
||||||
|
color: #999999;
|
||||||
|
}
|
||||||
|
|
||||||
|
.register-content {
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
|
||||||
|
.reg-head {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: center;
|
||||||
|
margin-top: 64rpx;
|
||||||
|
|
||||||
|
.reg-head-img {
|
||||||
|
width: 120rpx;
|
||||||
|
height: 120rpx;
|
||||||
|
border-radius: 50%;
|
||||||
|
padding: 0;
|
||||||
|
position: relative;
|
||||||
|
}
|
||||||
|
|
||||||
|
.reg-head-edit {
|
||||||
|
width: 24rpx;
|
||||||
|
height: 24rpx;
|
||||||
|
position: absolute;
|
||||||
|
bottom: 0;
|
||||||
|
right: 14rpx;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.reg-cell {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
padding: 20rpx 0;
|
||||||
|
border-bottom: 2rpx solid #E5E5E5;
|
||||||
|
|
||||||
|
.lable {
|
||||||
|
width: 120rpx;
|
||||||
|
font-weight: 500;
|
||||||
|
font-size: 28rpx;
|
||||||
|
color: #333333;
|
||||||
|
}
|
||||||
|
|
||||||
|
.value {
|
||||||
|
font-weight: 400;
|
||||||
|
font-size: 28rpx;
|
||||||
|
color: #333;
|
||||||
|
padding: 12rpx 0 12rpx 18rpx;
|
||||||
|
}
|
||||||
|
|
||||||
|
.u-input {
|
||||||
|
input {
|
||||||
|
font-size: 28rpx !important;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.getPhone {
|
||||||
|
background-color: none;
|
||||||
|
border: 2rpx solid #E3AD7F;
|
||||||
|
color: #E3AD7F;
|
||||||
|
font-size: 24rpx;
|
||||||
|
padding: 5rpx 30rpx;
|
||||||
|
// #ifdef MP-ALIPAY
|
||||||
|
padding-top: 0;
|
||||||
|
display: initial;
|
||||||
|
height: 70rpx;
|
||||||
|
line-height: 70rpx;
|
||||||
|
box-sizing: border-box;
|
||||||
|
border-radius: 5rpx;
|
||||||
|
// #endif
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.agreement {
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
margin-top: 48rpx;
|
||||||
|
|
||||||
|
.agreement_tip {
|
||||||
|
font-weight: 400;
|
||||||
|
font-size: 24rpx;
|
||||||
|
color: #666666;
|
||||||
|
}
|
||||||
|
|
||||||
|
.agreement_item {
|
||||||
|
display: flex;
|
||||||
|
padding-top: 32rpx;
|
||||||
|
padding-bottom: 16rpx;
|
||||||
|
align-items: center;
|
||||||
|
|
||||||
|
.agreement_item_text {
|
||||||
|
font-weight: 500;
|
||||||
|
font-size: 24rpx;
|
||||||
|
color: #E3AD7F;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.register_btn {
|
||||||
|
width: 572rpx;
|
||||||
|
height: 90rpx;
|
||||||
|
line-height: 90rpx;
|
||||||
|
text-align: center;
|
||||||
|
background: #E3AD7F;
|
||||||
|
border-radius: 48rpx 48rpx 48rpx 48rpx;
|
||||||
|
font-weight: 500;
|
||||||
|
font-size: 36rpx;
|
||||||
|
color: #FFFFFF;
|
||||||
|
margin: 30rpx auto 0 auto;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</style>
|
||||||
@@ -202,8 +202,8 @@
|
|||||||
<view class="share" @click="showSharePopup = true">分享邀请</view>
|
<view class="share" @click="showSharePopup = true">分享邀请</view>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
|
|
||||||
<view class="u-m-t-32 join-text u-font-28" v-if="state.group&&state.group.isEnable" @click="showGroup=true" >
|
<view class="u-m-t-32 join-text u-font-28" v-if="state.group&&state.group.isEnable" @click="showGroup=true">
|
||||||
加入股东群,优惠、活动多多{{'>>'}}
|
加入股东群,优惠、活动多多{{'>>'}}
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
@@ -221,23 +221,34 @@
|
|||||||
<commissionPopup :tipsType="commissionTipsType" v-model="showCommission" :config="config"
|
<commissionPopup :tipsType="commissionTipsType" v-model="showCommission" :config="config"
|
||||||
:levelConfigList="config.levelConfigList || []"></commissionPopup>
|
:levelConfigList="config.levelConfigList || []"></commissionPopup>
|
||||||
<rulePopup v-model="showRule" :config="config" :distributionUser="state.distributionUser"></rulePopup>
|
<rulePopup v-model="showRule" :config="config" :distributionUser="state.distributionUser"></rulePopup>
|
||||||
<popupDistributionGroupCode :group="state.group" v-model="showGroup" v-model:shopInfo="shopUserInfo.shopInfo"></popupDistributionGroupCode>
|
<popupDistributionGroupCode :group="state.group" v-model="showGroup"></popupDistributionGroupCode>
|
||||||
<ymf-share-popup ></ymf-share-popup>
|
<ymf-share-popup></ymf-share-popup>
|
||||||
|
<view class="screen_mask" v-if="screen_mask_show" @click="memberOpen=true"></view>
|
||||||
|
<registermember v-model="memberOpen" @close="memberPopupClose" :shopUserInfo="shopUserInfo"
|
||||||
|
@update="shopUserInfoUpdate"
|
||||||
|
:shopId="options.shopId"></registermember>
|
||||||
</view>
|
</view>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script setup>
|
<script setup>
|
||||||
import popupDistributionGroupCode from '@/components/popup-distribution-group-code.vue';
|
import popupDistributionGroupCode from '@/components/popup-distribution-group-code.vue';
|
||||||
const showGroup=ref(false)
|
import registermember from '@/components/registermember.vue';
|
||||||
|
|
||||||
|
const showGroup = ref(false)
|
||||||
|
const memberOpen = ref(false)
|
||||||
|
|
||||||
|
function memberPopupClose() {
|
||||||
|
memberOpen.value = false
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
import {
|
import {
|
||||||
distributionClear
|
distributionClear
|
||||||
} from '@/common/api/market';
|
} from '@/common/api/market';
|
||||||
import {
|
import {
|
||||||
shareMixin,
|
shareMixin,
|
||||||
handleMixinOnLoad,wxShare,
|
handleMixinOnLoad,
|
||||||
|
wxShare,
|
||||||
returnQuery
|
returnQuery
|
||||||
} from '@/utils/share.js';
|
} from '@/utils/share.js';
|
||||||
import bindShangji from './components/bind-shangji.vue';
|
import bindShangji from './components/bind-shangji.vue';
|
||||||
@@ -283,6 +294,10 @@
|
|||||||
url: '/distribution/income-details/index?name=' + name + '&shopId=' + options.shopId
|
url: '/distribution/income-details/index?name=' + name + '&shopId=' + options.shopId
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function shopUserInfoUpdate(e){
|
||||||
|
shopUserInfo.value=e
|
||||||
|
}
|
||||||
|
|
||||||
function questionClick(title) {
|
function questionClick(title) {
|
||||||
if (title == '总收益') {
|
if (title == '总收益') {
|
||||||
@@ -434,8 +449,8 @@
|
|||||||
if (res.distributionId) {
|
if (res.distributionId) {
|
||||||
options.type = 'activates';
|
options.type = 'activates';
|
||||||
}
|
}
|
||||||
if(res.distributionUser&&!res.distributionUser.firstIn&&res.group&&res.group.isEnable){
|
if (res.distributionUser && !res.distributionUser.firstIn && res.group && res.group.isEnable) {
|
||||||
showGroup.value=true
|
showGroup.value = true
|
||||||
}
|
}
|
||||||
Object.assign(state, res);
|
Object.assign(state, res);
|
||||||
if (res.distributionUser) {
|
if (res.distributionUser) {
|
||||||
@@ -482,7 +497,7 @@
|
|||||||
parentPhone: '',
|
parentPhone: '',
|
||||||
parentName: '',
|
parentName: '',
|
||||||
shopName: '',
|
shopName: '',
|
||||||
group:{}
|
group: {}
|
||||||
});
|
});
|
||||||
|
|
||||||
const query = reactive({
|
const query = reactive({
|
||||||
@@ -620,7 +635,7 @@
|
|||||||
query
|
query
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
onLoad(async (opt) => {
|
onLoad(async (opt) => {
|
||||||
try {
|
try {
|
||||||
await handleMixinOnLoad(opt);
|
await handleMixinOnLoad(opt);
|
||||||
@@ -634,10 +649,23 @@
|
|||||||
console.log(options);
|
console.log(options);
|
||||||
await init();
|
await init();
|
||||||
getRecoders();
|
getRecoders();
|
||||||
|
const arr=shopUserInfo.value.shopConfirm.split(',')
|
||||||
|
if (!arr.includes(options.shopId)) {
|
||||||
|
memberOpen.value = true
|
||||||
|
}
|
||||||
|
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.log(error);
|
console.log(error);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
const screen_mask_show=computed(()=>{
|
||||||
|
const arr=shopUserInfo.value.shopConfirm.split(',')
|
||||||
|
if (!arr.includes(options.shopId)) {
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
return false
|
||||||
|
})
|
||||||
|
|
||||||
onReachBottom(async () => {
|
onReachBottom(async () => {
|
||||||
if (!isEnd.value) {
|
if (!isEnd.value) {
|
||||||
@@ -927,8 +955,18 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
.join-text{
|
|
||||||
|
.join-text {
|
||||||
color: #02bbf3;
|
color: #02bbf3;
|
||||||
text-align: center;
|
text-align: center;
|
||||||
}
|
}
|
||||||
|
.screen_mask{
|
||||||
|
position: fixed;
|
||||||
|
left: 0;
|
||||||
|
right:0;
|
||||||
|
top:0;
|
||||||
|
bottom: 0;
|
||||||
|
z-index: 9;
|
||||||
|
background: transparent;
|
||||||
|
}
|
||||||
</style>
|
</style>
|
||||||
@@ -379,6 +379,7 @@
|
|||||||
async function onPageShow() {
|
async function onPageShow() {
|
||||||
try {
|
try {
|
||||||
await storeuser.getLocation();
|
await storeuser.getLocation();
|
||||||
|
console.log('shopId.value',shopId.value);
|
||||||
proxy.$isResolve();
|
proxy.$isResolve();
|
||||||
shopId.value = uni.cache.get('shopId');
|
shopId.value = uni.cache.get('shopId');
|
||||||
if (shopId.value) {
|
if (shopId.value) {
|
||||||
@@ -386,6 +387,7 @@
|
|||||||
}
|
}
|
||||||
} catch (error) {}
|
} catch (error) {}
|
||||||
await proxy.$onLaunched;
|
await proxy.$onLaunched;
|
||||||
|
console.log('shopId.value',shopId.value);
|
||||||
if (shopId.value) {
|
if (shopId.value) {
|
||||||
showindex.value = 'shopIndex';
|
showindex.value = 'shopIndex';
|
||||||
await storeuser.actionsproductqueryProduct();
|
await storeuser.actionsproductqueryProduct();
|
||||||
|
|||||||
@@ -26,7 +26,7 @@
|
|||||||
<text class="u-m-l-22">积分:{{ allConfig.pointNum }}</text>
|
<text class="u-m-l-22">积分:{{ allConfig.pointNum }}</text>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
<image :src="imgs.code" class="code"></image>
|
<!-- <image :src="imgs.code" class="code"></image> -->
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
<view class="new-menus-box">
|
<view class="new-menus-box">
|
||||||
|
|||||||
@@ -130,9 +130,19 @@
|
|||||||
</up-button>
|
</up-button>
|
||||||
</template>
|
</template>
|
||||||
</view>
|
</view>
|
||||||
<view class="fixedview_tow" @tap="$u.debounce(istoricalorders, 1000)">
|
<template v-if="!loading">
|
||||||
{{ paymentmethod ? paymentmethod.name : "" }}
|
<template v-if="cartStore.shopInfo.isUserPay">
|
||||||
</view>
|
<view class="fixedview_tow" @tap="$u.debounce(istoricalorders, 1000)">
|
||||||
|
{{ paymentmethod ? paymentmethod.name : "" }}
|
||||||
|
</view>
|
||||||
|
</template>
|
||||||
|
<template v-else>
|
||||||
|
<view class="fixedview_tow disabled">
|
||||||
|
请前往吧台支付
|
||||||
|
</view>
|
||||||
|
</template>
|
||||||
|
</template>
|
||||||
|
|
||||||
<!-- <view class="fixedview_tows" @tap="$u.debounce(APIputuserorderclick,1000)">
|
<!-- <view class="fixedview_tows" @tap="$u.debounce(APIputuserorderclick,1000)">
|
||||||
取消订单
|
取消订单
|
||||||
</view> -->
|
</view> -->
|
||||||
@@ -326,8 +336,8 @@
|
|||||||
shop_id: uni.cache.get("shopId"),
|
shop_id: uni.cache.get("shopId"),
|
||||||
time_dis_info: null
|
time_dis_info: null
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
function socketInit() {
|
function socketInit() {
|
||||||
cartsSocket = useWebSocket();
|
cartsSocket = useWebSocket();
|
||||||
@@ -1030,15 +1040,15 @@
|
|||||||
// 跳转到加菜页面
|
// 跳转到加菜页面
|
||||||
function toJiacai() {
|
function toJiacai() {
|
||||||
console.log("跳转到加菜页面");
|
console.log("跳转到加菜页面");
|
||||||
const arr= getCurrentPages()
|
const arr = getCurrentPages()
|
||||||
console.log(arr);
|
console.log(arr);
|
||||||
if(arr.length>=2&&arr[arr.length-2]&&arr[arr.length-2].route=='pages/product/index'){
|
if (arr.length >= 2 && arr[arr.length - 2] && arr[arr.length - 2].route == 'pages/product/index') {
|
||||||
back();
|
back();
|
||||||
}else{
|
} else {
|
||||||
uni.cache.set('tableCode',listinfo.tableCode)
|
uni.cache.set('tableCode', listinfo.tableCode)
|
||||||
uni.cache.set('shopId',listinfo.shopId)
|
uni.cache.set('shopId', listinfo.shopId)
|
||||||
uni.redirectTo({
|
uni.redirectTo({
|
||||||
url:'/pages/product/index?noJump=1'
|
url: '/pages/product/index?noJump=1'
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1111,11 +1121,13 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
const limitTimeDiscountRes = ref(null)
|
const limitTimeDiscountRes = ref(null)
|
||||||
const rechargeConfig=ref(null)
|
const rechargeConfig = ref(null)
|
||||||
|
|
||||||
|
const loading=ref(true)
|
||||||
async function init(opt) {
|
async function init(opt) {
|
||||||
const res1= await storeuser.actionsproductqueryProduct();
|
const res1 = await storeuser.actionsproductqueryProduct();
|
||||||
orderVIP.value=res1
|
orderVIP.value = res1
|
||||||
console.log('orderVIP',orderVIP.value)
|
console.log('orderVIP', orderVIP.value)
|
||||||
cartStore.clearOrderConfig();
|
cartStore.clearOrderConfig();
|
||||||
Object.assign(options, opt);
|
Object.assign(options, opt);
|
||||||
listinfo.id = options.orderId;
|
listinfo.id = options.orderId;
|
||||||
@@ -1145,22 +1157,24 @@
|
|||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//获取台桌信息
|
//获取台桌信息
|
||||||
let tableRes = await getTableInfo({
|
let tableRes = await getTableInfo({
|
||||||
tableCode: options.tableCode || "",
|
tableCode: options.tableCode || "",
|
||||||
});
|
});
|
||||||
console.log("tableRes", tableRes);
|
console.log("tableRes", tableRes);
|
||||||
listinfo.tableName = tableRes?tableRes.name:'';
|
listinfo.tableName = tableRes ? tableRes.name : '';
|
||||||
|
|
||||||
//获取店铺信息
|
//获取店铺信息
|
||||||
const shopInfoRes = await APIusershopInfodetail({
|
const shopInfoRes = await APIusershopInfodetail({
|
||||||
shopId: options.shopId,
|
shopId: options.shopId,
|
||||||
});
|
});
|
||||||
//智慧充值
|
//智慧充值
|
||||||
const rechargeConfigRes=await rechargeApi.config({shopId: options.shopId})
|
const rechargeConfigRes = await rechargeApi.config({
|
||||||
if(rechargeConfigRes&&typeof rechargeConfigRes ==='object'){
|
shopId: options.shopId
|
||||||
rechargeConfig.value=rechargeConfigRes
|
})
|
||||||
|
if (rechargeConfigRes && typeof rechargeConfigRes === 'object') {
|
||||||
|
rechargeConfig.value = rechargeConfigRes
|
||||||
}
|
}
|
||||||
//获取积分配置
|
//获取积分配置
|
||||||
pointsApi.pointsConfig().then(res => {
|
pointsApi.pointsConfig().then(res => {
|
||||||
@@ -1179,6 +1193,7 @@
|
|||||||
if (shopInfoRes) {
|
if (shopInfoRes) {
|
||||||
cartStore.shopInfo = shopInfoRes.shopInfo;
|
cartStore.shopInfo = shopInfoRes.shopInfo;
|
||||||
}
|
}
|
||||||
|
loading.value=false
|
||||||
await cartStore.goodsInit();
|
await cartStore.goodsInit();
|
||||||
// * 获取会员信息
|
// * 获取会员信息
|
||||||
await nextTick();
|
await nextTick();
|
||||||
@@ -1286,7 +1301,7 @@
|
|||||||
if (!isCanUseCharge.value) {
|
if (!isCanUseCharge.value) {
|
||||||
arr.add("余额支付");
|
arr.add("余额支付");
|
||||||
}
|
}
|
||||||
if(rechargeConfig.value&&!rechargeConfig.value.isEnable){
|
if (rechargeConfig.value && !rechargeConfig.value.isEnable) {
|
||||||
arr.add("余额支付");
|
arr.add("余额支付");
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1296,12 +1311,12 @@
|
|||||||
watch(() => cartStore.limitTimeDiscount, (newval, oldval) => {
|
watch(() => cartStore.limitTimeDiscount, (newval, oldval) => {
|
||||||
|
|
||||||
})
|
})
|
||||||
|
|
||||||
watch(()=>cartStore.limitTimeDiscount,(newval)=>{
|
watch(() => cartStore.limitTimeDiscount, (newval) => {
|
||||||
socketInitPar.time_dis_info=newval
|
socketInitPar.time_dis_info = newval
|
||||||
},{
|
}, {
|
||||||
deep:true,
|
deep: true,
|
||||||
immediate:true
|
immediate: true
|
||||||
})
|
})
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -1813,7 +1828,16 @@
|
|||||||
font-weight: 400;
|
font-weight: 400;
|
||||||
font-size: 32rpx;
|
font-size: 32rpx;
|
||||||
color: #ffffff;
|
color: #ffffff;
|
||||||
padding: 14rpx 44rpx;
|
padding: 0 44rpx;
|
||||||
|
min-height: 72rpx;
|
||||||
|
line-height: 72rpx;
|
||||||
|
box-sizing: border-box;
|
||||||
|
&.disabled {
|
||||||
|
background-color: #eee;
|
||||||
|
color: #999;
|
||||||
|
font-size: 24rpx;
|
||||||
|
text-align: center;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.fixedview_tows {
|
.fixedview_tows {
|
||||||
|
|||||||
@@ -62,14 +62,13 @@
|
|||||||
<view class="shop-info">
|
<view class="shop-info">
|
||||||
<view class="shop-item">
|
<view class="shop-item">
|
||||||
<view class="cover" v-for="(item1,index1) in item.goods" :key="index1">
|
<view class="cover" v-for="(item1,index1) in item.goods" :key="index1">
|
||||||
|
|
||||||
<u-image width="56" height="56" radius="10" :src="item1.productImg"
|
<u-image width="56" height="56" radius="10" :src="item1.productImg"
|
||||||
v-if="!item1.isTemporary"></u-image>
|
v-if="!item1.isTemporary"></u-image>
|
||||||
|
|
||||||
<u-image width="56" height="56" radius="10"
|
<u-image width="56" height="56" radius="10"
|
||||||
v-else-if="item1.isTemporary &&item1.productName=='签子'"
|
v-else-if="item1.isTemporary &&item1.productName=='签子'"
|
||||||
src="https://cashier-oss.oss-cn-beijing.aliyuncs.com/upload/5/b97054debd83486ab7ad8e20ca6a360a.png"
|
src="https://cashier-oss.oss-cn-beijing.aliyuncs.com/upload/5/b97054debd83486ab7ad8e20ca6a360a.png"></u-image>
|
||||||
></u-image>
|
|
||||||
<u-image width="56" height="56" radius="10"
|
<u-image width="56" height="56" radius="10"
|
||||||
:src="'https://czg-qr-order.oss-cn-beijing.aliyuncs.com/confirmOrder/table.png'"
|
:src="'https://czg-qr-order.oss-cn-beijing.aliyuncs.com/confirmOrder/table.png'"
|
||||||
mode="heightFix" v-else></u-image>
|
mode="heightFix" v-else></u-image>
|
||||||
@@ -91,8 +90,27 @@
|
|||||||
<view class="footer-wrap">
|
<view class="footer-wrap">
|
||||||
<view class="btn" @click.stop="$u.debounce(isRemoveOrder(item,index),1000)"
|
<view class="btn" @click.stop="$u.debounce(isRemoveOrder(item,index),1000)"
|
||||||
v-if="item.status == 'done' || item.status == 'cancelled'"> 删除订单 </view>
|
v-if="item.status == 'done' || item.status == 'cancelled'"> 删除订单 </view>
|
||||||
<view class="btn s" @click.stop="$u.debounce(orderinfo(item),1000)"
|
<template v-if="shopInfo&&shopInfo.id">
|
||||||
v-if="item.status == 'unpaid' || item.status == 'paying'"> 去付款 </view>
|
<template v-if="shopInfo.id==item.shopId">
|
||||||
|
<template v-if="shopInfo.isUserPay">
|
||||||
|
<view class="btn s" @click.stop="$u.debounce(orderinfo(item),1000)"
|
||||||
|
v-if="item.status == 'unpaid' || item.status == 'paying'"> 去付款 </view>
|
||||||
|
</template>
|
||||||
|
<template v-else>
|
||||||
|
<view class="btn s disabled" @click.stop="()=>{}"
|
||||||
|
v-if="item.status == 'unpaid' || item.status == 'paying'"> 请前往吧台支付 </view>
|
||||||
|
</template>
|
||||||
|
</template>
|
||||||
|
<template v-else>
|
||||||
|
<view class="btn s" @click.stop="$u.debounce(orderinfo(item),1000)"
|
||||||
|
v-if="item.status == 'unpaid' || item.status == 'paying'"> 去付款 </view>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
</template>
|
||||||
|
<template v-else>
|
||||||
|
<view class="btn s" @click.stop="$u.debounce(orderinfo(item),1000)"
|
||||||
|
v-if="item.status == 'unpaid' || item.status == 'paying'"> 去付款 </view>
|
||||||
|
</template>
|
||||||
|
|
||||||
<view class="btn s" @click.stop="agignOrder(item)" v-if="item.status != 'unpaid'"> 再来一单 </view>
|
<view class="btn s" @click.stop="agignOrder(item)" v-if="item.status != 'unpaid'"> 再来一单 </view>
|
||||||
</view>
|
</view>
|
||||||
@@ -151,7 +169,7 @@
|
|||||||
uni.cache.set("shopId", item.shopId);
|
uni.cache.set("shopId", item.shopId);
|
||||||
uni.navigateTo({
|
uni.navigateTo({
|
||||||
url: "/pages/product/index?type=beforehand&order_id=" + item.id +
|
url: "/pages/product/index?type=beforehand&order_id=" + item.id +
|
||||||
'&one_more_order=1&shopId='+item.shopId,
|
'&one_more_order=1&shopId=' + item.shopId,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
@@ -167,6 +185,8 @@
|
|||||||
}, 0)
|
}, 0)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const shopInfo = uni.cache.get('shopInfo')
|
||||||
|
|
||||||
function isRemoveOrder(item) {
|
function isRemoveOrder(item) {
|
||||||
uni.showModal({
|
uni.showModal({
|
||||||
title: '提示',
|
title: '提示',
|
||||||
@@ -523,6 +543,12 @@
|
|||||||
font-size: 24rpx;
|
font-size: 24rpx;
|
||||||
color: #333333;
|
color: #333333;
|
||||||
margin-left: 32rpx;
|
margin-left: 32rpx;
|
||||||
|
|
||||||
|
&.disabled {
|
||||||
|
background-color: #eee;
|
||||||
|
color: #999;
|
||||||
|
text-align: center;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.s {
|
.s {
|
||||||
|
|||||||
@@ -356,6 +356,17 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
cartNumber:{
|
||||||
|
//当前购物车数量
|
||||||
|
type:Number,
|
||||||
|
default:0
|
||||||
|
},
|
||||||
|
consStockList:{
|
||||||
|
type:Array,
|
||||||
|
default:()=>{
|
||||||
|
return []
|
||||||
|
}
|
||||||
|
},
|
||||||
GoodsIDInCartNumMap: {
|
GoodsIDInCartNumMap: {
|
||||||
type: Object,
|
type: Object,
|
||||||
default: () => {
|
default: () => {
|
||||||
@@ -647,7 +658,34 @@
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
// 封装成 Promise 的确认弹窗
|
||||||
|
const showConfirmModal = (title, content) => {
|
||||||
|
return new Promise((resolve) => {
|
||||||
|
uni.showModal({
|
||||||
|
title: title,
|
||||||
|
content: content,
|
||||||
|
showCancel: true,
|
||||||
|
cancelText: '取消添加',
|
||||||
|
confirmText: '继续',
|
||||||
|
success(res) {
|
||||||
|
// 确认返回 true,取消/关闭返回 false
|
||||||
|
resolve(res.confirm === true);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
});
|
||||||
|
};
|
||||||
|
// 提取合并 orderinfo.detailMap 数组的逻辑
|
||||||
|
function combineOrderInfoDetailMap(orderinfo) {
|
||||||
|
if (!orderinfo) return [];
|
||||||
|
let combinedArray = [];
|
||||||
|
for (const key in orderinfo.detailMap) {
|
||||||
|
if (orderinfo.detailMap.hasOwnProperty(key)) {
|
||||||
|
let subArray = orderinfo.detailMap[key];
|
||||||
|
combinedArray = [...combinedArray, ...subArray];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return combinedArray;
|
||||||
|
}
|
||||||
// 提交选择并执行下一步操作的方法
|
// 提交选择并执行下一步操作的方法
|
||||||
const submitSelection = async (goods) => {
|
const submitSelection = async (goods) => {
|
||||||
if (!isProductAvailable(goods.days, goods.startTime,
|
if (!isProductAvailable(goods.days, goods.startTime,
|
||||||
@@ -664,7 +702,7 @@
|
|||||||
if (goods.type == 'package' && goods.groupType != 0 && !allConditionsSatisfied.value) {
|
if (goods.type == 'package' && goods.groupType != 0 && !allConditionsSatisfied.value) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
const oldGoodsArr = combineOrderInfoDetailMap(props.orderinfo)
|
||||||
if ((goods.type == 'package' && allConditionsSatisfied.value) || (goods.type ==
|
if ((goods.type == 'package' && allConditionsSatisfied.value) || (goods.type ==
|
||||||
'sku' && canSubmit.value)) {
|
'sku' && canSubmit.value)) {
|
||||||
let res = null;
|
let res = null;
|
||||||
@@ -688,6 +726,30 @@
|
|||||||
sku_id = selSku.value.id
|
sku_id = selSku.value.id
|
||||||
}
|
}
|
||||||
console.log('goods', goods);
|
console.log('goods', goods);
|
||||||
|
console.log('res',res);
|
||||||
|
const number=await calculateValue(res?res.number:0, '+', shopCartNumber.value)
|
||||||
|
console.log('number',number);
|
||||||
|
console.log('shopCartNumber',shopCartNumber.value);
|
||||||
|
if(res && number*1===2){
|
||||||
|
const isConfirm = await showConfirmModal(
|
||||||
|
'购物车已有该商品,请确认是否重复',
|
||||||
|
'菜品名称:《' + goods.name + '》'
|
||||||
|
);
|
||||||
|
if (!isConfirm) {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (oldGoodsArr.find(v => v.productId == goods.id)) {
|
||||||
|
// 等待用户点击
|
||||||
|
const isConfirm = await showConfirmModal(
|
||||||
|
'该商品已下单过,请确认是否重复',
|
||||||
|
'菜品名称:《' + goods.name + '》'
|
||||||
|
);
|
||||||
|
if (!isConfirm) {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
emits('websocketsendMessage', {
|
emits('websocketsendMessage', {
|
||||||
id: res ? res.id : '',
|
id: res ? res.id : '',
|
||||||
type: 'shopping',
|
type: 'shopping',
|
||||||
@@ -697,7 +759,7 @@
|
|||||||
operate_type: res ? 'edit' : 'add',
|
operate_type: res ? 'edit' : 'add',
|
||||||
product_id: goods.id,
|
product_id: goods.id,
|
||||||
sku_id,
|
sku_id,
|
||||||
number: res ? await calculateValue(res.cartNumber, '+', shopCartNumber.value) :
|
number: res ? number:
|
||||||
shopCartNumber.value,
|
shopCartNumber.value,
|
||||||
pro_group_info: returnSelectedGroupSnap(),
|
pro_group_info: returnSelectedGroupSnap(),
|
||||||
goods_type: goods.type == 'package' ? 'package' : '',
|
goods_type: goods.type == 'package' ? 'package' : '',
|
||||||
@@ -708,6 +770,27 @@
|
|||||||
})
|
})
|
||||||
} else {
|
} else {
|
||||||
let res = cartStore.carts.find(cart => cart.product_id == goods.id && goods.skuList[0].id)
|
let res = cartStore.carts.find(cart => cart.product_id == goods.id && goods.skuList[0].id)
|
||||||
|
const number=await calculateValue(res?res.number:0, '+', shopCartNumber.value)
|
||||||
|
console.log('number',number);
|
||||||
|
if(res && number*1===2){
|
||||||
|
const isConfirm = await showConfirmModal(
|
||||||
|
'购物车已有该商品,请确认是否重复',
|
||||||
|
'菜品名称:《' + goods.name + '》'
|
||||||
|
);
|
||||||
|
if (!isConfirm) {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (oldGoodsArr.find(v => v.productId == goods.id)) {
|
||||||
|
// 等待用户点击
|
||||||
|
const isConfirm = await showConfirmModal(
|
||||||
|
'该商品已下单过,请确认是否重复',
|
||||||
|
'菜品名称:《' + goods.name + '》'
|
||||||
|
);
|
||||||
|
if (!isConfirm) {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
}
|
||||||
emits('websocketsendMessage', {
|
emits('websocketsendMessage', {
|
||||||
id: res ? res.id : '',
|
id: res ? res.id : '',
|
||||||
type: 'shopping',
|
type: 'shopping',
|
||||||
@@ -717,7 +800,7 @@
|
|||||||
operate_type: res ? 'edit' : 'add',
|
operate_type: res ? 'edit' : 'add',
|
||||||
product_id: goods.id,
|
product_id: goods.id,
|
||||||
sku_id: goods.skuList[0].id,
|
sku_id: goods.skuList[0].id,
|
||||||
number: res ? await calculateValue(res.cartNumber, '+', shopCartNumber.value) :
|
number: res ? number:
|
||||||
shopCartNumber.value,
|
shopCartNumber.value,
|
||||||
memberPrice: goods.memberPrice,
|
memberPrice: goods.memberPrice,
|
||||||
is_print: 1,
|
is_print: 1,
|
||||||
@@ -738,13 +821,39 @@
|
|||||||
return limitUtils.canUseLimitTimeDiscount(item, cartStore.limitTimeDiscount, shopInfo, shopUserInfo.value, 'id') ?
|
return limitUtils.canUseLimitTimeDiscount(item, cartStore.limitTimeDiscount, shopInfo, shopUserInfo.value, 'id') ?
|
||||||
1 : 0;
|
1 : 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function returnStockNumber(item) {
|
||||||
|
if (!item.isAutoSoldStock) {
|
||||||
|
return 9999
|
||||||
|
}
|
||||||
|
const consList = item.consList
|
||||||
|
const matchStockList = props.consStockList.filter(v => {
|
||||||
|
return consList.find(c => c.consInfoId == v.consId)
|
||||||
|
}).map(v => {
|
||||||
|
const cItem = item.consList.find(c => c.consInfoId == v.consId)
|
||||||
|
const goodsNumber = Math.floor(v.stockNumber / cItem.surplusStock)
|
||||||
|
return {
|
||||||
|
...v,
|
||||||
|
goodsNumber
|
||||||
|
}
|
||||||
|
}).sort((a, b) => {
|
||||||
|
return a.goodsNumber - b.goodsNumber
|
||||||
|
})
|
||||||
|
|
||||||
|
const minConsStockNumber = matchStockList[0] ? matchStockList[0].goodsNumber : 9999
|
||||||
|
return minConsStockNumber
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
// 多规格 套餐 单规格添加数量
|
// 多规格 套餐 单规格添加数量
|
||||||
const shopCart = async (i) => {
|
const shopCart = async (i) => {
|
||||||
if (i == '-' && shopCartNumber.value <= (props.goods.suitNum || 1)) {
|
if (i == '-' && shopCartNumber.value <= (props.goods.suitNum || 1)) {
|
||||||
shopCartNumber.value = 0;
|
shopCartNumber.value = 0;
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const stockNumber=returnStockNumber(props.goods)-(props.cartNumber||0)
|
||||||
|
console.log('stockNumber',stockNumber);
|
||||||
let res = null
|
let res = null
|
||||||
|
|
||||||
if (i == '-') {
|
if (i == '-') {
|
||||||
@@ -760,15 +869,34 @@
|
|||||||
} else {
|
} else {
|
||||||
|
|
||||||
if (!res && shopCartNumber.value < 1) {
|
if (!res && shopCartNumber.value < 1) {
|
||||||
|
|
||||||
if (props.goods.type == 'sku') {
|
if (props.goods.type == 'sku') {
|
||||||
if (!selSku.value) {
|
if (!selSku.value) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
if(stockNumber<selSku.value.suitNum){
|
||||||
|
return uni.showToast({
|
||||||
|
title:'商品库存不足!',
|
||||||
|
icon:'error'
|
||||||
|
})
|
||||||
|
}
|
||||||
shopCartNumber.value = parseFloat(selSku.value.suitNum);
|
shopCartNumber.value = parseFloat(selSku.value.suitNum);
|
||||||
} else {
|
} else {
|
||||||
|
if(stockNumber<props.goods.suitNum){
|
||||||
|
return uni.showToast({
|
||||||
|
title:'商品库存不足!',
|
||||||
|
icon:'error'
|
||||||
|
})
|
||||||
|
}
|
||||||
shopCartNumber.value = parseFloat(props.goods.suitNum);
|
shopCartNumber.value = parseFloat(props.goods.suitNum);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
if(shopCartNumber.value>=stockNumber){
|
||||||
|
return uni.showToast({
|
||||||
|
title:'商品库存不足!',
|
||||||
|
icon:'error'
|
||||||
|
})
|
||||||
|
}
|
||||||
shopCartNumber.value++;
|
shopCartNumber.value++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -58,13 +58,11 @@
|
|||||||
限时折扣{{ limitDiscountCountdown }}</view>
|
限时折扣{{ limitDiscountCountdown }}</view>
|
||||||
<!-- <view class="limitDiscount" v-if="item.is_time_discount">
|
<!-- <view class="limitDiscount" v-if="item.is_time_discount">
|
||||||
限时折扣{{ limitDiscountCountdown }}</view> -->
|
限时折扣{{ limitDiscountCountdown }}</view> -->
|
||||||
<view class="stock_warning"
|
<view class="stock_warning" v-if="showStockNumber(item)&& !showNoBuy(item)">
|
||||||
v-if="item.isStock&&item.stockNumber<=10&&item.stockNumber>0">
|
仅剩{{returnStockNumber(item)}}份</view>
|
||||||
仅剩{{item.stockNumber}}份</view>
|
|
||||||
</view>
|
</view>
|
||||||
|
|
||||||
<view class="vifgoodsImg flex-center"
|
<view class="vifgoodsImg flex-center" v-if="showNoBuy(item)">
|
||||||
v-if="item.isSale == 0 || (item.isSaleTime == 0 && !item.isSaleTimeshow) || item.isSoldStock == 1 || (item.isStock == 1 && item.stockNumber <= 0)">
|
|
||||||
<image v-if="item.isSale == 0" src="@/static/ztt/icon_goods_yxj.svg"
|
<image v-if="item.isSale == 0" src="@/static/ztt/icon_goods_yxj.svg"
|
||||||
style="width: 200rpx; height: 100%" mode=""></image>
|
style="width: 200rpx; height: 100%" mode=""></image>
|
||||||
<image v-else-if="item.isSaleTime == 0 && !item.isSaleTimeshow"
|
<image v-else-if="item.isSaleTime == 0 && !item.isSaleTimeshow"
|
||||||
@@ -72,8 +70,8 @@
|
|||||||
</image>
|
</image>
|
||||||
<image v-else-if="item.isSoldStock == 1" src="@/static/ztt/icon_goods_sq.svg"
|
<image v-else-if="item.isSoldStock == 1" src="@/static/ztt/icon_goods_sq.svg"
|
||||||
style="width: 200rpx; height: 100%" mode=""></image>
|
style="width: 200rpx; height: 100%" mode=""></image>
|
||||||
<image v-else-if="item.isStock == 1 && item.stockNumber <= 0"
|
<image v-else src="@/static/ztt/icon_goods_kcbz.svg" style="width: 200rpx; height: 100%"
|
||||||
src="@/static/ztt/icon_goods_kcbz.svg" style="width: 200rpx; height: 100%" mode="">
|
mode="">
|
||||||
</image>
|
</image>
|
||||||
</view>
|
</view>
|
||||||
<view class="u-flex u-m-t-32 u-row-between">
|
<view class="u-flex u-m-t-32 u-row-between">
|
||||||
@@ -201,13 +199,11 @@
|
|||||||
style="width:600rpx;height: 188rpx;"></image>
|
style="width:600rpx;height: 188rpx;"></image>
|
||||||
<view class="absolute swiper-mask" @click.stop="swiperClick(scope.item)">
|
<view class="absolute swiper-mask" @click.stop="swiperClick(scope.item)">
|
||||||
<view class="share-btn-box" v-if="showShare(scope.item)">
|
<view class="share-btn-box" v-if="showShare(scope.item)">
|
||||||
<ymf-share
|
<ymf-share @shareClick="shareBtnClick(scope.item)">
|
||||||
@shareClick="shareBtnClick(scope.item)"
|
|
||||||
>
|
|
||||||
<view class="share-btn">分享</view>
|
<view class="share-btn">分享</view>
|
||||||
</ymf-share>
|
</ymf-share>
|
||||||
</view>
|
</view>
|
||||||
|
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
|
|
||||||
@@ -236,17 +232,11 @@
|
|||||||
|
|
||||||
<!-- <view class="limitDiscount" v-if="item1.is_time_discount">
|
<!-- <view class="limitDiscount" v-if="item1.is_time_discount">
|
||||||
限时折扣{{ limitDiscountCountdown }}</view> -->
|
限时折扣{{ limitDiscountCountdown }}</view> -->
|
||||||
<view class="stock_warning"
|
<view class="stock_warning" v-if="showStockNumber(item1)&&!showNoBuy(item1)">
|
||||||
v-if="item1.isStock&&item1.stockNumber<=10&&item.stockNumber>0">
|
仅剩{{returnStockNumber(item1)}}份</view>
|
||||||
仅剩{{item1.stockNumber}}份</view>
|
|
||||||
</view>
|
</view>
|
||||||
|
|
||||||
<view class="vifgoodsImg" v-if="
|
<view class="vifgoodsImg" v-if="showNoBuy(item1)">
|
||||||
item1.isSale == 0 ||
|
|
||||||
(item1.isSaleTime == 0 && !item1.isSaleTimeshow) ||
|
|
||||||
item1.isSoldStock == 1 ||
|
|
||||||
(item1.isStock == 1 && item1.stockNumber <= 0)
|
|
||||||
">
|
|
||||||
<image v-if="item1.isSale == 0" src="@/static/ztt/icon_goods_yxj.svg"
|
<image v-if="item1.isSale == 0" src="@/static/ztt/icon_goods_yxj.svg"
|
||||||
style="width: 200rpx; height: 100%" mode=""></image>
|
style="width: 200rpx; height: 100%" mode=""></image>
|
||||||
<image v-else-if="item1.isSaleTime == 0 && !item1.isSaleTimeshow"
|
<image v-else-if="item1.isSaleTime == 0 && !item1.isSaleTimeshow"
|
||||||
@@ -254,9 +244,8 @@
|
|||||||
mode=""></image>
|
mode=""></image>
|
||||||
<image v-else-if="item1.isSoldStock == 1" src="@/static/ztt/icon_goods_sq.svg"
|
<image v-else-if="item1.isSoldStock == 1" src="@/static/ztt/icon_goods_sq.svg"
|
||||||
style="width: 200rpx; height: 100%" mode=""></image>
|
style="width: 200rpx; height: 100%" mode=""></image>
|
||||||
<image v-else-if="item1.isStock == 1 && item1.stockNumber <= 0"
|
<image v-else src="@/static/ztt/icon_goods_kcbz.svg"
|
||||||
src="@/static/ztt/icon_goods_kcbz.svg" style="width: 200rpx; height: 100%"
|
style="width: 200rpx; height: 100%" mode=""></image>
|
||||||
mode=""></image>
|
|
||||||
</view>
|
</view>
|
||||||
|
|
||||||
<view v-if="index == '0'" class="topSort" :class="'c' + (index1 + 1)">
|
<view v-if="index == '0'" class="topSort" :class="'c' + (index1 + 1)">
|
||||||
@@ -378,7 +367,7 @@
|
|||||||
<text class="allDiscountMoney" v-if="allDiscountMoney * 1 > 0">共减¥{{ allDiscountMoney }}</text>
|
<text class="allDiscountMoney" v-if="allDiscountMoney * 1 > 0">共减¥{{ allDiscountMoney }}</text>
|
||||||
</view>
|
</view>
|
||||||
<view class="btn" @tap="$u.debounce(orderdetail, 500)" v-if="orderType == 'scan'">
|
<view class="btn" @tap="$u.debounce(orderdetail, 500)" v-if="orderType == 'scan'">
|
||||||
<text class="t">结算</text>
|
<text class="t">去下单</text>
|
||||||
</view>
|
</view>
|
||||||
<view class="btn" v-else>
|
<view class="btn" v-else>
|
||||||
<u-button type="primary" shape="circle" plain @click="beforehandHandle">扫码下单</u-button>
|
<u-button type="primary" shape="circle" plain @click="beforehandHandle">扫码下单</u-button>
|
||||||
@@ -401,193 +390,7 @@
|
|||||||
</view>
|
</view>
|
||||||
|
|
||||||
<!-- 规格 -->
|
<!-- 规格 -->
|
||||||
<up-popup :show="showShopsku" :round="20" mode="bottom" @close="(showShopsku = false), (pagemetashow = false)">
|
|
||||||
<view class="shop_sku">
|
|
||||||
<scroll-view scroll-y style="max-height: 60vh; width: 100%">
|
|
||||||
<view class="positionabsolute">
|
|
||||||
<up-icon name="close-circle" @click="
|
|
||||||
showShopsku = false;
|
|
||||||
pagemetashow = false;
|
|
||||||
" color="#000" size="25"></up-icon>
|
|
||||||
</view>
|
|
||||||
<up-swiper :list="specifications.item.images" @change="swiperChange" :current="swiperCurrent"
|
|
||||||
radius="6px" height="250"
|
|
||||||
@click="prveImgs(specifications.item.images, specifications.item.images[swiperCurrent])">
|
|
||||||
<!-- <template v-slot:default="{item}">
|
|
||||||
<image :src=item></image>
|
|
||||||
</templte> -->
|
|
||||||
</up-swiper>
|
|
||||||
|
|
||||||
<view class="shop_sku_name">{{ specifications.item.name }}</view>
|
|
||||||
<view class="shop_sku_description" v-if="isSkuGoods">
|
|
||||||
{{ specifications.item.shortTitle ? specifications.item.shortTitle : '' }}
|
|
||||||
</view>
|
|
||||||
<view v-if="specifications.item.type != 'package'">
|
|
||||||
<view class="shop_sku_box" v-for="(specOptions, specType) in specifications.item.selectSpecInfo"
|
|
||||||
:key="specType">
|
|
||||||
<view class="shop_sku_box_name">
|
|
||||||
{{ specType }}
|
|
||||||
</view>
|
|
||||||
<view class="flex-start">
|
|
||||||
<view class="shop_sku_box_item" v-for="option in specOptions" :key="option"
|
|
||||||
@click="selectSpec(specType, option)" :class="{
|
|
||||||
shop_sku_box_item_selected: isSkuSelected(specType, option)
|
|
||||||
}">
|
|
||||||
{{ option }}
|
|
||||||
<view class="shop_sku_box_item_tip"
|
|
||||||
v-if="specifications.item.result && specifications.item.result.isSoldStock == 1 && selectedSpecs[specType] === option">
|
|
||||||
<view>售罄</view>
|
|
||||||
</view>
|
|
||||||
<view class="shop_sku_box_item_tip"
|
|
||||||
v-if="specifications.item.result == 'kong' && canSubmit == false && selectedSpecs[specType] === option">
|
|
||||||
<view>已下架</view>
|
|
||||||
</view>
|
|
||||||
</view>
|
|
||||||
</view>
|
|
||||||
</view>
|
|
||||||
</view>
|
|
||||||
<!-- 套餐 -->
|
|
||||||
<view v-else>
|
|
||||||
<view class="shop_sku_box">
|
|
||||||
<view v-for="(setmenu, setmenuindex) in specifications.item.groupSnap" :key="setmenuindex">
|
|
||||||
<view class="shop_sku_box_name">{{ setmenu.title }} {{ setmenu.count }}
|
|
||||||
选{{ setmenu.number }}</view>
|
|
||||||
<view class="flex-start">
|
|
||||||
<view class="shop_sku_box_item" v-for="(option, goodsid) in setmenu.goods"
|
|
||||||
:key="goodsid" @click="goodsidClick(setmenuindex, option, goodsid)" :class="{
|
|
||||||
shop_sku_box_item_selected: isOptionSelected(setmenuindex, option)
|
|
||||||
}" :disabled="isMaxSelected(setmenuindex) && !isOptionSelected(setmenuindex, option)">
|
|
||||||
{{ option.proName }}
|
|
||||||
<text v-if="option.unitName">/{{ option.unitName }}</text>
|
|
||||||
<view class="shop_sku_box_item_tip" v-if="specifications.item.isSoldStock == 1">
|
|
||||||
<view>售罄</view>
|
|
||||||
</view>
|
|
||||||
</view>
|
|
||||||
</view>
|
|
||||||
</view>
|
|
||||||
</view>
|
|
||||||
</view>
|
|
||||||
|
|
||||||
<!-- 推荐搭配 -->
|
|
||||||
<view class="u-m-t-48 u-p-30">
|
|
||||||
<view class="font-bold u-font-32 ">推荐搭配</view>
|
|
||||||
<view class="u-flex recommand-goods">
|
|
||||||
<view class=" item" v-for="(item,index) in 6" :key="index">
|
|
||||||
<up-image width="210rpx" height="210rpx" radius="12rpx"></up-image>
|
|
||||||
<view class="info">
|
|
||||||
<view class="u-line-2 name u-m-t-10 u-font-32 font-500">
|
|
||||||
商品名
|
|
||||||
</view>
|
|
||||||
|
|
||||||
<view class="u-flex u-row-between">
|
|
||||||
<view class="font-bold">
|
|
||||||
<text class="u-font-24">¥</text>
|
|
||||||
<text class="u-font-32">40</text>
|
|
||||||
</view>
|
|
||||||
<view class="btn">
|
|
||||||
<up-icon name="plus-circle-fill" color="#E9AB7A" size="25"></up-icon>
|
|
||||||
|
|
||||||
</view>
|
|
||||||
</view>
|
|
||||||
|
|
||||||
</view>
|
|
||||||
|
|
||||||
|
|
||||||
</view>
|
|
||||||
</view>
|
|
||||||
|
|
||||||
|
|
||||||
</view>
|
|
||||||
</scroll-view>
|
|
||||||
<!-- 占位 -->
|
|
||||||
<view class="shop_bottom">
|
|
||||||
<view class="flex-between">
|
|
||||||
<view class="price price-sku"
|
|
||||||
v-if="specifications.item.type != 'package' && specifications.item.result">
|
|
||||||
<text class="i">¥</text>
|
|
||||||
<view class="num">
|
|
||||||
<GoodsPrice :limitDiscount="cartStore.limitTimeDiscount"
|
|
||||||
:cart="specifications.item.result" :shopUserInfo="shopUserInfo"
|
|
||||||
:shopInfo="shopInfo"></GoodsPrice>
|
|
||||||
</view>
|
|
||||||
|
|
||||||
<text class="num" v-if="false">
|
|
||||||
{{
|
|
||||||
shopUserInfo.isVip == 1 && shopUserInfo.isMemberPrice == 1
|
|
||||||
? specifications.item.result.memberPrice || specifications.item.result.salePrice
|
|
||||||
: specifications.item.result.salePrice
|
|
||||||
}}
|
|
||||||
</text>
|
|
||||||
<text class="i"
|
|
||||||
v-if="specifications.item.unitName">/{{ specifications.item.unitName }}</text>
|
|
||||||
<text
|
|
||||||
v-if="specifications.item.result.suitNum > 1">「{{ specifications.item.result.suitNum }}{{ specifications.item.result.unitName }}起点」</text>
|
|
||||||
</view>
|
|
||||||
<view class="price price-package" v-else>
|
|
||||||
<text class="i">¥</text>
|
|
||||||
<view class="num">
|
|
||||||
<GoodsPrice :limitDiscount="cartStore.limitTimeDiscount" :cart="specifications.item"
|
|
||||||
:shopUserInfo="shopUserInfo" :shopInfo="shopInfo"></GoodsPrice>
|
|
||||||
</view>
|
|
||||||
<text class="num" v-if="false">
|
|
||||||
{{
|
|
||||||
shopUserInfo.isVip == 1 && shopUserInfo.isMemberPrice == 1
|
|
||||||
? specifications.item.memberPrice || specifications.item.salePrice
|
|
||||||
: specifications.item.salePrice
|
|
||||||
}}
|
|
||||||
</text>
|
|
||||||
<text class="i"
|
|
||||||
v-if="specifications.item.unitName">/{{ specifications.item.unitName }}</text>
|
|
||||||
<text
|
|
||||||
v-if="specifications.item.suitNum > 1">「{{ specifications.item.suitNum }}{{ specifications.item.unitName }}起点」</text>
|
|
||||||
</view>
|
|
||||||
|
|
||||||
<view class="operation-wrap"
|
|
||||||
v-if="specifications.item.type != 'package'&&stockNumberIsFull(specifications.item)">
|
|
||||||
<view class="btn">
|
|
||||||
<up-icon name="minus-circle-fill" color="#E9AB7A" size="25"
|
|
||||||
v-if="shopCartNumber > 0"></up-icon>
|
|
||||||
<view class="btnClick" @click="shopCart('-')"></view>
|
|
||||||
</view>
|
|
||||||
<text class="num">{{ shopCartNumber }}</text>
|
|
||||||
<view class="btn">
|
|
||||||
<up-icon name="plus-circle-fill" color="#E9AB7A" size="25"></up-icon>
|
|
||||||
<view class="btnClick" @click="shopCart('+')"></view>
|
|
||||||
</view>
|
|
||||||
</view>
|
|
||||||
</view>
|
|
||||||
<view class="shop_skuselect flex-start" v-if="selectedSpecsStr">
|
|
||||||
<view class="shop_skuselectname">{{ selectedSpecsStr }}</view>
|
|
||||||
</view>
|
|
||||||
<template v-if="!stockNumberIsFull(specifications.item)">
|
|
||||||
<view class="addShopping">
|
|
||||||
库存不足
|
|
||||||
</view>
|
|
||||||
</template>
|
|
||||||
<template v-else>
|
|
||||||
<template v-if="isSkuGoods">
|
|
||||||
<view v-if="specifications.item.type == 'package'" class="addShopping"
|
|
||||||
:class="shopCartNumber > 0 && allConditionsSatisfied ? 'active' : ''"
|
|
||||||
@click="submitSelection()">
|
|
||||||
{{ skuBtnText }}
|
|
||||||
</view>
|
|
||||||
<view v-else class="addShopping" :class="shopCartNumber > 0 && canSubmit ? 'active' : ''"
|
|
||||||
@click="submitSelection()">
|
|
||||||
{{ skuBtnText }}
|
|
||||||
</view>
|
|
||||||
</template>
|
|
||||||
<template v-else>
|
|
||||||
<view class="addShopping" :class="shopCartNumber > 0 ? 'active' : ''"
|
|
||||||
@click="submitSelection()">
|
|
||||||
{{ skuBtnText }}
|
|
||||||
</view>
|
|
||||||
</template>
|
|
||||||
</template>
|
|
||||||
|
|
||||||
|
|
||||||
</view>
|
|
||||||
</view>
|
|
||||||
</up-popup>
|
|
||||||
<view class="history_order" @click="toHistory"
|
<view class="history_order" @click="toHistory"
|
||||||
v-if="shopInfo && shopInfo.registerType == 'after' && orderinfo.id">
|
v-if="shopInfo && shopInfo.registerType == 'after' && orderinfo.id">
|
||||||
<image class="img" src="@/static/history.png" mode=""></image>
|
<image class="img" src="@/static/history.png" mode=""></image>
|
||||||
@@ -598,7 +401,9 @@
|
|||||||
<recommendGoodsModal v-if="isDataLoaded" @onBuyClick="onBuyClick"></recommendGoodsModal>
|
<recommendGoodsModal v-if="isDataLoaded" @onBuyClick="onBuyClick"></recommendGoodsModal>
|
||||||
|
|
||||||
<view v-for="(item,index) in goodsModalList" :key="index">
|
<view v-for="(item,index) in goodsModalList" :key="index">
|
||||||
<goodsModal :key="index" v-model="item.show" :goods="item.goods" @prveImgs="prveImgs"
|
<goodsModal :key="index" v-model="item.show" :goods="item.goods" @prveImgs="prveImgs" :orderinfo="orderinfo"
|
||||||
|
:cartNumber="returnGoodsImCartNum(item.goods)"
|
||||||
|
:consStockList="consStockList"
|
||||||
@shareClick="shareClick" @close="goodsModalClose(index)" @websocketsendMessage="websocketsendMessage"
|
@shareClick="shareClick" @close="goodsModalClose(index)" @websocketsendMessage="websocketsendMessage"
|
||||||
@modalAdd="modalAdd" :GoodsIDInCartNumMap="GoodsIDInCartNumMap"></goodsModal>
|
@modalAdd="modalAdd" :GoodsIDInCartNumMap="GoodsIDInCartNumMap"></goodsModal>
|
||||||
</view>
|
</view>
|
||||||
@@ -640,7 +445,7 @@
|
|||||||
</view>
|
</view>
|
||||||
</u-popup>
|
</u-popup>
|
||||||
|
|
||||||
<ymf-share-popup ></ymf-share-popup>
|
<ymf-share-popup></ymf-share-popup>
|
||||||
</view>
|
</view>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
@@ -663,6 +468,7 @@
|
|||||||
APIgroupquery,
|
APIgroupquery,
|
||||||
APIminiAppinfo,
|
APIminiAppinfo,
|
||||||
APIminiAppskuinfo,
|
APIminiAppskuinfo,
|
||||||
|
getConsStock,
|
||||||
productRelated
|
productRelated
|
||||||
} from '@/common/api/product/product.js';
|
} from '@/common/api/product/product.js';
|
||||||
|
|
||||||
@@ -758,6 +564,32 @@
|
|||||||
productStore
|
productStore
|
||||||
} from '@/stores/user.js';
|
} from '@/stores/user.js';
|
||||||
|
|
||||||
|
// 是否显示禁止购买
|
||||||
|
function showNoBuy(item) {
|
||||||
|
if (item.isSale == 0) {
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
if (item.isSaleTime == 0 && !item.isSaleTimeshow) {
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
if (item.isSoldStock == 1) {
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
if(item.type==="single"){
|
||||||
|
const sku=item.skuList[0]
|
||||||
|
if(!sku){
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
if(sku&&returnStockNumber(item)<sku.suitNum){
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (returnStockNumber(item) <= 0) {
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
const storeMemberpay = Memberpay();
|
const storeMemberpay = Memberpay();
|
||||||
const store = useNavbarStore();
|
const store = useNavbarStore();
|
||||||
// 动态更新导航栏配置
|
// 动态更新导航栏配置
|
||||||
@@ -776,6 +608,7 @@
|
|||||||
} from '@/stores/order.js';
|
} from '@/stores/order.js';
|
||||||
import {
|
import {
|
||||||
computed,
|
computed,
|
||||||
|
nextTick,
|
||||||
provide,
|
provide,
|
||||||
reactive
|
reactive
|
||||||
} from 'vue';
|
} from 'vue';
|
||||||
@@ -933,6 +766,9 @@
|
|||||||
|
|
||||||
//左侧导航点击
|
//左侧导航点击
|
||||||
const leftTap = (index) => {
|
const leftTap = (index) => {
|
||||||
|
console.log('topArr.value[index] ', topArr.value[index]);
|
||||||
|
console.log('store.height', store.height);
|
||||||
|
console.log('scrollTop', topArr.value[index] - store.height);
|
||||||
uni.pageScrollTo({
|
uni.pageScrollTo({
|
||||||
scrollTop: topArr.value[index] - store.height,
|
scrollTop: topArr.value[index] - store.height,
|
||||||
duration: 0
|
duration: 0
|
||||||
@@ -947,6 +783,7 @@
|
|||||||
|
|
||||||
/* 获取元素顶部信息 */
|
/* 获取元素顶部信息 */
|
||||||
const getElementTop = () => {
|
const getElementTop = () => {
|
||||||
|
console.log('getElementTop');
|
||||||
new Promise((resolve, reject) => {
|
new Promise((resolve, reject) => {
|
||||||
let view = uni.createSelectorQuery().selectAll('.main-item');
|
let view = uni.createSelectorQuery().selectAll('.main-item');
|
||||||
view.boundingClientRect(async (data) => {
|
view.boundingClientRect(async (data) => {
|
||||||
@@ -1024,77 +861,77 @@
|
|||||||
|
|
||||||
|
|
||||||
/*商品区域轮播图 start*/
|
/*商品区域轮播图 start*/
|
||||||
|
|
||||||
const shareSwiperItem=ref(null)
|
const shareSwiperItem = ref(null)
|
||||||
|
|
||||||
function swiperClick(item) {
|
function swiperClick(item) {
|
||||||
console.log('swiperClick',item);
|
console.log('swiperClick', item);
|
||||||
shareSwiperItem.value=item
|
shareSwiperItem.value = item
|
||||||
const pTag=returnPageTags(item.jumpPagePath)
|
const pTag = returnPageTags(item.jumpPagePath)
|
||||||
|
|
||||||
if(pTag==='pp-list'){
|
if (pTag === 'pp-list') {
|
||||||
return uni.navigateTo({
|
return uni.navigateTo({
|
||||||
url:item.jumpPagePath+'&shopId='+uni.cache.get('shopId')
|
url: item.jumpPagePath + '&shopId=' + uni.cache.get('shopId')
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
if(pTag==='pp-detail'){
|
if (pTag === 'pp-detail') {
|
||||||
const url=item.jumpPagePath+'&shopId='+uni.cache.get('shopId')+'&'+item.extendParam
|
const url = item.jumpPagePath + '&shopId=' + uni.cache.get('shopId') + '&' + item.extendParam
|
||||||
return uni.navigateTo({
|
return uni.navigateTo({
|
||||||
url:url.replace('goodsId','id')
|
url: url.replace('goodsId', 'id')
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
if(pTag==='gb-list'){
|
if (pTag === 'gb-list') {
|
||||||
return uni.navigateTo({
|
return uni.navigateTo({
|
||||||
url:item.jumpPagePath+'&shopId='+uni.cache.get('shopId')
|
url: item.jumpPagePath + '&shopId=' + uni.cache.get('shopId')
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
if(pTag==='gb-detail'){
|
if (pTag === 'gb-detail') {
|
||||||
const url=item.jumpPagePath+'&shopId='+uni.cache.get('shopId')+'&'+item.extendParam
|
const url = item.jumpPagePath + '&shopId=' + uni.cache.get('shopId') + '&' + item.extendParam
|
||||||
return uni.navigateTo({
|
return uni.navigateTo({
|
||||||
url:url.replace('goodsId','wareId')
|
url: url.replace('goodsId', 'wareId')
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
if(pTag==='dis'){
|
if (pTag === 'dis') {
|
||||||
return uni.navigateTo({
|
return uni.navigateTo({
|
||||||
url:item.jumpPagePath+'&shopId='+uni.cache.get('shopId')
|
url: item.jumpPagePath + '&shopId=' + uni.cache.get('shopId')
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
if(pTag==='index'){
|
if (pTag === 'index') {
|
||||||
return uni.switchTab({
|
return uni.switchTab({
|
||||||
url:item.jumpPagePath+'&shopId='+uni.cache.get('shopId')
|
url: item.jumpPagePath + '&shopId=' + uni.cache.get('shopId')
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
if(pTag==='eat'){
|
if (pTag === 'eat') {
|
||||||
if (item.extendParam) {
|
if (item.extendParam) {
|
||||||
const id=item.extendParam.split('=')[1]
|
const id = item.extendParam.split('=')[1]
|
||||||
const item = allGoodsArr.value.find(v => v.id == id)
|
const item = allGoodsArr.value.find(v => v.id == id)
|
||||||
if (item) {
|
if (item) {
|
||||||
clickspecifications(item)
|
clickspecifications(item)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if(pTag==='point'){
|
if (pTag === 'point') {
|
||||||
return uni.navigateTo({
|
return uni.navigateTo({
|
||||||
url:item.jumpPagePath+'&shopId='+uni.cache.get('shopId')
|
url: item.jumpPagePath + '&shopId=' + uni.cache.get('shopId')
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
if(pTag==='point-detail'){
|
if (pTag === 'point-detail') {
|
||||||
const url=item.jumpPagePath+'&shopId='+uni.cache.get('shopId')+'&'+item.extendParam
|
const url = item.jumpPagePath + '&shopId=' + uni.cache.get('shopId') + '&' + item.extendParam
|
||||||
return uni.navigateTo({
|
return uni.navigateTo({
|
||||||
url:url.replace('goodsId','id')
|
url: url.replace('goodsId', 'id')
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
function showShare(item){
|
|
||||||
if(item.isShareable&&item.isEnabled){
|
function showShare(item) {
|
||||||
|
if (item.isShareable && item.isEnabled) {
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
/*商品区域轮播图 end*/
|
/*商品区域轮播图 end*/
|
||||||
// 点击详情
|
|
||||||
const showShopsku = ref(false);
|
|
||||||
|
|
||||||
// 规格信息
|
// 规格信息
|
||||||
const specifications = reactive({
|
const specifications = reactive({
|
||||||
@@ -1363,6 +1200,7 @@
|
|||||||
|
|
||||||
// 提交选择并执行下一步操作的方法
|
// 提交选择并执行下一步操作的方法
|
||||||
const submitSelection = async () => {
|
const submitSelection = async () => {
|
||||||
|
console.log('submitSelection', submitSelection)
|
||||||
if (!isProductAvailable(specifications.productListitem.days, specifications.productListitem.startTime,
|
if (!isProductAvailable(specifications.productListitem.days, specifications.productListitem.startTime,
|
||||||
specifications.productListitem.endTime)) {
|
specifications.productListitem.endTime)) {
|
||||||
uni.showToast({
|
uni.showToast({
|
||||||
@@ -1387,6 +1225,33 @@
|
|||||||
selectedGroupSnap.value = [];
|
selectedGroupSnap.value = [];
|
||||||
}
|
}
|
||||||
console.log('specifications.item', specifications.item);
|
console.log('specifications.item', specifications.item);
|
||||||
|
const number = await calculateValue(res.cartNumber, '+', shopCartNumber.value)
|
||||||
|
|
||||||
|
const oldGoodsArr = combineOrderInfoDetailMap(orderinfo.value)
|
||||||
|
if (oldGoodsArr.find(v => v.productId == specifications.item.id)) {
|
||||||
|
// 等待用户点击
|
||||||
|
const isConfirm = await showConfirmModal(
|
||||||
|
'该商品已下单过,请确认是否重复',
|
||||||
|
'菜品名称:《' + specifications.item.name + '》'
|
||||||
|
);
|
||||||
|
if (!isConfirm) {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
if (res && number * 1 === 2) {
|
||||||
|
const isConfirm = await showConfirmModal(
|
||||||
|
'购物车已有该商品,请确认是否重复',
|
||||||
|
'菜品名称:《' + specifications.item.name + '》'
|
||||||
|
);
|
||||||
|
if (!isConfirm) {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
websocketsendMessage({
|
websocketsendMessage({
|
||||||
id: res ? res.cartListId : '',
|
id: res ? res.cartListId : '',
|
||||||
type: 'shopping',
|
type: 'shopping',
|
||||||
@@ -1396,8 +1261,7 @@
|
|||||||
operate_type: res ? 'edit' : 'add',
|
operate_type: res ? 'edit' : 'add',
|
||||||
product_id: specifications.product_id,
|
product_id: specifications.product_id,
|
||||||
sku_id: specifications.sku_id,
|
sku_id: specifications.sku_id,
|
||||||
number: res ? await calculateValue(res.cartNumber, '+', shopCartNumber.value) :
|
number: res ? number : shopCartNumber.value,
|
||||||
shopCartNumber.value,
|
|
||||||
pro_group_info: selectedGroupSnap.value,
|
pro_group_info: selectedGroupSnap.value,
|
||||||
goods_type: specifications.item.type == 'package' ? 'package' : '',
|
goods_type: specifications.item.type == 'package' ? 'package' : '',
|
||||||
memberPrice: specifications.item.memberPrice,
|
memberPrice: specifications.item.memberPrice,
|
||||||
@@ -1407,8 +1271,31 @@
|
|||||||
});
|
});
|
||||||
// 清空套餐选中
|
// 清空套餐选中
|
||||||
selectedGroupSnap.value = [];
|
selectedGroupSnap.value = [];
|
||||||
showShopsku.value = false;
|
|
||||||
} else {
|
} else {
|
||||||
|
const number = await calculateValue(res.cartNumber, '+', shopCartNumber.value)
|
||||||
|
const oldGoodsArr = combineOrderInfoDetailMap(orderinfo.value)
|
||||||
|
if (oldGoodsArr.find(v => v.productId == specifications.item.id)) {
|
||||||
|
// 等待用户点击
|
||||||
|
const isConfirm = await showConfirmModal(
|
||||||
|
'该商品已下单过,请确认是否重复',
|
||||||
|
'菜品名称:《' + specifications.item.name + '》'
|
||||||
|
);
|
||||||
|
if (!isConfirm) {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
if (res && number * 1 === 2) {
|
||||||
|
const isConfirm = await showConfirmModal(
|
||||||
|
'购物车已有该商品,请确认是否重复',
|
||||||
|
'菜品名称:《' + specifications.item.name + '》'
|
||||||
|
);
|
||||||
|
if (!isConfirm) {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
websocketsendMessage({
|
websocketsendMessage({
|
||||||
id: res ? res.cartListId : '',
|
id: res ? res.cartListId : '',
|
||||||
type: 'shopping',
|
type: 'shopping',
|
||||||
@@ -1418,14 +1305,12 @@
|
|||||||
operate_type: res ? 'edit' : 'add',
|
operate_type: res ? 'edit' : 'add',
|
||||||
product_id: specifications.product_id,
|
product_id: specifications.product_id,
|
||||||
sku_id: specifications.sku_id,
|
sku_id: specifications.sku_id,
|
||||||
number: res ? await calculateValue(res.cartNumber, '+', shopCartNumber.value) :
|
number: res ? number : shopCartNumber.value,
|
||||||
shopCartNumber.value,
|
|
||||||
memberPrice: specifications.item.memberPrice,
|
memberPrice: specifications.item.memberPrice,
|
||||||
is_print: 1,
|
is_print: 1,
|
||||||
product_type: specifications.item.type,
|
product_type: specifications.item.type,
|
||||||
is_time_discount: showLimitDiscount(specifications.item)
|
is_time_discount: showLimitDiscount(specifications.item)
|
||||||
});
|
});
|
||||||
showShopsku.value = false;
|
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -1540,7 +1425,6 @@
|
|||||||
.filter(([_, value]) => value.length > 0));
|
.filter(([_, value]) => value.length > 0));
|
||||||
// 给默认数量
|
// 给默认数量
|
||||||
specifications.item.amountcartNumber = 0;
|
specifications.item.amountcartNumber = 0;
|
||||||
// showShopsku.value = true;
|
|
||||||
goodsModalList.value.push({
|
goodsModalList.value.push({
|
||||||
show: true,
|
show: true,
|
||||||
goods: {
|
goods: {
|
||||||
@@ -1553,7 +1437,7 @@
|
|||||||
};
|
};
|
||||||
// 判断商品是否在可售时间内
|
// 判断商品是否在可售时间内
|
||||||
const isProductAvailable = async (sellDaysStr, startTimeStr, endTimeStr) => {
|
const isProductAvailable = async (sellDaysStr, startTimeStr, endTimeStr) => {
|
||||||
if(!sellDaysStr){
|
if (!sellDaysStr) {
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
// 将后端返回的字符串转换为数组
|
// 将后端返回的字符串转换为数组
|
||||||
@@ -1618,6 +1502,23 @@
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// 封装成 Promise 的确认弹窗
|
||||||
|
const showConfirmModal = (title, content) => {
|
||||||
|
return new Promise((resolve) => {
|
||||||
|
uni.showModal({
|
||||||
|
title: title,
|
||||||
|
content: content,
|
||||||
|
showCancel: true,
|
||||||
|
cancelText: '取消添加',
|
||||||
|
confirmText: '继续',
|
||||||
|
success(res) {
|
||||||
|
// 确认返回 true,取消/关闭返回 false
|
||||||
|
resolve(res.confirm === true);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
});
|
||||||
|
};
|
||||||
// 单规格
|
// 单规格
|
||||||
const singleclick = async (item, i) => {
|
const singleclick = async (item, i) => {
|
||||||
console.log('单规格商品点击事件:', item, i);
|
console.log('单规格商品点击事件:', item, i);
|
||||||
@@ -1645,17 +1546,53 @@
|
|||||||
} else if (item.suitNum >= cartNumberFloat && i === '-') {
|
} else if (item.suitNum >= cartNumberFloat && i === '-') {
|
||||||
suitNum = item.cartNumber;
|
suitNum = item.cartNumber;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const number = await calculateValue(item.cartNumber, i, suitNum)
|
||||||
|
const goodsStockNumber = returnStockNumber(item)
|
||||||
|
|
||||||
|
console.log('number', number);
|
||||||
|
if (i === '+') {
|
||||||
|
if (goodsStockNumber < suitNum) {
|
||||||
|
return uni.showToast({
|
||||||
|
title: '库存不足',
|
||||||
|
icon: 'none'
|
||||||
|
})
|
||||||
|
}
|
||||||
|
const oldGoodsArr = combineOrderInfoDetailMap(orderinfo.value)
|
||||||
|
if (oldGoodsArr.find(v => v.productId == item.id)) {
|
||||||
|
// 等待用户点击
|
||||||
|
const isConfirm = await showConfirmModal(
|
||||||
|
'该商品已下单过,请确认是否重复',
|
||||||
|
'菜品名称:《' + item.name + '》'
|
||||||
|
);
|
||||||
|
if (!isConfirm) {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
if (number * 1 == 2) {
|
||||||
|
const isConfirm = await showConfirmModal(
|
||||||
|
'购物车已有该商品,请确认是否重复',
|
||||||
|
'菜品名称:《' + item.name + '》'
|
||||||
|
);
|
||||||
|
if (!isConfirm) {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
const sendMsg = {
|
const sendMsg = {
|
||||||
type: 'shopping',
|
type: 'shopping',
|
||||||
suitNum: item.suitNum,
|
suitNum: item.suitNum,
|
||||||
table_code: uni.cache.get('tableCode'),
|
table_code: uni.cache.get('tableCode'),
|
||||||
shop_id: uni.cache.get('shopId'),
|
shop_id: uni.cache.get('shopId'),
|
||||||
operate_type: (await calculateValue(item.cartNumber, i, suitNum)) == 'del' ? 'del' : res ? 'edit' :
|
operate_type: number == 'del' ? 'del' : res ? 'edit' : 'add',
|
||||||
'add',
|
|
||||||
product_id: item.id,
|
product_id: item.id,
|
||||||
sku_id: item.skuId,
|
sku_id: item.skuId,
|
||||||
memberPrice: item.memberPrice,
|
memberPrice: item.memberPrice,
|
||||||
number: await calculateValue(item.cartNumber, i, suitNum),
|
number: number,
|
||||||
is_print: 1,
|
is_print: 1,
|
||||||
product_type: item.type,
|
product_type: item.type,
|
||||||
is_time_discount: showLimitDiscount(item)
|
is_time_discount: showLimitDiscount(item)
|
||||||
@@ -2089,6 +2026,7 @@
|
|||||||
const orderinfo = ref({});
|
const orderinfo = ref({});
|
||||||
const confirmorderref = ref(null);
|
const confirmorderref = ref(null);
|
||||||
|
|
||||||
|
|
||||||
// 结账
|
// 结账
|
||||||
const orderdetail = async () => {
|
const orderdetail = async () => {
|
||||||
isAutoClose = false;
|
isAutoClose = false;
|
||||||
@@ -2504,7 +2442,7 @@
|
|||||||
|
|
||||||
console.log('options.initMessage', options.initMessage)
|
console.log('options.initMessage', options.initMessage)
|
||||||
const newTableCode = userStore.getQueryString(res.result, 'code');
|
const newTableCode = userStore.getQueryString(res.result, 'code');
|
||||||
console.log('newTableCode',newTableCode);
|
console.log('newTableCode', newTableCode);
|
||||||
const shopInfoRes = await APIproductqueryShop({
|
const shopInfoRes = await APIproductqueryShop({
|
||||||
tableCode: newTableCode
|
tableCode: newTableCode
|
||||||
});
|
});
|
||||||
@@ -2562,7 +2500,8 @@
|
|||||||
handleMixinOnLoad,
|
handleMixinOnLoad,
|
||||||
returnQuery,
|
returnQuery,
|
||||||
jsonToUrl,
|
jsonToUrl,
|
||||||
wxShare,returnPageTags,
|
wxShare,
|
||||||
|
returnPageTags,
|
||||||
returnCommonQuery
|
returnCommonQuery
|
||||||
} from '@/utils/share.js'
|
} from '@/utils/share.js'
|
||||||
// defineOptions({
|
// defineOptions({
|
||||||
@@ -2575,39 +2514,42 @@
|
|||||||
function shareClick() {
|
function shareClick() {
|
||||||
isGoodsShare.value = true
|
isGoodsShare.value = true
|
||||||
}
|
}
|
||||||
|
|
||||||
function getPage(pageStr){
|
function getPage(pageStr) {
|
||||||
|
|
||||||
}
|
}
|
||||||
function shareBtnClick(item){
|
|
||||||
console.log('shareBtnClick',item);
|
function shareBtnClick(item) {
|
||||||
shareSwiperItem.value=item
|
console.log('shareBtnClick', item);
|
||||||
|
shareSwiperItem.value = item
|
||||||
}
|
}
|
||||||
function swiperShare(queryJson){
|
|
||||||
console.log('shareSwiperItem',shareSwiperItem.value);
|
function swiperShare(queryJson) {
|
||||||
const pTag=returnPageTags(shareSwiperItem.value.jumpPagePath)
|
console.log('shareSwiperItem', shareSwiperItem.value);
|
||||||
|
const pTag = returnPageTags(shareSwiperItem.value.jumpPagePath)
|
||||||
let query = jsonToUrl(queryJson)
|
let query = jsonToUrl(queryJson)
|
||||||
query +=('&'+shareSwiperItem.value.extendParam)
|
query += ('&' + shareSwiperItem.value.extendParam)
|
||||||
const shopName = uni.cache.get('shopInfo').shopName || ''
|
const shopName = uni.cache.get('shopInfo').shopName || ''
|
||||||
const path=shareSwiperItem.value.jumpPagePath?shareSwiperItem.value.jumpPagePath:'/pages/product/index?type=beforehand'
|
const path = shareSwiperItem.value.jumpPagePath ? shareSwiperItem.value.jumpPagePath :
|
||||||
console.log('path',path);
|
'/pages/product/index?type=beforehand'
|
||||||
const json={
|
console.log('path', path);
|
||||||
imageUrl:shareSwiperItem.value.imageUrl,
|
const json = {
|
||||||
path: path+'&'+query,
|
imageUrl: shareSwiperItem.value.imageUrl,
|
||||||
title:shareSwiperItem.value.name+ (shopName ? `-${shopName}` : ''),
|
path: path + '&' + query,
|
||||||
|
title: shareSwiperItem.value.name + (shopName ? `-${shopName}` : ''),
|
||||||
}
|
}
|
||||||
if(pTag==='pp-detail'){
|
if (pTag === 'pp-detail') {
|
||||||
json.path=json.path.replace('goodsId','id')
|
json.path = json.path.replace('goodsId', 'id')
|
||||||
}
|
}
|
||||||
if(pTag==='gb-detail'){
|
if (pTag === 'gb-detail') {
|
||||||
json.path=json.path.replace('goodsId','wareId')
|
json.path = json.path.replace('goodsId', 'wareId')
|
||||||
}
|
}
|
||||||
if(pTag==='point-detail'){
|
if (pTag === 'point-detail') {
|
||||||
json.path=json.path.replace('goodsId','id')
|
json.path = json.path.replace('goodsId', 'id')
|
||||||
}
|
}
|
||||||
if(pTag.includes('eat')){
|
if (pTag.includes('eat')) {
|
||||||
if(shareSwiperItem.value.extendParam){
|
if (shareSwiperItem.value.extendParam) {
|
||||||
json.path=json.path.replace('goodsId','showGoodsId')
|
json.path = json.path.replace('goodsId', 'showGoodsId')
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return wxShare(json)
|
return wxShare(json)
|
||||||
@@ -2616,7 +2558,7 @@
|
|||||||
|
|
||||||
async function onShare() {
|
async function onShare() {
|
||||||
const queryJson = await returnCommonQuery()
|
const queryJson = await returnCommonQuery()
|
||||||
if(shareSwiperItem.value){
|
if (shareSwiperItem.value) {
|
||||||
return swiperShare(queryJson)
|
return swiperShare(queryJson)
|
||||||
}
|
}
|
||||||
let query = jsonToUrl(queryJson)
|
let query = jsonToUrl(queryJson)
|
||||||
@@ -2633,7 +2575,7 @@
|
|||||||
json.title = shopName
|
json.title = shopName
|
||||||
json.imageUrl = uni.cache.get('shopInfo').logo || ''
|
json.imageUrl = uni.cache.get('shopInfo').logo || ''
|
||||||
}
|
}
|
||||||
|
|
||||||
return wxShare({
|
return wxShare({
|
||||||
query,
|
query,
|
||||||
...json,
|
...json,
|
||||||
@@ -2648,6 +2590,42 @@
|
|||||||
const pageOptions = reactive({})
|
const pageOptions = reactive({})
|
||||||
|
|
||||||
const carouselList = ref([])
|
const carouselList = ref([])
|
||||||
|
|
||||||
|
async function getConsStocks() {
|
||||||
|
const res = await getConsStock({
|
||||||
|
shopId: userStore.shopInfo.id
|
||||||
|
})
|
||||||
|
consStockList.value = res || []
|
||||||
|
}
|
||||||
|
const consStockList = ref([])
|
||||||
|
|
||||||
|
|
||||||
|
// 是否显示剩余库存数量
|
||||||
|
function showStockNumber(item) {
|
||||||
|
return !item.isSoldStock && returnStockNumber(item) <= 10 && returnStockNumber(item) > 0
|
||||||
|
}
|
||||||
|
|
||||||
|
function returnStockNumber(item) {
|
||||||
|
if (!item.isAutoSoldStock) {
|
||||||
|
return 9999
|
||||||
|
}
|
||||||
|
const consList = item.consList
|
||||||
|
const matchStockList = consStockList.value.filter(v => {
|
||||||
|
return consList.find(c => c.consInfoId == v.consId)
|
||||||
|
}).map(v => {
|
||||||
|
const cItem = item.consList.find(c => c.consInfoId == v.consId)
|
||||||
|
const goodsNumber = Math.floor(v.stockNumber / cItem.surplusStock)
|
||||||
|
return {
|
||||||
|
...v,
|
||||||
|
goodsNumber
|
||||||
|
}
|
||||||
|
}).sort((a, b) => {
|
||||||
|
return a.goodsNumber - b.goodsNumber
|
||||||
|
})
|
||||||
|
|
||||||
|
const minConsStockNumber = matchStockList[0] ? matchStockList[0].goodsNumber : 9999
|
||||||
|
return minConsStockNumber
|
||||||
|
}
|
||||||
onLoad(async (e) => {
|
onLoad(async (e) => {
|
||||||
Object.assign(pageOptions, e)
|
Object.assign(pageOptions, e)
|
||||||
if (e.type) {
|
if (e.type) {
|
||||||
@@ -2723,14 +2701,17 @@
|
|||||||
tableCode: uni.cache.get('tableCode')
|
tableCode: uni.cache.get('tableCode')
|
||||||
});
|
});
|
||||||
oldOrder.value = res;
|
oldOrder.value = res;
|
||||||
|
nextTick(() => {
|
||||||
|
getElementTop();
|
||||||
|
})
|
||||||
if (res && res.id && shopInfo.registerType == 'after' && !e.noJump) {
|
if (res && res.id && shopInfo.registerType == 'after' && !e.noJump) {
|
||||||
toHistory();
|
toHistory();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
// 启动网络监听
|
// 启动网络监听
|
||||||
useSocket.initNetworkListener();
|
useSocket.initNetworkListener();
|
||||||
getElementTop();
|
|
||||||
}, 500);
|
}, 500);
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -2811,6 +2792,12 @@
|
|||||||
id: ''
|
id: ''
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
// if(!topArr.value.length){
|
||||||
|
// getElementTop()
|
||||||
|
// }
|
||||||
|
|
||||||
|
//耗材列表
|
||||||
|
await getConsStocks()
|
||||||
});
|
});
|
||||||
|
|
||||||
//是否自动关闭socket
|
//是否自动关闭socket
|
||||||
@@ -2824,7 +2811,7 @@
|
|||||||
}
|
}
|
||||||
onHide(() => {
|
onHide(() => {
|
||||||
isGoodsShare.value = false
|
isGoodsShare.value = false
|
||||||
shareSwiperItem.value=null
|
shareSwiperItem.value = null
|
||||||
closeSocket();
|
closeSocket();
|
||||||
});
|
});
|
||||||
onUnload(() => {
|
onUnload(() => {
|
||||||
@@ -4074,11 +4061,12 @@
|
|||||||
padding: 32rpx 28rpx;
|
padding: 32rpx 28rpx;
|
||||||
}
|
}
|
||||||
|
|
||||||
.share-btn-box{
|
.share-btn-box {
|
||||||
position: absolute;
|
position: absolute;
|
||||||
right: 8rpx;
|
right: 8rpx;
|
||||||
bottom: 14rpx;
|
bottom: 14rpx;
|
||||||
}
|
}
|
||||||
|
|
||||||
.share-btn {
|
.share-btn {
|
||||||
|
|
||||||
padding: 10rpx 32rpx;
|
padding: 10rpx 32rpx;
|
||||||
|
|||||||
@@ -118,9 +118,8 @@
|
|||||||
onMounted,
|
onMounted,
|
||||||
getCurrentInstance,
|
getCurrentInstance,
|
||||||
nextTick,
|
nextTick,
|
||||||
onShow
|
|
||||||
} from 'vue';
|
} from 'vue';
|
||||||
|
|
||||||
//接口引入
|
//接口引入
|
||||||
import {
|
import {
|
||||||
APIcallTabletakeNumber,
|
APIcallTabletakeNumber,
|
||||||
|
|||||||
@@ -27,7 +27,7 @@
|
|||||||
<!-- #endif -->
|
<!-- #endif -->
|
||||||
</view>
|
</view>
|
||||||
<view class="right-icons">
|
<view class="right-icons">
|
||||||
<image class="my_info_right_qr" src="/static/icon/code.png" mode="aspectFill"></image>
|
<!-- <image class="my_info_right_qr" src="/static/icon/code.png" mode="aspectFill"></image> -->
|
||||||
<view class="msg-view" @click="viewUserMsgList">
|
<view class="msg-view" @click="viewUserMsgList">
|
||||||
<view class="msg-icon-wrapper">
|
<view class="msg-icon-wrapper">
|
||||||
<image v-if="unreadMsgCount > 0" class="my-msg-icon" src="/static/mine/msg_select.png" mode="aspectFill"></image>
|
<image v-if="unreadMsgCount > 0" class="my-msg-icon" src="/static/mine/msg_select.png" mode="aspectFill"></image>
|
||||||
|
|||||||
@@ -303,7 +303,7 @@
|
|||||||
}
|
}
|
||||||
if (res.memberConfig.isSubmitInfo && (shopUserInfo.value.sex === null || shopUserInfo.value.sex ===
|
if (res.memberConfig.isSubmitInfo && (shopUserInfo.value.sex === null || shopUserInfo.value.sex ===
|
||||||
undefined || !shopUserInfo.value.nickName || !shopUserInfo.value.birthDay || !shopUserInfo.value
|
undefined || !shopUserInfo.value.nickName || !shopUserInfo.value.birthDay || !shopUserInfo.value
|
||||||
.phone)) {
|
.phone||shopUserInfo.value.nickName==='微信用户')) {
|
||||||
memberOpen.value = true;
|
memberOpen.value = true;
|
||||||
}
|
}
|
||||||
conditionList.value = res.memberConfig.conditionList.map(v => {
|
conditionList.value = res.memberConfig.conditionList.map(v => {
|
||||||
|
|||||||
Reference in New Issue
Block a user