1、修改密码手机号未拿到处理

2、首页/商品列表增加了广告弹窗
3、会员充值新增赠送菜品,
4、会员菜品增加最大添加数量限制
5、首页/我的/会员卡/菜品页面的图片设置
6、小程序余额支付,会员卡充值成功后增加 会员余额变动订阅(后端还未做处理,目前可以订阅不会推送)
7、多规格商品部分规格售罄/下架增加角标提示
This commit is contained in:
GaoHao
2024-08-27 14:43:15 +08:00
parent d75da8ac9f
commit 22b9726de6
19 changed files with 933 additions and 252 deletions

View File

@@ -8,6 +8,9 @@ export default {
loginapplogin(data) { //APP登录(登录即注册) loginapplogin(data) { //APP登录(登录即注册)
return uni.api.post("/login/app/login", data); return uni.api.post("/login/app/login", data);
}, },
getShopExtend(data) { //获取图片 通过shopId和autokey
return uni.api.post("/common/shopExtend", data,false);
},
productqueryShop(data) { //通过桌码获取店铺信息 productqueryShop(data) { //通过桌码获取店铺信息
return uni.api.get("/product/queryShop", data); return uni.api.get("/product/queryShop", data);
}, },
@@ -90,6 +93,15 @@ export default {
openMember(data) { openMember(data) {
return uni.api.post("/user/openMember", data); return uni.api.post("/user/openMember", data);
}, },
// 会员填充手机号
upVipPhont(data) {
return uni.api.post("/user/upVipPhont", data);
},
// 获取弹窗广告列表
getPopUpAd(data) {
return uni.api.get("/tbShopAd/list", data);
},
// 优惠券数量 // 优惠券数量
userCoupon(data) { userCoupon(data) {
return uni.api.get("/user/userCoupon", data); return uni.api.get("/user/userCoupon", data);

252
components/popupad.vue Normal file
View File

@@ -0,0 +1,252 @@
<template>
<view class="viewswiper" v-if="viewswiperShow">
<view class="swiperBox">
<u-swiper
:list="popupadList"
previousMargin="30"
nextMargin="30"
circular
:autoplay="true"
:indicator="false"
keyName="imgUrl"
radius='10'
@change="e => current = e.current"
@click="swiperClick"
bgColor="transparent" height='720'
>
<view slot="indicator" class="indicator">
<!-- <view class="indicator__dot" v-for="(item, index) in carousel" :key="index"
:class="[index === current && 'indicator__dot--active']"
:style="[index === current && {'width':16+'px'}]">
</view> -->
</view>
</u-swiper>
</view>
<u-icon name="close-circle" color="#fff" size="70" @click="closeClick"></u-icon>
</view>
</template>
<script>
import dayjs from "dayjs";
// import dayjs from "dayjs";
export default {
data() {
return {
current: 0,
popupadList: [],
viewswiperShow: false,
time: false,
};
},
props: {
showPosition: {
type: String,
default: ''
},
forceUpdate: {
type: Boolean,
default: false
},
},
watch: {
forceUpdate(val,oldval) {
// 在 forceUpdate 改变时执行更新操作
let time = uni.cache.get('popUpTime') ? new Date().getTime() - uni.cache.get('popUpTime') : 1000;
if ( time >= 1000 ) {
uni.cache.set('popUpTime', new Date().getTime())
this.getPopUpAd(); // 重新加载数据
}
}
},
mounted () {
// if (uni.cache.get('shopUser') && uni.cache.get('token')) {
// }
},
methods: {
/**
* 轮播图点击
*/
swiperClick (e) {
let item = this.popupadList[e];
if ( item.linkPath ) {
uni.navigateTo({
url: `${item.linkPath}`
})
}
},
/**
* 关闭广告
*/
closeClick () {
this.viewswiperShow = false;
},
/**
* 获取弹窗广告
*/
async getPopUpAd () {
let res = await this.api.getPopUpAd({
shopId: 10
// shopId: uni.cache.get('shopUser')
})
if (res.code == 0) {
this.popupadList = [];
// console.log(this.showPosition)
// console.log(this.showPosition)
// console.log(!uni.cache.get('popUpData'))
if (!uni.cache.get('popUpData')) {
res.data.forEach((item,index)=>{
if ( item.showPosition == this.showPosition) {
item["popUpTime"] = dayjs().format('YYYY-MM-DD');
this.popupadList.push(item);
}
})
uni.cache.set('popUpData', this.popupadList)
} else {
let popUpData = uni.cache.get('popUpData');
res.data.forEach((item1,index1)=>{
if ( popUpData.filter(obj => obj.id == item1.id).length > 0 ) {
let obj = popUpData.filter(obj => obj.id == item1.id)[0];
// console.log(this.showPosition)
// console.log(item1.updateTime, obj.updateTime)
// console.log(item1.showPosition == this.showPosition,this.isFrequency(item1.frequency,item1.popUpTime),item1.updateTime != obj.updateTime)
if ( (item1.showPosition == this.showPosition && this.isFrequency(item1.frequency,item1.popUpTime)) || ( item1.showPosition == this.showPosition && item1.updateTime != obj.updateTime) ) {
item1["popUpTime"] = dayjs().format('YYYY-MM-DD');
this.popupadList.push(item1)
}
popUpData.forEach((item,index)=>{
if ( item.id == item1.id && JSON.stringify(item1) != JSON.stringify(item) ) {
popUpData[index]= item1;
}
})
} else {
if ( item1.showPosition == this.showPosition) {
item1["popUpTime"] = dayjs().format('YYYY-MM-DD');
this.popupadList.push(item1);
popUpData.push(item1);
}
}
})
// console.log(popUpData)
uni.cache.set('popUpData', popUpData)
// console.log(this.popupadList)
// updateTime
}
if ( this.popupadList.length > 0 ) {
this.viewswiperShow = true;
}
}
},
isFrequency (frequency,popUpTime) {
switch (frequency) {
case "only_one": //仅首次展示
return false;
break;
case 'every_show': //每次打开都展示
return true;
break;
case 'every_day': //每天展示一次
// return this.isTime("2024-08-22",1);
return this.isTime(frequency,1);
break;
case 'three_day': //3天展示一次
// return this.isTime("2024-08-20",1);
return this.isTime(frequency,3);
break;
case 'seven_day': //7天展示一次
// return this.isTime("2024-08-16",1);
return this.isTime(frequency,7);
break;
case 'thirty_day': //30天展示一次
// return this.isTime("2024-07-24",1);
return this.isTime(frequency,30);
break;
}
},
isTime (popUpTime,num) {
// 获取当前日期
let date1 = dayjs();
let date2 = dayjs(popUpTime).format('YYYY-MM-DD');
// console.log(date1.diff(date2, "day"))
if ( date1.diff(date2, "day") >= num ) {
return true;
} else {
return false;
}
}
}
};
</script>
<style scoped lang="scss">
page{
width: 100%;
height: 100%;
}
.viewswiper {
width: 100%;
height: 100%;
position: fixed;
top: 0;
left: 0;
background-color: rgba(0,0,0,0.5);
z-index: 999;
display: flex;
flex-direction: column;
justify-content: center;
align-items: center;
.swiperBox{
width: 80%;
margin-bottom: 50rpx;
}
.swiper__wrapper__item__wrapper__image{
border-radius: 10rpx;
}
.indicator {
margin-bottom: 46rpx;
@include flex(row);
justify-content: center;
&__dot {
height: 6px;
width: 6px;
border-radius: 100px;
background-color: rgba(255, 255, 255, 0.35);
margin: 0 5px;
transition: background-color 0.3s;
&--active {
background-color: #ffffff;
}
}
.indicator_img{
}
}
.indicator-num {
padding: 2px 0;
background-color: rgba(0, 0, 0, 0.35);
border-radius: 100px;
width: 35px;
@include flex;
justify-content: center;
&__text {
color: #FFFFFF;
font-size: 12px;
}
}
}
</style>

View File

@@ -16,11 +16,11 @@ const baseUrlwws = 'ws://cashier.sxczgkj.cn/cashierService'
// #endif // #endif
// #ifdef APP || MP-WEIXIN // #ifdef APP || MP-WEIXIN
const baseUrl = debug ? proxyApi : 'https://cashier.sxczgkj.cn/cashierService' // 线上 // const baseUrl = debug ? proxyApi : 'https://cashier.sxczgkj.cn/cashierService' // 线上
const baseUrlwws = debug ? proxyApiwws : 'wss://cashier.sxczgkj.cn/netty' // 线上 // const baseUrlwws = debug ? proxyApiwws : 'wss://cashier.sxczgkj.cn/netty' // 线上
// const baseUrl = 'https://cashier.sxczgkj.cn/cashierService' // 线上 const baseUrl = 'https://cashier.sxczgkj.cn/cashierService' // 线上
// const baseUrlwws = 'wss://cashier.sxczgkj.cn/netty' // 线上/ const baseUrlwws = 'wss://cashier.sxczgkj.cn/netty' // 线上/
// #endif // #endif
// import VConsole from "./vConsole.js" // import VConsole from "./vConsole.js"

7
package-lock.json generated
View File

@@ -5,6 +5,7 @@
"packages": { "packages": {
"": { "": {
"dependencies": { "dependencies": {
"dayjs": "^1.11.12",
"lodash": "^4.17.21" "lodash": "^4.17.21"
}, },
"devDependencies": { "devDependencies": {
@@ -527,6 +528,12 @@
"license": "MIT", "license": "MIT",
"peer": true "peer": true
}, },
"node_modules/dayjs": {
"version": "1.11.12",
"resolved": "https://registry.npmmirror.com/dayjs/-/dayjs-1.11.12.tgz",
"integrity": "sha512-Rt2g+nTbLlDWZTwwrIXjy9MeiZmSDI375FvZs72ngxx8PDC6YXOeR3q5LAuPzjZQxhiWdRKac7RKV+YyQYfYIg==",
"license": "MIT"
},
"node_modules/electron-to-chromium": { "node_modules/electron-to-chromium": {
"version": "1.5.4", "version": "1.5.4",
"resolved": "https://registry.npmmirror.com/electron-to-chromium/-/electron-to-chromium-1.5.4.tgz", "resolved": "https://registry.npmmirror.com/electron-to-chromium/-/electron-to-chromium-1.5.4.tgz",

View File

@@ -4,6 +4,7 @@
"sass-loader": "^13.3.2" "sass-loader": "^13.3.2"
}, },
"dependencies": { "dependencies": {
"dayjs": "^1.11.12",
"lodash": "^4.17.21" "lodash": "^4.17.21"
} }
} }

View File

@@ -226,11 +226,15 @@
</view> </view>
<indexs v-if="!showindex" :usershopUserinfo='usershopUserinfo' :userInfo='userInfo'></indexs> <indexs v-if="!showindex" :shopExtend="shopExtend" :usershopUserinfo='usershopUserinfo' :userInfo='userInfo'></indexs>
<popupad id="popupad" :forceUpdate='forceUpdate' :showPosition="'home'"></popupad>
</view> </view>
</view>
</view>
</template> </template>
<script> <script>
import swipers from './components/swiper.vue' import swipers from './components/swiper.vue'
import popupad from '@/components/popupad.vue'
import diamond from './components/diamond.vue' import diamond from './components/diamond.vue'
import todaylist from './components/todaylist.vue' import todaylist from './components/todaylist.vue'
import productlist from './components/productlist.vue' import productlist from './components/productlist.vue'
@@ -247,7 +251,8 @@
advertisement, advertisement,
category, category,
customSwiper, customSwiper,
indexs indexs,
popupad
}, },
data() { data() {
return { return {
@@ -291,7 +296,10 @@
categoryList: [], categoryList: [],
subCategoryList: [], //二级菜单数据 subCategoryList: [], //二级菜单数据
// 登录后店铺信息 // 登录后店铺信息
usershopUserinfo:{} usershopUserinfo:{},
popupadList: [], //广告数据
forceUpdate: false,
shopExtend: null,
}; };
}, },
@@ -310,7 +318,6 @@
}, },
onHide() { onHide() {
this.timersetInterval = '1' this.timersetInterval = '1'
}, },
computed: { computed: {
HeighT() { //手机类型的尺寸 HeighT() { //手机类型的尺寸
@@ -331,6 +338,7 @@
}, },
async onShow() { async onShow() {
// 判断显示那个页面 // 判断显示那个页面
if (uni.cache.get('shopUser') && uni.cache.get('token')) { if (uni.cache.get('shopUser') && uni.cache.get('token')) {
this.showindex = false this.showindex = false
uni.cache.set('types', 'index'); uni.cache.set('types', 'index');
@@ -340,8 +348,15 @@
}) })
if (res.code == 0) { if (res.code == 0) {
this.usershopUserinfo = res.data this.usershopUserinfo = res.data
uni.cache.set('shopUserInfo',this.usershopUserinfo)
} }
this.loginwxuserInfo() //个人信息接口 this.loginwxuserInfo() //个人信息接口
if ( !uni.cache.get('forceUpdate') ) {
this.forceUpdate = !this.forceUpdate;
}
uni.cache.set('forceUpdate',false)
this.getShopExtend()
this.timersetInterval = '0'
} else { } else {
uni.getLocation({ uni.getLocation({
type: 'wgs84', type: 'wgs84',
@@ -393,6 +408,19 @@
} }
}, },
methods: { methods: {
/**
* 获取背景图
*/
async getShopExtend () {
let res = await this.api.getShopExtend({
shopId: uni.cache.get('shopUser'),
autokey: "index_bg" //index_bg my_bg member_bg shopInfo_bg
})
if ( res.code == 0) {
this.shopExtend = res.data;
}
},
// 个人信息 // 个人信息
async loginwxuserInfo() { async loginwxuserInfo() {
let res = await this.api.loginwxuserInfo({ let res = await this.api.loginwxuserInfo({
@@ -403,6 +431,7 @@
this.userInfo = uni.cache.get('userInfo') this.userInfo = uni.cache.get('userInfo')
} }
}, },
closeproductlist() { closeproductlist() {
this.showproductlist = false this.showproductlist = false
// console.log('close'); // console.log('close');

View File

@@ -1,6 +1,6 @@
<template> <template>
<view class="content"> <view class="content">
<view class="contentbox"> <view class="contentbox" :style="'background:url('+(shopExtend?shopExtend.value:'https://czg-qr-order.oss-cn-beijing.aliyuncs.com/indexs/shuangbackground.png')+') no-repeat center center / cover' ">
<view class="contentboxitem flex-between"> <view class="contentboxitem flex-between">
<view class="contentboxitemleft flex-colum" @click="scanCodehandle(0)"> <view class="contentboxitemleft flex-colum" @click="scanCodehandle(0)">
<image src="https://czg-qr-order.oss-cn-beijing.aliyuncs.com/indexs/Xdiancan.png" mode="aspectFill"> <image src="https://czg-qr-order.oss-cn-beijing.aliyuncs.com/indexs/Xdiancan.png" mode="aspectFill">
@@ -52,6 +52,12 @@
return {} return {}
} }
}, },
shopExtend: {
type: Object,
default () {
return {}
}
},
}, },
methods: { methods: {
scanCodehandle(i) { scanCodehandle(i) {
@@ -62,7 +68,10 @@
let tableCode = this.getQueryString(decodeURIComponent(res.result), 'code') let tableCode = this.getQueryString(decodeURIComponent(res.result), 'code')
uni.cache.set('tableCode', tableCode) uni.cache.set('tableCode', tableCode)
if (tableCode) { if (tableCode) {
uni.pro.navigateTo('order_food/order_food') uni.cache.set('forceUpdate',true)
uni.pro.navigateTo('order_food/order_food', {
// shopId_id: uni.cache.get('shopUser'),
})
} }
} }
@@ -141,8 +150,6 @@
position: relative; position: relative;
width: 100%; width: 100%;
height: 1046rpx; height: 1046rpx;
background: url(https://czg-qr-order.oss-cn-beijing.aliyuncs.com/indexs/shuangbackground.png) no-repeat;
background-size: 100% 100%;
padding: 0 24rpx; padding: 0 24rpx;
.contentboxitem { .contentboxitem {

View File

@@ -57,8 +57,9 @@
} }
}, },
onLoad(e) { onLoad(e) {
this.info = e console.log(JSON.parse(e.shopUserInfo))
this.form.memberId = e.memberId this.info = JSON.parse(e.shopUserInfo)
this.form.memberId = this.info.id;
this.getlist() this.getlist()
}, },
onReachBottom() { onReachBottom() {
@@ -73,20 +74,19 @@
async getlist() { async getlist() {
if (this.active == 1) { if (this.active == 1) {
let res = await this.api.queryMemberAccount(this.form) let res = await this.api.queryMemberAccount(this.form)
if (res.code == 0) { if (res.code == 0 && res.data.list.length > 0) {
if (this.form.page == 1) { console.log(this.list.length)
this.list = res.data.list this.list = this.list.concat(res.data.list)
} else { this.form.page++
this.form.page++ console.log(this.list)
this.list.push(res.data.list)
}
} }
} else { } else {
this.list = [] this.list = []
} }
}, },
clickEvent(i) { clickEvent(i) {
this.active = i this.active = i;
this.form.page = 1;
this.getlist() this.getlist()
} }
} }

View File

@@ -2,7 +2,7 @@
<!-- 店铺详情 --> <!-- 店铺详情 -->
<u-popup :show="show" :round="20" overlayOpacity="0.8" mode="bottom" @close="showClose" height="500"> <u-popup :show="show" :round="20" overlayOpacity="0.8" mode="bottom" @close="showClose" height="500">
<view class="register-member-wrap"> <view class="register-member-wrap">
<view class="register-title">欢迎加入双屿</view> <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="register-content">
<view class="reg-head"> <view class="reg-head">
@@ -16,9 +16,9 @@
<view class="lable">昵称<text style="color: #CD1A1A;">*</text></view> <view class="lable">昵称<text style="color: #CD1A1A;">*</text></view>
<u-input class="value" v-model="nickName" fontSize="14px" type="text" input-align="left" placeholder="请输入昵称" :custom-style="{border:'none'}" placeholderStyle="color:#999;font-size: 28rpx"/> <u-input class="value" v-model="nickName" fontSize="14px" type="text" input-align="left" placeholder="请输入昵称" :custom-style="{border:'none'}" placeholderStyle="color:#999;font-size: 28rpx"/>
</view> </view>
<view class="reg-cell"> <view class="reg-cell" @click="calendarShow = true">
<view class="lable">生日</view> <view class="lable">生日</view>
<view class="value" :style="{color: birthDay ? '#333' : '#999'}" @click="calendarShow = true">{{ birthDay || '请选择日期'}}</view> <view class="value" :style="{color: birthDay ? '#333' : '#999'}">{{ 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-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> --> <!-- <u-picker :show="calendarShow" ref="uPicker" :columns="columns" @confirm="confirm" @change="changeHandler"></u-picker> -->
<!-- <picker :show="calendarShow" mode="date"></picker> --> <!-- <picker :show="calendarShow" mode="date"></picker> -->
@@ -28,6 +28,8 @@
:show="calendarShow" :show="calendarShow"
:minDate="-2208988800000" :minDate="-2208988800000"
v-model="value1" v-model="value1"
itemHeight="66"
visibleItemCount="5"
@confirm="confirmTime" @confirm="confirmTime"
></u-datetime-picker> ></u-datetime-picker>
<u-icon name="arrow-down-fill" color="#000" size="23"></u-icon> <u-icon name="arrow-down-fill" color="#000" size="23"></u-icon>
@@ -41,11 +43,11 @@
</view> </view>
<view class="agreement"> <view class="agreement">
<view class="agreement_tip">我已阅读并同意以下内容</view> <view class="agreement_tip">我已阅读并同意以下内容</view>
<view class="agreement_item"> <view class="agreement_item" @click="isProtocol = !isProtocol">
<u-checkbox-group> <u-checkbox-group >
<u-checkbox shape="circle" activeColor="#E3AD7F" @change="radioChange" size="30"></u-checkbox> <u-checkbox :checked="isProtocol" shape="circle" activeColor="#E3AD7F" @change="radioChange" size="35" iconSize="20"></u-checkbox>
</u-checkbox-group> </u-checkbox-group>
<text @click="viewProtocol(1)" class="agreement_item_text">用户协议/隐私条款</text> <text @click.stop="viewProtocol(1)" class="agreement_item_text">用户协议/隐私条款</text>
</view> </view>
<!-- <view class="agreement_item"> <!-- <view class="agreement_item">
<u-checkbox-group> <u-checkbox-group>
@@ -62,7 +64,7 @@
<script> <script>
export default { export default {
props: ['userInfo','show',"shopId"], props: ['show',"shopId"],
data() { data() {
return { return {
value1: Number(new Date()), value1: Number(new Date()),
@@ -73,18 +75,33 @@
telephone: "", telephone: "",
birthDay: "", birthDay: "",
isProtocol: false, isProtocol: false,
shopUserInfo: null,
} }
}, },
mounted() { mounted() {
this.userInfo = uni.cache.get('userInfo') console.log(13)
this.userId = this.userInfo.id; this.init()
this.userHeadImg = this.userInfo.headImg; // console.log(this.userInfo)
this.nickName = this.userInfo.nickName && this.userInfo.nickName != '微信用户' ? this.userInfo.nickName : ''; // this.userId = this.userInfo.id;
this.telephone = this.userInfo.telephone; // console.log(this.userInfo, '调试1113');
this.birthDay = this.userInfo.birthDay
console.log(this.userInfo, '调试1113');
}, },
methods: { methods: {
async init() {
let res = await this.api.shopUserInfo({
"shopId": this.shopId,
"userId": uni.cache.get('userInfo').id,
})
console.log(res)
if (res.code == 0) {
this.shopUserInfo = res.data;
}
this.userHeadImg = this.shopUserInfo.headImg;
this.nickName = this.shopUserInfo.nickName && this.shopUserInfo.nickName != '微信用户' ? this.shopUserInfo.nickName : '';
this.telephone = this.shopUserInfo.telephone;
this.birthDay = this.shopUserInfo.birthDay
},
showClose (){ showClose (){
console.log(2) console.log(2)
uni.navigateBack() uni.navigateBack()
@@ -188,7 +205,35 @@
* 注册会员 * 注册会员
*/ */
async registerMember () { async registerMember () {
console.log(this.userInfo) console.log(this.birthDay)
// if ( this.userHeadImg == "" || this.userHeadImg == null ) {
// uni.showToast({
// title: '请选择会员头像',
// icon: 'none'
// });
// return;
// }
if ( this.nickName == "" || this.nickName == null ) {
uni.showToast({
title: '请输入会员昵称',
icon: 'none'
});
return;
}
// if ( this.birthDay == "" || this.birthDay == null ) {
// uni.showToast({
// title: '请选择日期',
// icon: 'none'
// });
// return;
// }
if ( this.telephone == "" || this.telephone == null ) {
uni.showToast({
title: '请获取手机号',
icon: 'none'
});
return;
}
if ( !this.isProtocol ) { if ( !this.isProtocol ) {
uni.showToast({ uni.showToast({
title: '请勾选协议', title: '请勾选协议',
@@ -197,7 +242,7 @@
return; return;
} }
let res = await this.api.openMember({ let res = await this.api.openMember({
id: this.userId, id: uni.cache.get('userInfo').id,
shopId: this.shopId, shopId: this.shopId,
nickName: this.nickName, nickName: this.nickName,
headImg: this.userHeadImg, headImg: this.userHeadImg,
@@ -221,6 +266,9 @@
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>
.u-datetime-picker {
height: 300px !important;
}
.register-member-wrap{ .register-member-wrap{
padding: 64rpx 24rpx; padding: 64rpx 24rpx;
display: flex; display: flex;
@@ -298,11 +346,11 @@
font-weight: 400; font-weight: 400;
font-size: 24rpx; font-size: 24rpx;
color: #666666; color: #666666;
margin-bottom: 32rpx;
} }
.agreement_item{ .agreement_item{
display: flex; display: flex;
margin-bottom: 16rpx; padding-top: 32rpx;
padding-bottom: 16rpx;
.agreement_item_text{ .agreement_item_text{
font-weight: 500; font-weight: 500;
font-size: 24rpx; font-size: 24rpx;

View File

@@ -3,16 +3,16 @@
<view class="location" @click="openLocation"> <view class="location" @click="openLocation">
<image class="location_icon" src="https://czg-qr-order.oss-cn-beijing.aliyuncs.com/menber/location.png" mode="aspectFill"></image> <image class="location_icon" src="https://czg-qr-order.oss-cn-beijing.aliyuncs.com/menber/location.png" mode="aspectFill"></image>
<view>{{ userInfo.shopName }}</view> <view>{{ shopUserInfo.shopName }}</view>
<u-icon name="arrow-right" color="#575B66" size="28"></u-icon> <u-icon name="arrow-right" color="#575B66" size="28"></u-icon>
</view> </view>
<view class="card_info flex-colum"> <view class="card_info flex-colum">
<view class="title">账户余额()</view> <view class="title">账户余额()</view>
<view class="card_info_con flex-between"> <view class="card_info_con flex-between">
<view class="balance">{{userInfo.amount || '0.00'}}</view> <view class="balance">{{shopUserInfo.amount || '0.00'}}</view>
<view class="card_info_con_right flex-end"> <view class="card_info_con_right flex-end">
<view class="card_info_con_right_item flex-colum" @click="handleClick(item)" v-for="(item,index) in cardManageList" :key="index"> <view class ="card_info_con_right_item flex-colum" @click="handleClick(item)" v-for="(item,index) in cardManageList" :key="index">
<image class="card_info_con_right_item_icon" :src="item.icon" mode="aspectFill"></image> <image class="card_info_con_right_item_icon" :src="item.icon" mode="aspectFill"></image>
<text class="card_info_con_right_item_text">{{item.name}}</text> <text class="card_info_con_right_item_text">{{item.name}}</text>
</view> </view>
@@ -20,9 +20,19 @@
</view> </view>
</view> </view>
<!-- <view class="therecontent"> <view class="customAmount" v-if="shopUserInfo.isUser == 1">
<input type="number" v-model="amount" placeholder="自定义金额"> <view class="customAmount_left">
</view> --> <text class="customAmount_left_tip"></text>
<u-input
type="number"
v-model="amount"
inputAlign="left"
:placeholder="`充${minNum}送${handselNum}`"
:customStyle="{border: '0'}"
></u-input>
</view>
<text class="customAmount_right">自定义金额</text>
</view>
<view class="rechargeList"> <view class="rechargeList">
<view class="rechargeList_f" @click="clickinput(item,index)" v-for="(item,index) in listdata" :key="index"> <view class="rechargeList_f" @click="clickinput(item,index)" v-for="(item,index) in listdata" :key="index">
<viwe class="rechargeList_item flex-colum " :class="index == inputshow?'active':''"> <viwe class="rechargeList_item flex-colum " :class="index == inputshow?'active':''">
@@ -57,7 +67,7 @@
<view class="explain"> <view class="explain">
<view class="explain-top flex-between"> <view class="explain-top flex-between">
<text class="explain-top_title">适用门店</text> <text class="explain-top_title">适用门店</text>
<text class="shopName">{{ userInfo.shopName }}</text> <text class="shopName">{{ shopUserInfo.shopName }}</text>
</view> </view>
<view class="explain_content"> <view class="explain_content">
<text class="explain_content_title">充值说明</text> <text class="explain_content_title">充值说明</text>
@@ -68,20 +78,19 @@
</view> </view>
<view class="rechargeBox"> <view class="rechargeBox">
<view class="agreement"> <view class="agreement" @click="isProtocol = !isProtocol">
<u-checkbox-group> <u-checkbox-group >
<u-checkbox shape="circle" activeColor="#E3AD7F" @change="radioChange" size="30"> <u-checkbox :checked="isProtocol" shape="circle" activeColor="#E3AD7F" @change="radioChange" size="35" iconSize="20">
<view style="width: 100rpx;height: 100rpx;"></view>
</u-checkbox> </u-checkbox>
</u-checkbox-group> </u-checkbox-group>
<text>已同意</text> <text>已同意</text>
<text class="agreement_text" @click="viewProtocol">用户隐私协议</text> <text class="agreement_text" @click.stop="viewProtocol">用户隐私协议</text>
<!-- <text class="agreement_text" @click="viewProtocol">用户储值协议</text> --> <!-- <text class="agreement_text" @click="viewProtocol">用户储值协议</text> -->
<!-- <text class="agreement_text" @click="viewProtocol">用户授权协议</text> --> <!-- <text class="agreement_text" @click="viewProtocol">用户授权协议</text> -->
</view> </view>
<view class="recharge" @tap="$u.debounce(userbalancerechangesub, 500)">立即充值</view> <view class="recharge" @tap="$u.debounce(userbalancerechangesub, 500)">立即充值</view>
</view> </view>
<registermember :show="memberOpen" :shopId="shopId" :userInfo="userInfo" @getRegisterMember="getRegisterMember"></registermember> <registermember :show="memberOpen" :shopUserInfo="shopUserInfo" :shopId="shopId" @getRegisterMember="getRegisterMember"></registermember>
</view> </view>
</template> </template>
@@ -98,8 +107,11 @@
memberOpen: false, memberOpen: false,
isProtocol: false, isProtocol: false,
listdata: [], listdata: [],
amount: '', amount: 0,
minNum: 0,
handselNum: 0,
userInfo: {}, userInfo: {},
shopUserInfo: null,
shopId: '', shopId: '',
giftList: [], giftList: [],
cardManageList: [ cardManageList: [
@@ -110,7 +122,6 @@
} }
}, },
async onLoad(e) { async onLoad(e) {
console.log(e)
// if ( e.type == 'list' || e.type == 'index') { // if ( e.type == 'list' || e.type == 'index') {
// this.shopId = e.shopId; // this.shopId = e.shopId;
// this.init(); // this.init();
@@ -122,10 +133,12 @@
// if (!uni.cache.get('token')) { // if (!uni.cache.get('token')) {
// await this.$onLaunched; // await this.$onLaunched;
// } // }
this.init(); this.shopInfo();
this.paygetActive()
} else{ } else{
this.shopId = e.shopId; this.shopId = e.shopId;
this.init(); this.shopInfo();
this.paygetActive()
} }
console.log(this.shopId) console.log(this.shopId)
}, },
@@ -133,20 +146,20 @@
/** /**
* 初始化 * 初始化
*/ */
async init() { async shopInfo() {
let res = await this.api.shopUserInfo({ let res = await this.api.shopUserInfo({
"shopId": this.shopId, "shopId": this.shopId,
"userId": uni.cache.get('userInfo').id, "userId": uni.cache.get('userInfo').id,
}) })
if (res.code == 0) { if (res.code == 0) {
this.usershopUserinfo = res.data this.shopUserInfo = res.data
} }
if ( this.usershopUserinfo.isVip == 0 ) {
if ( this.shopUserInfo.isVip == 0 ) {
this.memberOpen = true; this.memberOpen = true;
return;
} }
this.paygetShopByMember(this.shopId)
this.paygetActive()
}, },
/** /**
@@ -161,8 +174,10 @@
try { try {
this.listdata = res.data.list; this.listdata = res.data.list;
this.giftList = this.listdata[0].giftList; this.giftList = this.listdata[0].gives;
this.amount = res.data.list[0].minNum this.amount = this.listdata[0].minNum;
this.minNum = this.listdata[0].minNum;
this.handselNum = this.listdata[0].handselNum
} catch (e) { } catch (e) {
//TODO handle the exception //TODO handle the exception
} }
@@ -173,7 +188,9 @@
* @param {Object} e * @param {Object} e
*/ */
handleClick (item) { handleClick (item) {
uni.pro.navigateTo(item.url, this.userInfo) uni.navigateTo({
url: `/pages/${item.url}?shopUserInfo=${JSON.stringify(this.shopUserInfo)}`
})
}, },
@@ -202,7 +219,7 @@
*/ */
getRegisterMember (e) { getRegisterMember (e) {
this.memberOpen = e; this.memberOpen = e;
this.paygetShopByMember() this.shopInfo();
this.paygetActive() this.paygetActive()
}, },
@@ -212,11 +229,11 @@
openLocation () { openLocation () {
console.log('123'); console.log('123');
uni.openLocation({ uni.openLocation({
latitude: Number(this.usershopUserinfo.lat), // 目的地的纬度,浮点数,范围为-90~90 latitude: Number(this.shopUserInfo.lat), // 目的地的纬度,浮点数,范围为-90~90
longitude: Number(this.usershopUserinfo.lng), // 目的地的经度,浮点数,范围为-180~180 longitude: Number(this.shopUserInfo.lng), // 目的地的经度,浮点数,范围为-180~180
scale: 18, // 缩放比例范围5~18 scale: 18, // 缩放比例范围5~18
name: this.usershopUserinfo.shopName, // 位置名 name: this.shopUserInfo.shopName, // 位置名
address: this.usershopUserinfo.address, // 地址的详细说明 address: this.shopUserInfo.address, // 地址的详细说明
success() { success() {
console.log('导航启动成功'); console.log('导航启动成功');
@@ -248,22 +265,6 @@
return null; return null;
}, },
/**
* 获取门店会员信息
* @param {Object} w
*/
async paygetShopByMember(w) {
let res = await this.api.paygetShopByMember({
page: 1,
pageSize: 10,
userId: uni.cache.get('userInfo').id,
shopId: this.shopId
})
this.userInfo = res.data.list[0]
},
/** /**
* 充值金额切换 * 充值金额切换
* @param {Object} a * @param {Object} a
@@ -272,14 +273,17 @@
clickinput(a, b) { clickinput(a, b) {
console.log(a, b) console.log(a, b)
this.inputshow = b; this.inputshow = b;
this.giftList = a.gives;
this.amount = a.minNum; this.amount = a.minNum;
this.giftList = a.giftList; this.minNum = a.minNum;
this.handselNum = a.handselNum;
}, },
/** /**
* 充值 * 充值
*/ */
async userbalancerechangesub() { async userbalancerechangesub() {
let _this = this;
if (!this.isProtocol) { if (!this.isProtocol) {
uni.showToast({ uni.showToast({
title: '请勾选协议', title: '请勾选协议',
@@ -325,15 +329,22 @@
}) })
uni.hideLoading() uni.hideLoading()
let pages = getCurrentPages() let pages = getCurrentPages()
if ( pages.length > 1) { uni.requestSubscribeMessage({
this.paygetShopByMember() tmplIds:["AV-KybUHaK3KtFVLqpy6PHccHBS7XeX__mOM4RbufnQ"],
} else { complete() {
setTimeout(res => { if ( pages.length > 1) {
uni.switchTab({ _this.shopInfo()
url: '/pages/index/index' } else {
}) setTimeout(res => {
}, 500) uni.switchTab({
} url: '/pages/index/index'
})
}, 500)
}
},
})
}, },
fail: (res) => { fail: (res) => {
@@ -356,7 +367,7 @@
} }
.content { .content {
padding: 16rpx 20rpx 0 20rpx; padding: 16rpx 20rpx 245rpx 20rpx;
.location{ .location{
display: flex; display: flex;
@@ -413,6 +424,39 @@
} }
} }
.customAmount{
display: flex;
justify-content: space-between;
align-items: center;
margin-bottom: 32rpx;
padding: 14rpx 16rpx;
background-color: #fff;
border-radius: 8rpx;
.customAmount_left{
width: 100%;
display: flex;
align-items: center;
.customAmount_left_tip{
font-weight: 400;
font-size: 28rpx;
color: #333333;
}
input{
width: 100%;
font-weight: 500;
font-size: 24rpx;
color: #333;
padding-left: 16rpx;
}
}
.customAmount_right{
font-weight: 500;
font-size: 28rpx;
color: #666666;
flex-shrink: 0;
}
}
.rechargeList{ .rechargeList{
width: 100%; width: 100%;
display: flex; display: flex;
@@ -533,6 +577,7 @@
border-radius: 50%; border-radius: 50%;
background-color: #F7853D; background-color: #F7853D;
margin-right: 8rpx; margin-right: 8rpx;
flex-shrink: 0;
} }
.text{ .text{
font-weight: 400; font-weight: 400;
@@ -549,6 +594,7 @@
display: flex; display: flex;
flex-direction: column; flex-direction: column;
padding: 22rpx 24rpx; padding: 22rpx 24rpx;
margin-bottom: 30rpx;
.explain-top{ .explain-top{
// align-items: center; // align-items: center;
margin-bottom: 18rpx; margin-bottom: 18rpx;
@@ -583,7 +629,7 @@
.rechargeBox{ .rechargeBox{
width: 100%; width: 100%;
padding: 16rpx 28rpx 84rpx 28rpx; padding: 0 28rpx 84rpx 28rpx;
background-color: #fff; background-color: #fff;
position: fixed; position: fixed;
left: 0; left: 0;
@@ -592,7 +638,8 @@
display: flex; display: flex;
align-items: center; align-items: center;
justify-content: center; justify-content: center;
margin-bottom: 20rpx; padding-top: 16rpx;
padding-bottom: 20rpx;
text{ text{
font-size: 24rpx; font-size: 24rpx;
} }

View File

@@ -3,28 +3,29 @@
<view class="content"> <view class="content">
<!-- <card :userInfo="userInfo"></card> --> <!-- <card :userInfo="userInfo"></card> -->
<view class="card_info"> <view class="card_info">
<image class="card_info_bg" src="https://czg-qr-order.oss-cn-beijing.aliyuncs.com/menber/member_bg.png" mode="aspectFill"></image> <image class="card_info_bg" :src="shopExtend?shopExtend.value:'https://czg-qr-order.oss-cn-beijing.aliyuncs.com/menber/member_bg.png'" mode="aspectFill"></image>
<view class="card_info_bg_box"></view>
<view class="card_content"> <view class="card_content">
<view class="card_head"> <view class="card_head">
<view class="card_head_left"> <view class="card_head_left">
<image class="card_head_left_head" src="https://czg-qr-order.oss-cn-beijing.aliyuncs.com/menber/member_head.png" mode="aspectFill"></image> <image class="card_head_left_head" src="https://czg-qr-order.oss-cn-beijing.aliyuncs.com/menber/member_head.png" mode="aspectFill"></image>
<text class="card_head_left_name">{{userInfo.shopName}}会员卡</text> <text class="card_head_left_name">{{shopUserInfo.shopName}}会员卡</text>
<view class="card_head_left_icon_box" v-if="userInfo.isVip != 0"> <view class="card_head_left_icon_box" v-if="shopUserInfo.isVip != 0">
<image class="card_head_left_icon1" src="https://czg-qr-order.oss-cn-beijing.aliyuncs.com/menber/member_icon1.png" mode="aspectFill"></image> <image class="card_head_left_icon1" src="https://czg-qr-order.oss-cn-beijing.aliyuncs.com/menber/member_icon1.png" mode="aspectFill"></image>
<text class="card_head_left_iconText">VL1</text> <text class="card_head_left_iconText">VL1</text>
</view> </view>
</view> </view>
<view class="card_head_right" @click="clickEvent" v-if="userInfo.isVip != 0"> <view class="card_head_right" @click="clickEvent" v-if="shopUserInfo.isVip != 0">
<image class="card_head_left_qrCode" src="https://czg-qr-order.oss-cn-beijing.aliyuncs.com/menber/member_qrCode.png" mode="aspectFill"></image> <image class="card_head_left_qrCode" src="https://czg-qr-order.oss-cn-beijing.aliyuncs.com/menber/member_qrCode.png" mode="aspectFill"></image>
</view> </view>
</view> </view>
<view class="card_cen"> <view class="card_cen">
<view class="card_cen_left">{{ userInfo.isVip == 0 ? '尚未开通会员暂无法享受会员权益' : '欢迎加入本店会员~'}}</view> <view class="card_cen_left">{{ shopUserInfo.isVip == 0 ? '尚未开通会员暂无法享受会员权益' : '欢迎加入本店会员~'}}</view>
<view class="card_cen_right" v-if="userInfo.isVip != 0">查看特权</view> <view class="card_cen_right" v-if="shopUserInfo.isVip != 0">查看特权</view>
</view> </view>
<view class="card_bom" v-if="userInfo.isVip != 0"> <view class="card_bom" v-if="shopUserInfo.isVip != 0">
<view class="card_bom_item" @click="itemClick(1)"> <view class="card_bom_item" @click="itemClick(1)">
<text>{{userInfo.amount || '0.00'}}</text><text>储值</text> <text>{{shopUserInfo.amount || '0.00'}}</text><text>储值</text>
</view> </view>
<view class="card_bom_item"> <view class="card_bom_item">
<text>0</text><text>积分</text> <text>0</text><text>积分</text>
@@ -40,8 +41,8 @@
</view> </view>
<view class="card_bottom" :class="userInfo.isVip == 0 ? 'n' : ''"> <view class="card_bottom" :class="shopUserInfo.isVip == 0 ? 'n' : ''">
<view class="card_bottom_Box" v-if="userInfo.isVip != 0"> <view class="card_bottom_Box" v-if="shopUserInfo.isVip != 0">
<view class="card_bottom_left flex-start"> <view class="card_bottom_left flex-start">
<image class="card_bottom_head" src="https://czg-qr-order.oss-cn-beijing.aliyuncs.com/menber/member_head2.png" mode="aspectFill"></image> <image class="card_bottom_head" src="https://czg-qr-order.oss-cn-beijing.aliyuncs.com/menber/member_head2.png" mode="aspectFill"></image>
<view class=""> <view class="">
@@ -72,7 +73,7 @@
</view> </view>
</view> </view>
<registermember :show="memberOpen" :shopId="shopId_id" :userInfo="userInfo" @getRegisterMember="getRegisterMember"></registermember> <registermember :show="memberOpen" :shopUserInfo="shopUserInfo" :shopId="shopId_id" @getRegisterMember="getRegisterMember"></registermember>
</view> </view>
</template> </template>
@@ -88,13 +89,13 @@
shopId_id: null, shopId_id: null,
memberOpen: false, memberOpen: false,
amount: '', amount: '',
userInfo: {}, shopUserInfo: null,
lucky: { lucky: {
list: ['鸿运当头',"财运亨通","时来运转","否极泰来","花逢时发"], list: ['鸿运当头',"财运亨通","时来运转","否极泰来","花逢时发"],
index: 0, index: 0,
text: "" text: ""
}, },
usershopUserinfo:{}, shopExtend: null,
} }
}, },
onLoad(e) { onLoad(e) {
@@ -102,30 +103,42 @@
}, },
onShow() { onShow() {
this.init(); this.init();
this.getShopExtend();
}, },
methods: { methods: {
/** /**
* 获取店铺信息 * 获取店铺信息
*/ */
async init() { async init() {
let res = await this.api.shopUserInfo({ let res = await this.api.shopUserInfo({
"shopId": this.shopId_id, "shopId": this.shopId_id,
"userId": uni.cache.get('userInfo').id, "userId": uni.cache.get('userInfo').id,
}) })
if (res.code == 0) { if (res.code == 0) {
this.userInfo = res.data this.shopUserInfo = res.data
uni.cache.set('shopUserInfo',res.data)
} }
if ( this.userInfo.isVip == 0 ) { if ( this.shopUserInfo.isVip == 0 ) {
this.memberOpen = true; this.memberOpen = true;
return;
} }
}, },
/**
* 获取背景图
*/
async getShopExtend () {
let res = await this.api.getShopExtend({
shopId: this.shopId_id,
autokey: "member_bg" //index_bg my_bg member_bg shopInfo_bg
})
if ( res.code == 0) {
this.shopExtend = res.data;
}
},
itemClick ( type ) { itemClick ( type ) {
if ( type == 1) { if ( type == 1) {
uni.pro.navigateTo('member/index', { uni.pro.navigateTo('member/index', {
shopId: this.userInfo.shopId, shopId: this.shopUserInfo.shopId,
type: 'index', type: 'index',
}) })
} else if ( type == 3 ) { } else if ( type == 3 ) {
@@ -144,7 +157,7 @@
clickEvent() { clickEvent() {
uni.navigateTo({ uni.navigateTo({
url: '/pages/pay_code/pay_code?shopInfo=' + JSON.stringify(this.userInfo) url: '/pages/pay_code/pay_code?shopInfo=' + JSON.stringify(this.shopUserInfo)
}) })
}, },
} }
@@ -166,12 +179,21 @@
margin: auto; margin: auto;
position: relative; position: relative;
z-index: 2; z-index: 2;
padding-top: 20rpx;
.card_info_bg{ .card_info_bg{
width: 630rpx; width: 630rpx;
height: 304rpx; height: 304rpx;
position: absolute; position: absolute;
z-index: 1; z-index: 1;
} }
.card_info_bg_box{
width: 630rpx;
height: 304rpx;
position: absolute;
z-index: 1;
border-radius: 24rpx;
background-color: rgba(51,51,51,0.5);
}
.card_content{ .card_content{
position: relative; position: relative;
left: 0; left: 0;

View File

@@ -4,6 +4,10 @@
<view class="box_item flex-between"> <view class="box_item flex-between">
<text class="top_box_one_text">当前账号</text> <text class="top_box_one_text">当前账号</text>
<input type="number" v-model="mobile" placeholder="请输入手机号" maxlength="11" disabled="disabled" /> <input type="number" v-model="mobile" placeholder="请输入手机号" maxlength="11" disabled="disabled" />
<button v-if="!mobile" class="getPhone" open-type="getPhoneNumber" @getphonenumber="getPhone">
<view class="text">获取微信手机号</view>
</button>
</view> </view>
<view class="box_item flex-between" style="position:relative;"> <view class="box_item flex-between" style="position:relative;">
<text class="top_box_one_text"></text> <text class="top_box_one_text"></text>
@@ -36,10 +40,10 @@
export default { export default {
data() { data() {
return { return {
isPwd: uni.cache.get('userInfo').isPwd, isPwd: "",
mobile: uni.cache.get('userInfo').telephone.slice(0, 3)+'****'+uni.cache.get('userInfo').telephone.slice(7), mobile: "",
form: { form: {
mobile: uni.cache.get('userInfo').telephone, mobile: '',
password: '', password: '',
payPassword: '', payPassword: '',
checkCode: '' checkCode: ''
@@ -49,16 +53,20 @@
// 注册定时器 初始值 // 注册定时器 初始值
second: 60, second: 60,
showText: true, showText: true,
Recapture: '获取验证码' Recapture: '获取验证码',
shopUserInfo: null,
}; };
}, },
onLoad(e) { onLoad(e) {
// if ( e.shopUserInfo ) { console.log(e)
// this.shopUserInfo = JSON.parse(e.shopUserInfo); if ( e.shopUserInfo ) {
// this.isPwd = this.shopUserInfo.isPwd; this.shopUserInfo = JSON.parse(e.shopUserInfo);
// this.mobile = this.shopUserInfo.telephone.slice(0, 3)+'****'+this.shopUserInfo.telephone.slice(7); console.log(this.shopUserInfo)
// this.form.mobile = this.shopUserInfo.telephone; this.isPwd = this.shopUserInfo.isPwd;
// } this.mobile = this.shopUserInfo.telephone ? ( this.shopUserInfo.telephone.slice(0, 3)+'****'+this.shopUserInfo.telephone.slice(7) ) : '';
this.form.mobile = this.shopUserInfo.telephone;
}
}, },
methods: { methods: {
@@ -86,6 +94,33 @@
}, 60000); }, 60000);
} }
}, },
/**
* 获取手机号
* @param {Object} d
*/
async getPhone(d) {
if (d.detail.iv) {
uni.login({
provider: 'weixin',
success: async (data) => {
console.log(data)
let res = await this.api.userwxlogins({
code: data.code,
encryptedData: d.detail.encryptedData,
iv: d.detail.iv,
})
this.form.mobile = res.data;
this.mobile = this.form.mobile ? ( this.form.mobile.slice(0, 3)+'****'+this.form.mobile.slice(7) ) : '';
let res2 = await this.api.upVipPhont({
id: this.shopUserInfo.id,
telephone: res.data,
})
}
})
}
},
async loginwxuserInfo() { async loginwxuserInfo() {
let res = await this.api.loginwxuserInfo({ let res = await this.api.loginwxuserInfo({
userId: uni.cache.get('userInfo').id userId: uni.cache.get('userInfo').id
@@ -139,6 +174,7 @@
return false; return false;
} }
let res = await this.api.loginresetPwd({ let res = await this.api.loginresetPwd({
vipId: this.shopUserInfo.id,
pwd: this.form.password, pwd: this.form.password,
code: this.form.checkCode code: this.form.checkCode
}) })
@@ -189,6 +225,7 @@
.box_item { .box_item {
border-bottom: 1rpx solid #E5E5E5; border-bottom: 1rpx solid #E5E5E5;
position: relative;
.top_box_one_text { .top_box_one_text {
font-family: Source Han Sans CN, Source Han Sans CN; font-family: Source Han Sans CN, Source Han Sans CN;
font-weight: 500; font-weight: 500;
@@ -256,5 +293,16 @@
background-color: #E3AD7F; background-color: #E3AD7F;
} }
} }
.getPhone{
line-height: initial;
background-color: none;
border: 2rpx solid #E3AD7F;
color: #E3AD7F;
font-size: 28rpx;
padding: 5rpx 10rpx;
position: absolute;
right: 10rpx;
z-index: 2;
}
} }
</style> </style>

View File

@@ -13,7 +13,7 @@
export default { export default {
data() { data() {
return { return {
userInfo: null, shopUserInfo: null,
list: [ list: [
{name: "余额明细", url: "member/billDetails"}, {name: "余额明细", url: "member/billDetails"},
{name: "密码设置", url: "member/setPassword"}, {name: "密码设置", url: "member/setPassword"},
@@ -22,7 +22,7 @@
} }
}, },
onLoad(e) { onLoad(e) {
this.userInfo = e this.shopUserInfo = JSON.parse(e.shopUserInfo)
}, },
methods: { methods: {
@@ -30,7 +30,9 @@
* 跳转 * 跳转
*/ */
handleClick ( item ) { handleClick ( item ) {
uni.pro.navigateTo(item.url, this.userInfo) uni.navigateTo({
url: `/pages/${item.url}?shopUserInfo=${JSON.stringify(this.shopUserInfo)}`
})
} }
} }
} }

View File

@@ -518,9 +518,8 @@
if (res.data == 1) { if (res.data == 1) {
this.showToastUppop('支付成功') this.showToastUppop('支付成功')
let _this = this let _this = this
uni.requestSubscribeMessage({ uni.requestSubscribeMessage({
tmplIds: ['z0fUG7-jhSfYCrw6poOvSRzh4_hgnPkm_5C7E5s5bCQ'], tmplIds:["z0fUG7-jhSfYCrw6poOvSRzh4_hgnPkm_5C7E5s5bCQ","AV-KybUHaK3KtFVLqpy6PHccHBS7XeX__mOM4RbufnQ"],
complete() { complete() {
uni.redirectTo({ uni.redirectTo({
url: '/pages/order/order_detail?orderId=' + _this url: '/pages/order/order_detail?orderId=' + _this

View File

@@ -13,7 +13,7 @@
:navigateBacknavtitle='true'></navseat> :navigateBacknavtitle='true'></navseat>
<!-- 顶部面板可添加所需要放在页面顶部的内容代码比如banner图 --> <!-- 顶部面板可添加所需要放在页面顶部的内容代码比如banner图 -->
<image class="panelimgbackground" <image class="panelimgbackground"
:src="shopInfo.storeInfo.coverImg||'https://czg-qr-order.oss-cn-beijing.aliyuncs.com/shopDetails/topBanner.png'" :src="shopExtend?shopExtend.value:'https://czg-qr-order.oss-cn-beijing.aliyuncs.com/shopDetails/topBanner.png'"
mode="aspectFill"> mode="aspectFill">
</image> </image>
<view class="panelone"> <view class="panelone">
@@ -152,7 +152,7 @@
<view class="monthlySale">月售{{item1.stockNumber}}</view> <view class="monthlySale">月售{{item1.stockNumber}}</view>
<view v-if="item1.isPauseSale != 0 || item.isSale == 0 " class="flex-between"> <view v-if="item1.isPauseSale != 0 || item1.isSale == 0 " class="flex-between">
<view class="money"><text class="money_num">{{ item1.lowPrice }}</text>/</view> <view class="money"><text class="money_num">{{ item1.lowPrice }}</text>/</view>
<view class="flex-end" > <view class="flex-end" >
<view class="sku-wrap flex-center" style="background-color: #CECECE;"> <view class="sku-wrap flex-center" style="background-color: #CECECE;">
@@ -256,12 +256,12 @@
</view> </view>
<view class="operation-wrap"> <view class="operation-wrap">
<view class="btn" v-if="item.number" > <view class="btn" v-if="item.number" >
<u-icon name="minus-circle-fill" color="#E9AB7A" size="50"></u-icon> <u-icon name="minus-circle-fill" size="50"></u-icon>
<view class="btnClick" @click="cartListadd(item,index,'-')"></view> <view class="btnClick" @click="cartListadd(item,index,'-')"></view>
</view> </view>
<text class="num" v-if="item.number">{{ item.number }}</text> <text class="num" v-if="item.number">{{ item.number }}</text>
<view class="btn"> <view class="btn">
<u-icon name="plus-circle-fill" color="#E9AB7A" size="50"></u-icon> <u-icon name="plus-circle-fill" :color="item.isVip == 1 ? '#CECECE' : '#E9AB7A'" size="50"></u-icon>
<view class="btnClick" @click="cartListadd(item,index,'+')"></view> <view class="btnClick" @click="cartListadd(item,index,'+')"></view>
</view> </view>
</view> </view>
@@ -330,11 +330,20 @@
<view class="shop_sku_box_name"> <view class="shop_sku_box_name">
{{item.name}} {{item.name}}
</view> </view>
<!-- :class="item.start == index1 ?'shop_sku_box_item_selected':''"> -->
<view class="flex-start"> <view class="flex-start">
<view class="shop_sku_box_item" v-for="(item1,index1) in item.children" :key="index1" <view class="shop_sku_box_item" v-for="(item1,index1) in item.children" :key="index1"
@click="morloe(item1,index,index1,item)" :style="{color:!item1.isGrounding?'#999':''}" @click="morloe(item1,index,index1,item)"
:class=" item.start == index1 ?'shop_sku_box_item_selected':''"> :class="{'shop_sku_box_item_selected': item.start == index1, 'disabled': !item1.disabled || !item1.isGrounding || item1.isPauseSale==1}"
>
{{item1.name}} {{item1.name}}
<view class="shop_sku_box_item_tip" v-if="item1.isGrounding == false">
<view>下架</view>
</view>
<view class="shop_sku_box_item_tip" v-if="item1.isPauseSale == 1 && item1.isGrounding == true">
<view>售罄</view>
</view>
<!-- disabled -->
</view> </view>
</view> </view>
</view> </view>
@@ -369,15 +378,18 @@
</view> </view>
</view> </view>
</u-popup> </u-popup>
<popupad :forceUpdate="forceUpdate" :showPosition="'make_order'"></popupad>
</view> </view>
</template> </template>
<script> <script>
import navseat from '@/components/navseat.vue' import navseat from '@/components/navseat.vue'
import webSocketUtils from '@/common/js/websocket.js'; import webSocketUtils from '@/common/js/websocket.js';
import popupad from '@/components/popupad.vue'
export default { export default {
components: { components: {
navseat navseat,
popupad
}, },
data() { data() {
return { return {
@@ -413,6 +425,8 @@
lastbottom: '', //元素最低端的距离 lastbottom: '', //元素最低端的距离
scrollxleft: true, scrollxleft: true,
orderdetailFlag: true, orderdetailFlag: true,
forceUpdate: false,
shopExtend: null,
} }
}, },
onPageScroll(e) { onPageScroll(e) {
@@ -460,17 +474,28 @@
}, },
async onShow() { async onShow() {
let _this = this; let _this = this;
this.forceUpdate = !this.forceUpdate;
this.orderdetailFlag = true; this.orderdetailFlag = true;
uni.pageScrollTo({ uni.pageScrollTo({
scrollTop: 0, scrollTop: 0,
duration: 0 duration: 0
}); });
console.log(uni.cache.get('token'))
console.log(14)
_this.getLocation() _this.getLocation()
}, },
methods: { methods: {
/**
* 获取背景图
*/
async getShopExtend () {
let res = await this.api.getShopExtend({
shopId: uni.cache.get('shopUser'),
autokey: "shopInfo_bg" //index_bg my_bg member_bg shopInfo_bg
})
if ( res.code == 0) {
this.shopExtend = res.data;
}
},
navigateBacknav() { navigateBacknav() {
uni.pro.switchTab('index/index') uni.pro.switchTab('index/index')
}, },
@@ -500,35 +525,40 @@
* 获取定位 * 获取定位
*/ */
getLocation() { getLocation() {
try { if ( !uni.cache.get('getLocationstorage') ) {
uni.getLocation({ try {
type: 'wgs84', uni.getLocation({
success: async (res) => { type: 'wgs84',
let successres = await this.api.geocodelocation({ success: async (res) => {
lng: res.longitude, let successres = await this.api.geocodelocation({
lat: res.latitude,
})
if (successres.code == 0) {
let datastorage = {
country: successres.data.addressComponent.country, // "中国"
province: successres.data.addressComponent.province, //province: "陕西省"
address: successres.data.addressComponent.city, //district: "西安市"
district: successres.data.addressComponent.district, //district: "未央区"
lng: res.longitude, lng: res.longitude,
lat: res.latitude, lat: res.latitude,
})
if (successres.code == 0) {
let datastorage = {
country: successres.data.addressComponent.country, // "中国"
province: successres.data.addressComponent.province, //province: "陕西省"
address: successres.data.addressComponent.city, //district: "西安市"
district: successres.data.addressComponent.district, //district: "未央区"
lng: res.longitude,
lat: res.latitude,
}
uni.cache.set('getLocationstorage', datastorage);
this.productqueryShop();
} }
uni.cache.set('getLocationstorage', datastorage); },
fail: async (err) => {
this.productqueryShop(); this.productqueryShop();
} }
}, });
fail: async (err) => { } catch (e) {
this.productqueryShop(); this.productqueryShop();
} //TODO handle the exception
}); }
} catch (e) { } else {
this.productqueryShop(); this.productqueryShop();
//TODO handle the exception
} }
}, },
/** /**
@@ -547,6 +577,7 @@
this.shopInfo = res.data; this.shopInfo = res.data;
this.productqueryProduct() //list 数据 this.productqueryProduct() //list 数据
this.handlemessage() //监听websocket返回 this.handlemessage() //监听websocket返回
this.getShopExtend();
} else { } else {
setTimeout(() => { setTimeout(() => {
uni.pro.switchTab('index/index') uni.pro.switchTab('index/index')
@@ -562,14 +593,17 @@
this.shopProductList.productInfo[index].products[index1]['imgLoad'] = true; this.shopProductList.productInfo[index].products[index1]['imgLoad'] = true;
// e.currentTarget.src // e.currentTarget.src
}, },
/**
* 跳转搜索
* @param {Object} e
*/
searchStatus (e) { searchStatus (e) {
if ( e == "searchClick" ) { if ( e == "searchClick" ) {
uni.navigateTo({ uni.navigateTo({
url: '/pages/order_food/order_food_search?tableCode=' + uni.cache.get('tableCode') url: '/pages/order_food/order_food_search?tableCode=' + uni.cache.get('tableCode')
}); });
} }
console.log(e)
}, },
/** /**
@@ -584,7 +618,16 @@
if (b == '单规格') { //没有规格为空 if (b == '单规格') { //没有规格为空
this.skuidname = [] this.skuidname = []
} }
if ( a == "+" && item.isVip == 1 && item.cartNumber >= item.limitNumber){
uni.showToast({
title: '当前商品已达到最大赠送数量',
icon: 'none'
})
return;
}
let cartNumber = a == '+' ? item.cartNumber + 1 : item.cartNumber - 1; let cartNumber = a == '+' ? item.cartNumber + 1 : item.cartNumber - 1;
this.hodgepodge(item, 1, a, cartNumber) //获取skuid /1添加购物车 this.hodgepodge(item, 1, a, cartNumber) //获取skuid /1添加购物车
}, },
@@ -598,7 +641,13 @@
*/ */
shopAdd(item, index, index1, a, b) { shopAdd(item, index, index1, a, b) {
if (a == "+") { if (a == "+") {
if ( item.isVip == 1 && this.amountcartNumber >= item.limitNumber){
uni.showToast({
title: '当前商品已达到最大赠送数量',
icon: 'none'
})
return;
}
if (this.skuNumber < this.skuSuit && this.amountcartNumber < this.skuSuit) { if (this.skuNumber < this.skuSuit && this.amountcartNumber < this.skuSuit) {
this.amountcartNumber = this.amountcartNumber + (this.skuSuit == 0 ? 1 : this.skuSuit); this.amountcartNumber = this.amountcartNumber + (this.skuSuit == 0 ? 1 : this.skuSuit);
} else { } else {
@@ -624,6 +673,13 @@
return; return;
} }
let num = 0; let num = 0;
if ( item.isVip == 1 && item.cartNumber >= item.limitNumber){
uni.showToast({
title: '当前商品已达到最大赠送数量',
icon: 'none'
})
return;
}
if (item.typeEnum == "normal") { if (item.typeEnum == "normal") {
num = item.cartNumber + this.amountcartNumber; num = item.cartNumber + this.amountcartNumber;
} else { } else {
@@ -633,6 +689,7 @@
"skuId": this.skuId, "skuId": this.skuId,
"num": num, //数量 "num": num, //数量
"type": a == '+' ? 1 : 0, "type": a == '+' ? 1 : 0,
"isVip": item.isVip,
"productId": item.id, //商品id "productId": item.id, //商品id
"shopId": uni.cache.get('shopUser'), "shopId": uni.cache.get('shopUser'),
"userId": uni.cache.get('userInfo').id, "userId": uni.cache.get('userInfo').id,
@@ -649,10 +706,14 @@
*/ */
async cartListadd(item, index, c) { async cartListadd(item, index, c) {
try { try {
if ( c == "+" && item.isVip == 1){
return;
}
let params = { let params = {
"skuId": item.skuId, "skuId": item.skuId,
"num": c == '+' ? item.number + 1 : item.number - 1, //数量 "num": c == '+' ? item.number + 1 : item.number - 1, //数量
"type": c == '+' ? 1 : 0, "type": c == '+' ? 1 : 0,
"isVip": item.isVip,
"productId": item.productId, //商品id "productId": item.productId, //商品id
"shopId": uni.cache.get('shopUser'), "shopId": uni.cache.get('shopUser'),
"userId": uni.cache.get('userInfo').id, "userId": uni.cache.get('userInfo').id,
@@ -694,7 +755,7 @@
setNumber() { setNumber() {
// 处理购物车相同id的情况下 数量相加 // 处理购物车相同id的情况下 数量相加
var summedArray = this.cartLists.data.reduce((acc, current) => { var summedArray = this.cartLists.data.reduce((acc, current) => {
const existing = acc.find(item => item.productId === current.productId); const existing = acc.find(item => item.productId === current.productId && item.isVip === current.isVip);
if (existing) { if (existing) {
existing.number += current.number; existing.number += current.number;
} else { } else {
@@ -709,7 +770,7 @@
return item.products.filter(e => { return item.products.filter(e => {
e.cartNumber = 0; e.cartNumber = 0;
return summedArray.find(i => { return summedArray.find(i => {
if (e.id == i.productId) { if (e.id == i.productId && e.isVip == i.isVip) {
e.cartNumber = i.number e.cartNumber = i.number
} }
}) })
@@ -762,7 +823,7 @@
productId: item1.id, //商品id productId: item1.id, //商品id
}) })
this.querySpecList = obj.data; this.querySpecList = obj.data;
this.specifications.tagSnap = JSON.parse(item1.productSkuResult.tagSnap).map((item) => { this.specifications.tagSnap = JSON.parse(item1.productSkuResult.tagSnap).map((item,index) => {
let res = { let res = {
id: item1.id, //商品id id: item1.id, //商品id
name: item.name, name: item.name,
@@ -772,7 +833,9 @@
item.value.split(",").forEach((v, e) => { item.value.split(",").forEach((v, e) => {
res.children.push({ res.children.push({
name: v, name: v,
isGrounding: false disabled: index == 0 ? true : false,
isGrounding: index == 0 ? false : true,
isPauseSale: index == 0 ? 1 : 0,
}) })
}) })
return res return res
@@ -786,9 +849,17 @@
isSkuidname.push(this.specifications.tagSnap[0].children[o].name) isSkuidname.push(this.specifications.tagSnap[0].children[o].name)
//筛选符合条件的规格列表 //筛选符合条件的规格列表
filteredJson = this.querySpecList.filter(obj => obj.specSnap.indexOf(isSkuidname) == 0); filteredJson = this.querySpecList.filter(obj => obj.specSnap.indexOf(isSkuidname) == 0);
// 上下架初始化处理
for (let i = 0; i < filteredJson.length; i++) { for (let i = 0; i < filteredJson.length; i++) {
if (filteredJson[i].isGrounding) { if (filteredJson[i].isGrounding) {
this.specifications.tagSnap[0].children[o].isGrounding = true this.specifications.tagSnap[0].children[o].isGrounding = true;
break; // 终止循环
}
}
// 售罄状态初始化
for (let i = 0; i < filteredJson.length; i++) {
if (filteredJson[i].isPauseSale == 0) {
this.specifications.tagSnap[0].children[o].isPauseSale = 0;
break; // 终止循环 break; // 终止循环
} }
} }
@@ -796,12 +867,7 @@
} }
this.skuBtnText = `您还没选择${this.specifications.tagSnap[0].name}` this.skuBtnText = `您还没选择${this.specifications.tagSnap[0].name}`
this.hodgepodge(this.specifications, 2) //获取skuid /2查找价格和数量
// this.specifications.tagSnap.forEach((val, index, arr) => { //初始化skuidname的数据 选择第一个
// console.log(val)
// this.skuidname.push(val.children[0].info)
// })
this.hodgepodge(this.specifications.tagSnap[0], 2) //获取skuid /2查找价格和数量
} }
} catch (e) { } catch (e) {
@@ -817,23 +883,28 @@
* @param {Object} item * @param {Object} item
*/ */
async morloe(e, index, index1, item) { async morloe(e, index, index1, item) {
if (!e.isGrounding) { if (!e.isGrounding || !e.disabled || e.isPauseSale == 1) {
return; return;
} }
let querySpecList = []; let querySpecList = [];
this.skuBtnText = "添加到购物车"; this.skuBtnText = "添加到购物车";
this.isSpec = true; this.isSpec = true;
// 设置当前选中下标
if (this.specifications.tagSnap[index].start != index1) { if (this.specifications.tagSnap[index].start != index1) {
this.$set(this.specifications.tagSnap[index], 'start', index1) this.$set(this.specifications.tagSnap[index], 'start', index1)
} else { } else {
this.$set(this.specifications.tagSnap[index], 'start', -1) this.$set(this.specifications.tagSnap[index], 'start', -1)
index = index - 1;
} }
this.skuidname = []; this.skuidname = [];
this.specifications.tagSnap.forEach((val, i, arr) => { //初始化skuidname的数据 选择第一个 // 选择规格下面的其他规格可点击状态重置
this.specifications.tagSnap.forEach((val, i, arr) => {
if (i > index) { if (i > index) {
val.children.forEach((v1, e1) => { val.children.forEach((v1, e1) => {
v1.isGrounding = false; v1.isGrounding = i == (index+1) ? false : true;
v1.isPauseSale = i == (index+1) ? 1 : 0;
v1.disabled = i == (index+1) ? true : false;
}) })
val.start = -1; val.start = -1;
} }
@@ -841,8 +912,8 @@
this.skuidname.push(val.children[val.start].name) this.skuidname.push(val.children[val.start].name)
} }
}) })
// this.skuidname.splice(index, 1, e.info); //替换skuidname的数据
// 获取下一个没有选中的分类
for (let i = 0; i < this.specifications.tagSnap.length; i++) { for (let i = 0; i < this.specifications.tagSnap.length; i++) {
if (this.specifications.tagSnap[i].start < 0) { if (this.specifications.tagSnap[i].start < 0) {
this.isSpec = false; this.isSpec = false;
@@ -851,7 +922,6 @@
} }
} }
let filteredJson; let filteredJson;
let isSkuidname = []; let isSkuidname = [];
//提前下一列规格循环,查看是否有下架规格 //提前下一列规格循环,查看是否有下架规格
@@ -859,11 +929,18 @@
for (let o = 0; o < this.specifications.tagSnap[index + 1].children.length; o++) { for (let o = 0; o < this.specifications.tagSnap[index + 1].children.length; o++) {
isSkuidname = JSON.parse(JSON.stringify(this.skuidname)); isSkuidname = JSON.parse(JSON.stringify(this.skuidname));
isSkuidname.push(this.specifications.tagSnap[index + 1].children[o].name) isSkuidname.push(this.specifications.tagSnap[index + 1].children[o].name)
//筛选符合条件的规格列表 // 上下架状态处理
filteredJson = this.querySpecList.filter(obj => obj.specSnap.indexOf(isSkuidname) == 0); filteredJson = this.querySpecList.filter(obj => obj.specSnap.indexOf(isSkuidname) == 0);
for (let i = 0; i < filteredJson.length; i++) { for (let i = 0; i < filteredJson.length; i++) {
if (filteredJson[i].isGrounding) { if (filteredJson[i].isGrounding) {
this.specifications.tagSnap[index + 1].children[o].isGrounding = true this.specifications.tagSnap[index + 1].children[o].isGrounding = true;
break; // 终止循环
}
}
// 售罄状态处理
for (let i = 0; i < filteredJson.length; i++) {
if (filteredJson[i].isPauseSale == 0) {
this.specifications.tagSnap[index + 1].children[o].isPauseSale = 0;
break; // 终止循环 break; // 终止循环
} }
} }
@@ -871,13 +948,8 @@
} }
} }
// res.data.forEach((v,e)=>{
// // this.$set(this.specifications.tagSnap[e], 'children', v.value)
// })
this.$forceUpdate(); this.$forceUpdate();
this.hodgepodge(item, 2) this.hodgepodge(this.specifications, 2)
}, },
/** /**
@@ -894,6 +966,7 @@
code: uni.cache.get('tableCode'), code: uni.cache.get('tableCode'),
shopId: uni.cache.get('shopUser'), shopId: uni.cache.get('shopUser'),
productId: item.id, //商品id productId: item.id, //商品id
isVip: item.isVip, //商品id
spec_tag: this.skuidname.join(","), spec_tag: this.skuidname.join(","),
}) })
this.salePrice = res.data.salePrice // 价格 this.salePrice = res.data.salePrice // 价格
@@ -904,6 +977,7 @@
"num": num, //数量 "num": num, //数量
"type": c == '+' ? 1 : 0, "type": c == '+' ? 1 : 0,
"productId": item.id, //商品id "productId": item.id, //商品id
"isVip": item.isVip,
"shopId": uni.cache.get('shopUser'), "shopId": uni.cache.get('shopUser'),
"userId": uni.cache.get('userInfo').id, "userId": uni.cache.get('userInfo').id,
"tableId": uni.cache.get('tableCode'), "tableId": uni.cache.get('tableCode'),
@@ -1472,14 +1546,41 @@
border-radius: 8rpx; border-radius: 8rpx;
font-size: 24upx; font-size: 24upx;
margin-left: 56rpx; margin-left: 56rpx;
background: #F5F5F5; background: #EFEFEF;
border: 2rpx solid #F5F5F5; border: 2rpx solid #EFEFEF;
position: relative;
color: #666666;
.shop_sku_box_item_tip{
width: 62rpx;
height: 47rpx;
// background-color: #CECECE;
text-align: right;
position: absolute;
top: 0;
right: 0;
background: linear-gradient(45deg, transparent, transparent 50%, #CECECE 50%, #CECECE 100%);
view{
font-size: 18rpx;
color: #666666;
transform: rotate(45deg);
position: absolute;
top: 5rpx;
right: 3rpx;
}
}
} }
.shop_sku_box_item:nth-child(1) { .shop_sku_box_item:nth-child(1) {
margin-left: 0; margin-left: 0;
} }
.disabled{
color: #999;
background-color: #F5F5F5;
border: 2rpx solid #F5F5F5;
}
.shop_sku_box_item_noselected { .shop_sku_box_item_noselected {
color: #666; color: #666;
} }

View File

@@ -144,7 +144,7 @@
</view> </view>
<text class="num" v-if="item.number">{{ item.number }}</text> <text class="num" v-if="item.number">{{ item.number }}</text>
<view class="btn"> <view class="btn">
<u-icon name="plus-circle-fill" color="#E9AB7A" size="50"></u-icon> <u-icon name="plus-circle-fill" :color="item.isVip == 1 ? '#CECECE' : '#E9AB7A'" size="50"></u-icon>
<view class="btnClick" @click="cartListadd(item,'+')"></view> <view class="btnClick" @click="cartListadd(item,'+')"></view>
</view> </view>
</view> </view>
@@ -180,9 +180,17 @@
</view> </view>
<view class="flex-start"> <view class="flex-start">
<view class="shop_sku_box_item" v-for="(item1,index1) in item.children" :key="index1" <view class="shop_sku_box_item" v-for="(item1,index1) in item.children" :key="index1"
@click="morloe(item1,index,index1,item)" :style="{color:!item1.isGrounding?'#999':''}" @click="morloe(item1,index,index1,item)"
:class=" item.start == index1 ?'shop_sku_box_item_selected':''"> :class="{'shop_sku_box_item_selected': item.start == index1, 'disabled': !item1.disabled || !item1.isGrounding || item1.isPauseSale==1}"
>
{{item1.name}} {{item1.name}}
<view class="shop_sku_box_item_tip" v-if="item1.isGrounding == false">
<view>下架</view>
</view>
<view class="shop_sku_box_item_tip" v-if="item1.isPauseSale == 1 && item1.isGrounding == true">
<view>售罄</view>
</view>
<!-- disabled -->
</view> </view>
</view> </view>
</view> </view>
@@ -271,13 +279,9 @@
HeighT() { //手机类型的尺寸 导航栏高度 HeighT() { //手机类型的尺寸 导航栏高度
return this.$store.getters.is_BarHeight return this.$store.getters.is_BarHeight
}, },
scrollHeight() {
return this.$store.getters.is_BarHeight.info.windowHeight - (this.$store.getters.is_BarHeight.heightBar +
this.$store.getters.is_BarHeight.customBar)
}
}, },
onLoad(e) { onLoad(e) {
console.log(e)
}, },
onUnload() { onUnload() {
@@ -340,14 +344,34 @@
} }
}, },
/**
* 获取商品数据
*/
async productqueryProduct() {
let res = await this.api.productqueryProduct({
"shopId": uni.cache.get('shopUser'),
"productGroupId": ''
})
if (res.code == 0) {
this.shopProductList = res.data;
if (this.cartLists && this.cartLists.data && this.cartLists.data.length >= 0) {
this.setNumber()
}
}
},
/** /**
* 图片加载 * 图片加载
*/ */
imageLoaded(item, index) { imageLoaded(item, index) {
this.searchList[index]['imgLoad'] = true; this.searchList[index]['imgLoad'] = true;
}, },
/**
* 搜索内容
* @param {Object} val
*/
searchVal (val) { searchVal (val) {
this.searchList = []; this.searchList = [];
if ( val == "") { if ( val == "") {
@@ -373,6 +397,13 @@
if (b == '单规格') { //没有规格为空 if (b == '单规格') { //没有规格为空
this.skuidname = [] this.skuidname = []
} }
if ( a == "+" && item.isVip == 1 && item.cartNumber >= item.limitNumber){
uni.showToast({
title: '当前商品已达到最大赠送数量',
icon: 'none'
})
return;
}
let cartNumber = a == '+' ? item.cartNumber + 1 : item.cartNumber - 1; let cartNumber = a == '+' ? item.cartNumber + 1 : item.cartNumber - 1;
this.hodgepodge(item, 1, a, cartNumber) //获取skuid /1添加购物车 this.hodgepodge(item, 1, a, cartNumber) //获取skuid /1添加购物车
}, },
@@ -387,7 +418,13 @@
*/ */
shopAdd(item, a) { shopAdd(item, a) {
if (a == "+") { if (a == "+") {
if ( item.isVip == 1 && this.amountcartNumber >= item.limitNumber){
uni.showToast({
title: '当前商品已达到最大赠送数量',
icon: 'none'
})
return;
}
if (this.skuNumber < this.skuSuit && this.amountcartNumber < this.skuSuit) { if (this.skuNumber < this.skuSuit && this.amountcartNumber < this.skuSuit) {
this.amountcartNumber = this.amountcartNumber + (this.skuSuit == 0 ? 1 : this.skuSuit); this.amountcartNumber = this.amountcartNumber + (this.skuSuit == 0 ? 1 : this.skuSuit);
} else { } else {
@@ -413,6 +450,13 @@
return; return;
} }
let num = 0; let num = 0;
if ( item.isVip == 1 && item.cartNumber >= item.limitNumber){
uni.showToast({
title: '当前商品已达到最大赠送数量',
icon: 'none'
})
return;
}
if (item.typeEnum == "normal") { if (item.typeEnum == "normal") {
num = item.cartNumber + this.amountcartNumber; num = item.cartNumber + this.amountcartNumber;
} else { } else {
@@ -422,6 +466,7 @@
"skuId": this.skuId, "skuId": this.skuId,
"num": num, //数量 "num": num, //数量
"type": a == '+' ? 1 : 0, "type": a == '+' ? 1 : 0,
"isVip": item.isVip,
"productId": item.id, //商品id "productId": item.id, //商品id
"shopId": uni.cache.get('shopUser'), "shopId": uni.cache.get('shopUser'),
"userId": uni.cache.get('userInfo').id, "userId": uni.cache.get('userInfo').id,
@@ -438,10 +483,14 @@
*/ */
async cartListadd(item, c) { async cartListadd(item, c) {
try { try {
if ( c == "+" && item.isVip == 1){
return;
}
let params = { let params = {
"skuId": item.skuId, "skuId": item.skuId,
"num": c == '+' ? item.number + 1 : item.number - 1, //数量 "num": c == '+' ? item.number + 1 : item.number - 1, //数量
"type": c == '+' ? 1 : 0, "type": c == '+' ? 1 : 0,
"isVip": item.isVip,
"productId": item.productId, //商品id "productId": item.productId, //商品id
"shopId": uni.cache.get('shopUser'), "shopId": uni.cache.get('shopUser'),
"userId": uni.cache.get('userInfo').id, "userId": uni.cache.get('userInfo').id,
@@ -483,7 +532,7 @@
setNumber() { setNumber() {
// 处理购物车相同id的情况下 数量相加 // 处理购物车相同id的情况下 数量相加
var summedArray = this.cartLists.data.reduce((acc, current) => { var summedArray = this.cartLists.data.reduce((acc, current) => {
const existing = acc.find(item => item.productId === current.productId); const existing = acc.find(item => item.productId === current.productId && item.isVip === current.isVip);
if (existing) { if (existing) {
existing.number += current.number; existing.number += current.number;
} else { } else {
@@ -498,7 +547,7 @@
return item.products.filter(e => { return item.products.filter(e => {
e.cartNumber = 0; e.cartNumber = 0;
return summedArray.find(i => { return summedArray.find(i => {
if (e.id == i.productId) { if (e.id == i.productId && e.isVip == i.isVip) {
e.cartNumber = i.number e.cartNumber = i.number
} }
}) })
@@ -523,6 +572,7 @@
this.cartLists_count = 0; this.cartLists_count = 0;
} }
}, },
/** /**
* 多规格选择 * 多规格选择
* @param {Object} item1 * @param {Object} item1
@@ -530,6 +580,7 @@
* @param {Object} index1 * @param {Object} index1
*/ */
async clickspecifications(item1, index1, type) { async clickspecifications(item1, index1, type) {
console.log(item1)
if ( item1.isPauseSale != 0 || item1.isSale == 0) { if ( item1.isPauseSale != 0 || item1.isSale == 0) {
return; return;
} }
@@ -544,13 +595,16 @@
this.hodgepodge(this.specifications, 2) //获取skuid /2查找价格和数量 this.hodgepodge(this.specifications, 2) //获取skuid /2查找价格和数量
this.skuBtnText = `添加到购物车` this.skuBtnText = `添加到购物车`
} else { } else {
console.log(3)
// 多规格数据处理 // 多规格数据处理
this.isSpec = false; this.isSpec = false;
let obj = await this.api.productquerySpec({ let obj = await this.api.productquerySpec({
productId: item1.id, //商品id productId: item1.id, //商品id
}) })
console.log(2)
this.querySpecList = obj.data; this.querySpecList = obj.data;
this.specifications.tagSnap = JSON.parse(item1.productSkuResult.tagSnap).map((item) => { console.log(1)
this.specifications.tagSnap = JSON.parse(item1.productSkuResult.tagSnap).map((item,index) => {
let res = { let res = {
id: item1.id, //商品id id: item1.id, //商品id
name: item.name, name: item.name,
@@ -560,12 +614,13 @@
item.value.split(",").forEach((v, e) => { item.value.split(",").forEach((v, e) => {
res.children.push({ res.children.push({
name: v, name: v,
isGrounding: false disabled: index == 0 ? true : false,
isGrounding: index == 0 ? false : true,
isPauseSale: index == 0 ? 1 : 0,
}) })
}) })
return res return res
}) })
//初始化第一列规格可编辑 //初始化第一列规格可编辑
let filteredJson; let filteredJson;
let isSkuidname = []; let isSkuidname = [];
@@ -574,18 +629,26 @@
isSkuidname.push(this.specifications.tagSnap[0].children[o].name) isSkuidname.push(this.specifications.tagSnap[0].children[o].name)
//筛选符合条件的规格列表 //筛选符合条件的规格列表
filteredJson = this.querySpecList.filter(obj => obj.specSnap.indexOf(isSkuidname) == 0); filteredJson = this.querySpecList.filter(obj => obj.specSnap.indexOf(isSkuidname) == 0);
// 上下架初始化处理
for (let i = 0; i < filteredJson.length; i++) { for (let i = 0; i < filteredJson.length; i++) {
if (filteredJson[i].isGrounding) { if (filteredJson[i].isGrounding) {
this.specifications.tagSnap[0].children[o].isGrounding = true this.specifications.tagSnap[0].children[o].isGrounding = true;
break; // 终止循环
}
}
// 售罄状态初始化
for (let i = 0; i < filteredJson.length; i++) {
if (filteredJson[i].isPauseSale == 0) {
this.specifications.tagSnap[0].children[o].isPauseSale = 0;
break; // 终止循环 break; // 终止循环
} }
} }
} }
console.log(1)
this.skuBtnText = `您还没选择${this.specifications.tagSnap[0].name}` this.skuBtnText = `您还没选择${this.specifications.tagSnap[0].name}`
console.log(this.specifications)
this.hodgepodge(this.specifications.tagSnap[0], 2) //获取skuid /2查找价格和数量 this.hodgepodge(this.specifications, 2) //获取skuid /2查找价格和数量
} }
} catch (e) { } catch (e) {
@@ -601,23 +664,29 @@
* @param {Object} item * @param {Object} item
*/ */
async morloe(e, index, index1, item) { async morloe(e, index, index1, item) {
if (!e.isGrounding) {
if (!e.isGrounding || !e.disabled || e.isPauseSale == 1) {
return; return;
} }
let querySpecList = []; let querySpecList = [];
this.skuBtnText = "添加到购物车"; this.skuBtnText = "添加到购物车";
this.isSpec = true; this.isSpec = true;
// 设置当前选中下标
if (this.specifications.tagSnap[index].start != index1) { if (this.specifications.tagSnap[index].start != index1) {
this.$set(this.specifications.tagSnap[index], 'start', index1) this.$set(this.specifications.tagSnap[index], 'start', index1)
} else { } else {
this.$set(this.specifications.tagSnap[index], 'start', -1) this.$set(this.specifications.tagSnap[index], 'start', -1)
index = index - 1;
} }
this.skuidname = []; this.skuidname = [];
this.specifications.tagSnap.forEach((val, i, arr) => { //初始化skuidname的数据 选择第一个 // 选择规格下面的其他规格可点击状态重置
this.specifications.tagSnap.forEach((val, i, arr) => {
if (i > index) { if (i > index) {
val.children.forEach((v1, e1) => { val.children.forEach((v1, e1) => {
v1.isGrounding = false; v1.isGrounding = i == (index+1) ? false : true;
v1.isPauseSale = i == (index+1) ? 1 : 0;
v1.disabled = i == (index+1) ? true : false;
}) })
val.start = -1; val.start = -1;
} }
@@ -625,8 +694,8 @@
this.skuidname.push(val.children[val.start].name) this.skuidname.push(val.children[val.start].name)
} }
}) })
// this.skuidname.splice(index, 1, e.info); //替换skuidname的数据
// 获取下一个没有选中的分类
for (let i = 0; i < this.specifications.tagSnap.length; i++) { for (let i = 0; i < this.specifications.tagSnap.length; i++) {
if (this.specifications.tagSnap[i].start < 0) { if (this.specifications.tagSnap[i].start < 0) {
this.isSpec = false; this.isSpec = false;
@@ -634,8 +703,7 @@
break; // 终止循环 break; // 终止循环
} }
} }
let filteredJson; let filteredJson;
let isSkuidname = []; let isSkuidname = [];
//提前下一列规格循环,查看是否有下架规格 //提前下一列规格循环,查看是否有下架规格
@@ -643,15 +711,22 @@
for (let o = 0; o < this.specifications.tagSnap[index + 1].children.length; o++) { for (let o = 0; o < this.specifications.tagSnap[index + 1].children.length; o++) {
isSkuidname = JSON.parse(JSON.stringify(this.skuidname)); isSkuidname = JSON.parse(JSON.stringify(this.skuidname));
isSkuidname.push(this.specifications.tagSnap[index + 1].children[o].name) isSkuidname.push(this.specifications.tagSnap[index + 1].children[o].name)
//筛选符合条件的规格列表 // 上下架状态处理
filteredJson = this.querySpecList.filter(obj => obj.specSnap.indexOf(isSkuidname) == 0); filteredJson = this.querySpecList.filter(obj => obj.specSnap.indexOf(isSkuidname) == 0);
for (let i = 0; i < filteredJson.length; i++) { for (let i = 0; i < filteredJson.length; i++) {
if (filteredJson[i].isGrounding) { if (filteredJson[i].isGrounding) {
this.specifications.tagSnap[index + 1].children[o].isGrounding = true this.specifications.tagSnap[index + 1].children[o].isGrounding = true;
break; // 终止循环 break; // 终止循环
} }
} }
// 售罄状态处理
for (let i = 0; i < filteredJson.length; i++) {
if (filteredJson[i].isPauseSale == 0) {
this.specifications.tagSnap[index + 1].children[o].isPauseSale = 0;
break; // 终止循环
}
}
} }
} }
@@ -668,13 +743,15 @@
*/ */
async hodgepodge(item, a, c, num) { //此接口去获取商品id !!!赋值库存 数量 价格等 async hodgepodge(item, a, c, num) { //此接口去获取商品id !!!赋值库存 数量 价格等
try { try {
// console.log(this.skuidname.join(",")) console.log(this.skuidname.join(","))
let res = await this.api.productqueryProductSku({ let res = await this.api.productqueryProductSku({
code: uni.cache.get('tableCode'), code: uni.cache.get('tableCode'),
shopId: uni.cache.get('shopUser'), shopId: uni.cache.get('shopUser'),
productId: item.id, //商品id productId: item.id, //商品id
isVip: item.isVip, //商品id
spec_tag: this.skuidname.join(","), spec_tag: this.skuidname.join(","),
}) })
console.log(res)
this.salePrice = res.data.salePrice // 价格 this.salePrice = res.data.salePrice // 价格
let data = null; let data = null;
if (a == 1) { //1添加购物车 2是websocket返回这个商品的价格(应为不同的多规格商品返回不同的价格) if (a == 1) { //1添加购物车 2是websocket返回这个商品的价格(应为不同的多规格商品返回不同的价格)
@@ -683,6 +760,7 @@
"num": num, //数量 "num": num, //数量
"type": c == '+' ? 1 : 0, "type": c == '+' ? 1 : 0,
"productId": item.id, //商品id "productId": item.id, //商品id
"isVip": item.isVip,
"shopId": uni.cache.get('shopUser'), "shopId": uni.cache.get('shopUser'),
"userId": uni.cache.get('userInfo').id, "userId": uni.cache.get('userInfo').id,
"tableId": uni.cache.get('tableCode'), "tableId": uni.cache.get('tableCode'),
@@ -788,21 +866,7 @@
} }
}, },
/**
* 获取商品数据
*/
async productqueryProduct() {
let res = await this.api.productqueryProduct({
"shopId": uni.cache.get('shopUser'),
"productGroupId": ''
})
if (res.code == 0) {
this.shopProductList = res.data;
if (this.cartLists && this.cartLists.data && this.cartLists.data.length >= 0) {
this.setNumber()
}
}
},
} }
} }
@@ -1080,14 +1144,38 @@
border-radius: 8rpx; border-radius: 8rpx;
font-size: 24upx; font-size: 24upx;
margin-left: 56rpx; margin-left: 56rpx;
background: #F5F5F5; background: #EFEFEF;
border: 2rpx solid #F5F5F5; border: 2rpx solid #EFEFEF;
position: relative;
color: #666666;
.shop_sku_box_item_tip{
width: 62rpx;
height: 47rpx;
// background-color: #CECECE;
text-align: right;
position: absolute;
top: 0;
right: 0;
background: linear-gradient(45deg, transparent, transparent 50%, #CECECE 50%, #CECECE 100%);
view{
font-size: 18rpx;
color: #666666;
transform: rotate(45deg);
position: absolute;
top: 5rpx;
right: 3rpx;
}
}
} }
.shop_sku_box_item:nth-child(1) { .shop_sku_box_item:nth-child(1) {
margin-left: 0; margin-left: 0;
} }
.disabled{
color: #999;
background-color: #F5F5F5;
border: 2rpx solid #F5F5F5;
}
.shop_sku_box_item_noselected { .shop_sku_box_item_noselected {
color: #666; color: #666;
} }

View File

@@ -51,6 +51,8 @@
<!-- <picker :show="calendarShow" mode="date"></picker> --> <!-- <picker :show="calendarShow" mode="date"></picker> -->
<u-datetime-picker <u-datetime-picker
mode="date" mode="date"
itemHeight="66"
visibleItemCount="5"
@cancel="calendarShow = false" @cancel="calendarShow = false"
:show="calendarShow" :show="calendarShow"
:minDate="-2208988800000" :minDate="-2208988800000"

View File

@@ -1,7 +1,7 @@
<template> <template>
<view class="container"> <view class="container">
<image class="topBack" :src="'https://czg-qr-order.oss-cn-beijing.aliyuncs.com/my/myTopBack.png'" mode="aspectFill"></image> <image class="topBack" :src="shopExtend?shopExtend.value:'https://czg-qr-order.oss-cn-beijing.aliyuncs.com/my/myTopBack.png'" mode="aspectFill"></image>
<view class="myContent"> <view class="myContent">
<view class="my_info flex-between"> <view class="my_info flex-between">
<view class="my_info_left"> <view class="my_info_left">
@@ -70,6 +70,7 @@
// { name: "关于", type: "", icon: "https://czg-qr-order.oss-cn-beijing.aliyuncs.com/my/inRegard.png"}, // { name: "关于", type: "", icon: "https://czg-qr-order.oss-cn-beijing.aliyuncs.com/my/inRegard.png"},
], ],
shopInfo: {}, shopInfo: {},
shopExtend: null,
}; };
}, },
onLoad() {}, onLoad() {},
@@ -87,6 +88,7 @@
this.loginwxuserInfo() this.loginwxuserInfo()
if (uni.cache.get('shopUser') ) { if (uni.cache.get('shopUser') ) {
this.getShopInfo(); this.getShopInfo();
this.getShopExtend();
} else{ } else{
} }
@@ -94,7 +96,21 @@
methods: { methods: {
// 下面初始数据 // 下面初始数据
init_fn() { init_fn() {
},
/**
* 获取背景图
*/
async getShopExtend () {
let res = await this.api.getShopExtend({
shopId: uni.cache.get('shopUser'),
autokey: "my_bg" //index_bg my_bg member_bg shopInfo_bg
})
if ( res.code == 0) {
this.shopExtend = res.data;
}
}, },
/** /**

View File

@@ -82,8 +82,8 @@ const store = new Vuex.Store({
let curPage = pages[pages.length -1 ] let curPage = pages[pages.length -1 ]
curPage.onLoad(curPage.options) curPage.onLoad(curPage.options)
curPage.onShow() curPage.onShow()
// curPage.mounted()
curPage.onReady() curPage.onReady()
this.$isResolve()
} }
}, },
fail: (err) => {} fail: (err) => {}