1、修改密码手机号未拿到处理
2、首页/商品列表增加了广告弹窗 3、会员充值新增赠送菜品, 4、会员菜品增加最大添加数量限制 5、首页/我的/会员卡/菜品页面的图片设置 6、小程序余额支付,会员卡充值成功后增加 会员余额变动订阅(后端还未做处理,目前可以订阅不会推送) 7、多规格商品部分规格售罄/下架增加角标提示
This commit is contained in:
@@ -8,6 +8,9 @@ export default {
|
||||
loginapplogin(data) { //APP登录(登录即注册)
|
||||
return uni.api.post("/login/app/login", data);
|
||||
},
|
||||
getShopExtend(data) { //获取图片 通过shopId和autokey
|
||||
return uni.api.post("/common/shopExtend", data,false);
|
||||
},
|
||||
productqueryShop(data) { //通过桌码获取店铺信息
|
||||
return uni.api.get("/product/queryShop", data);
|
||||
},
|
||||
@@ -90,6 +93,15 @@ export default {
|
||||
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) {
|
||||
return uni.api.get("/user/userCoupon", data);
|
||||
|
||||
252
components/popupad.vue
Normal file
252
components/popupad.vue
Normal 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>
|
||||
@@ -16,11 +16,11 @@ const baseUrlwws = 'ws://cashier.sxczgkj.cn/cashierService'
|
||||
// #endif
|
||||
|
||||
// #ifdef APP || MP-WEIXIN
|
||||
const baseUrl = debug ? proxyApi : 'https://cashier.sxczgkj.cn/cashierService' // 线上
|
||||
const baseUrlwws = debug ? proxyApiwws : 'wss://cashier.sxczgkj.cn/netty' // 线上
|
||||
// const baseUrl = debug ? proxyApi : 'https://cashier.sxczgkj.cn/cashierService' // 线上
|
||||
// const baseUrlwws = debug ? proxyApiwws : 'wss://cashier.sxczgkj.cn/netty' // 线上
|
||||
|
||||
// const baseUrl = 'https://cashier.sxczgkj.cn/cashierService' // 线上
|
||||
// const baseUrlwws = 'wss://cashier.sxczgkj.cn/netty' // 线上/
|
||||
const baseUrl = 'https://cashier.sxczgkj.cn/cashierService' // 线上
|
||||
const baseUrlwws = 'wss://cashier.sxczgkj.cn/netty' // 线上/
|
||||
// #endif
|
||||
|
||||
// import VConsole from "./vConsole.js"
|
||||
|
||||
7
package-lock.json
generated
7
package-lock.json
generated
@@ -5,6 +5,7 @@
|
||||
"packages": {
|
||||
"": {
|
||||
"dependencies": {
|
||||
"dayjs": "^1.11.12",
|
||||
"lodash": "^4.17.21"
|
||||
},
|
||||
"devDependencies": {
|
||||
@@ -527,6 +528,12 @@
|
||||
"license": "MIT",
|
||||
"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": {
|
||||
"version": "1.5.4",
|
||||
"resolved": "https://registry.npmmirror.com/electron-to-chromium/-/electron-to-chromium-1.5.4.tgz",
|
||||
|
||||
@@ -4,6 +4,7 @@
|
||||
"sass-loader": "^13.3.2"
|
||||
},
|
||||
"dependencies": {
|
||||
"dayjs": "^1.11.12",
|
||||
"lodash": "^4.17.21"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -226,11 +226,15 @@
|
||||
|
||||
|
||||
</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>
|
||||
</template>
|
||||
<script>
|
||||
import swipers from './components/swiper.vue'
|
||||
import popupad from '@/components/popupad.vue'
|
||||
import diamond from './components/diamond.vue'
|
||||
import todaylist from './components/todaylist.vue'
|
||||
import productlist from './components/productlist.vue'
|
||||
@@ -247,7 +251,8 @@
|
||||
advertisement,
|
||||
category,
|
||||
customSwiper,
|
||||
indexs
|
||||
indexs,
|
||||
popupad
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
@@ -291,7 +296,10 @@
|
||||
categoryList: [],
|
||||
subCategoryList: [], //二级菜单数据
|
||||
// 登录后店铺信息
|
||||
usershopUserinfo:{}
|
||||
usershopUserinfo:{},
|
||||
popupadList: [], //广告数据
|
||||
forceUpdate: false,
|
||||
shopExtend: null,
|
||||
};
|
||||
},
|
||||
|
||||
@@ -310,7 +318,6 @@
|
||||
},
|
||||
onHide() {
|
||||
this.timersetInterval = '1'
|
||||
|
||||
},
|
||||
computed: {
|
||||
HeighT() { //手机类型的尺寸
|
||||
@@ -331,6 +338,7 @@
|
||||
},
|
||||
async onShow() {
|
||||
// 判断显示那个页面
|
||||
|
||||
if (uni.cache.get('shopUser') && uni.cache.get('token')) {
|
||||
this.showindex = false
|
||||
uni.cache.set('types', 'index');
|
||||
@@ -340,8 +348,15 @@
|
||||
})
|
||||
if (res.code == 0) {
|
||||
this.usershopUserinfo = res.data
|
||||
uni.cache.set('shopUserInfo',this.usershopUserinfo)
|
||||
}
|
||||
this.loginwxuserInfo() //个人信息接口
|
||||
if ( !uni.cache.get('forceUpdate') ) {
|
||||
this.forceUpdate = !this.forceUpdate;
|
||||
}
|
||||
uni.cache.set('forceUpdate',false)
|
||||
this.getShopExtend()
|
||||
this.timersetInterval = '0'
|
||||
} else {
|
||||
uni.getLocation({
|
||||
type: 'wgs84',
|
||||
@@ -393,6 +408,19 @@
|
||||
}
|
||||
},
|
||||
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() {
|
||||
let res = await this.api.loginwxuserInfo({
|
||||
@@ -403,6 +431,7 @@
|
||||
this.userInfo = uni.cache.get('userInfo')
|
||||
}
|
||||
},
|
||||
|
||||
closeproductlist() {
|
||||
this.showproductlist = false
|
||||
// console.log('close');
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<template>
|
||||
<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="contentboxitemleft flex-colum" @click="scanCodehandle(0)">
|
||||
<image src="https://czg-qr-order.oss-cn-beijing.aliyuncs.com/indexs/Xdiancan.png" mode="aspectFill">
|
||||
@@ -52,6 +52,12 @@
|
||||
return {}
|
||||
}
|
||||
},
|
||||
shopExtend: {
|
||||
type: Object,
|
||||
default () {
|
||||
return {}
|
||||
}
|
||||
},
|
||||
},
|
||||
methods: {
|
||||
scanCodehandle(i) {
|
||||
@@ -62,7 +68,10 @@
|
||||
let tableCode = this.getQueryString(decodeURIComponent(res.result), 'code')
|
||||
uni.cache.set('tableCode', 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;
|
||||
width: 100%;
|
||||
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;
|
||||
|
||||
.contentboxitem {
|
||||
|
||||
@@ -57,8 +57,9 @@
|
||||
}
|
||||
},
|
||||
onLoad(e) {
|
||||
this.info = e
|
||||
this.form.memberId = e.memberId
|
||||
console.log(JSON.parse(e.shopUserInfo))
|
||||
this.info = JSON.parse(e.shopUserInfo)
|
||||
this.form.memberId = this.info.id;
|
||||
this.getlist()
|
||||
},
|
||||
onReachBottom() {
|
||||
@@ -73,20 +74,19 @@
|
||||
async getlist() {
|
||||
if (this.active == 1) {
|
||||
let res = await this.api.queryMemberAccount(this.form)
|
||||
if (res.code == 0) {
|
||||
if (this.form.page == 1) {
|
||||
this.list = res.data.list
|
||||
} else {
|
||||
this.form.page++
|
||||
this.list.push(res.data.list)
|
||||
}
|
||||
if (res.code == 0 && res.data.list.length > 0) {
|
||||
console.log(this.list.length)
|
||||
this.list = this.list.concat(res.data.list)
|
||||
this.form.page++
|
||||
console.log(this.list)
|
||||
}
|
||||
} else {
|
||||
this.list = []
|
||||
}
|
||||
},
|
||||
clickEvent(i) {
|
||||
this.active = i
|
||||
this.active = i;
|
||||
this.form.page = 1;
|
||||
this.getlist()
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
<!-- 店铺详情 -->
|
||||
<u-popup :show="show" :round="20" overlayOpacity="0.8" mode="bottom" @close="showClose" height="500">
|
||||
<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-content">
|
||||
<view class="reg-head">
|
||||
@@ -16,9 +16,9 @@
|
||||
<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"/>
|
||||
</view>
|
||||
<view class="reg-cell">
|
||||
<view class="reg-cell" @click="calendarShow = true">
|
||||
<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-picker :show="calendarShow" ref="uPicker" :columns="columns" @confirm="confirm" @change="changeHandler"></u-picker> -->
|
||||
<!-- <picker :show="calendarShow" mode="date"></picker> -->
|
||||
@@ -28,6 +28,8 @@
|
||||
:show="calendarShow"
|
||||
:minDate="-2208988800000"
|
||||
v-model="value1"
|
||||
itemHeight="66"
|
||||
visibleItemCount="5"
|
||||
@confirm="confirmTime"
|
||||
></u-datetime-picker>
|
||||
<u-icon name="arrow-down-fill" color="#000" size="23"></u-icon>
|
||||
@@ -41,11 +43,11 @@
|
||||
</view>
|
||||
<view class="agreement">
|
||||
<view class="agreement_tip">我已阅读并同意以下内容</view>
|
||||
<view class="agreement_item">
|
||||
<u-checkbox-group>
|
||||
<u-checkbox shape="circle" activeColor="#E3AD7F" @change="radioChange" size="30"></u-checkbox>
|
||||
<view class="agreement_item" @click="isProtocol = !isProtocol">
|
||||
<u-checkbox-group >
|
||||
<u-checkbox :checked="isProtocol" shape="circle" activeColor="#E3AD7F" @change="radioChange" size="35" iconSize="20"></u-checkbox>
|
||||
</u-checkbox-group>
|
||||
<text @click="viewProtocol(1)" class="agreement_item_text">用户协议/隐私条款</text>
|
||||
<text @click.stop="viewProtocol(1)" class="agreement_item_text">用户协议/隐私条款</text>
|
||||
</view>
|
||||
<!-- <view class="agreement_item">
|
||||
<u-checkbox-group>
|
||||
@@ -62,7 +64,7 @@
|
||||
|
||||
<script>
|
||||
export default {
|
||||
props: ['userInfo','show',"shopId"],
|
||||
props: ['show',"shopId"],
|
||||
data() {
|
||||
return {
|
||||
value1: Number(new Date()),
|
||||
@@ -73,18 +75,33 @@
|
||||
telephone: "",
|
||||
birthDay: "",
|
||||
isProtocol: false,
|
||||
shopUserInfo: null,
|
||||
}
|
||||
},
|
||||
mounted() {
|
||||
this.userInfo = uni.cache.get('userInfo')
|
||||
this.userId = this.userInfo.id;
|
||||
this.userHeadImg = this.userInfo.headImg;
|
||||
this.nickName = this.userInfo.nickName && this.userInfo.nickName != '微信用户' ? this.userInfo.nickName : '';
|
||||
this.telephone = this.userInfo.telephone;
|
||||
this.birthDay = this.userInfo.birthDay
|
||||
console.log(this.userInfo, '调试1113');
|
||||
console.log(13)
|
||||
this.init()
|
||||
// console.log(this.userInfo)
|
||||
// this.userId = this.userInfo.id;
|
||||
// console.log(this.userInfo, '调试1113');
|
||||
},
|
||||
|
||||
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 (){
|
||||
console.log(2)
|
||||
uni.navigateBack()
|
||||
@@ -188,7 +205,35 @@
|
||||
* 注册会员
|
||||
*/
|
||||
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 ) {
|
||||
uni.showToast({
|
||||
title: '请勾选协议',
|
||||
@@ -197,7 +242,7 @@
|
||||
return;
|
||||
}
|
||||
let res = await this.api.openMember({
|
||||
id: this.userId,
|
||||
id: uni.cache.get('userInfo').id,
|
||||
shopId: this.shopId,
|
||||
nickName: this.nickName,
|
||||
headImg: this.userHeadImg,
|
||||
@@ -221,6 +266,9 @@
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.u-datetime-picker {
|
||||
height: 300px !important;
|
||||
}
|
||||
.register-member-wrap{
|
||||
padding: 64rpx 24rpx;
|
||||
display: flex;
|
||||
@@ -298,11 +346,11 @@
|
||||
font-weight: 400;
|
||||
font-size: 24rpx;
|
||||
color: #666666;
|
||||
margin-bottom: 32rpx;
|
||||
}
|
||||
.agreement_item{
|
||||
display: flex;
|
||||
margin-bottom: 16rpx;
|
||||
padding-top: 32rpx;
|
||||
padding-bottom: 16rpx;
|
||||
.agreement_item_text{
|
||||
font-weight: 500;
|
||||
font-size: 24rpx;
|
||||
|
||||
@@ -3,16 +3,16 @@
|
||||
|
||||
<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>
|
||||
<view>{{ userInfo.shopName }}</view>
|
||||
<view>{{ shopUserInfo.shopName }}</view>
|
||||
<u-icon name="arrow-right" color="#575B66" size="28"></u-icon>
|
||||
</view>
|
||||
|
||||
<view class="card_info flex-colum">
|
||||
<view class="title">账户余额(元)</view>
|
||||
<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_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>
|
||||
<text class="card_info_con_right_item_text">{{item.name}}</text>
|
||||
</view>
|
||||
@@ -20,9 +20,19 @@
|
||||
</view>
|
||||
|
||||
</view>
|
||||
<!-- <view class="therecontent">
|
||||
<input type="number" v-model="amount" placeholder="自定义金额">
|
||||
</view> -->
|
||||
<view class="customAmount" v-if="shopUserInfo.isUser == 1">
|
||||
<view class="customAmount_left">
|
||||
<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_f" @click="clickinput(item,index)" v-for="(item,index) in listdata" :key="index">
|
||||
<viwe class="rechargeList_item flex-colum " :class="index == inputshow?'active':''">
|
||||
@@ -57,7 +67,7 @@
|
||||
<view class="explain">
|
||||
<view class="explain-top flex-between">
|
||||
<text class="explain-top_title">适用门店</text>
|
||||
<text class="shopName">{{ userInfo.shopName }}</text>
|
||||
<text class="shopName">{{ shopUserInfo.shopName }}</text>
|
||||
</view>
|
||||
<view class="explain_content">
|
||||
<text class="explain_content_title">充值说明</text>
|
||||
@@ -68,20 +78,19 @@
|
||||
</view>
|
||||
|
||||
<view class="rechargeBox">
|
||||
<view class="agreement">
|
||||
<u-checkbox-group>
|
||||
<u-checkbox shape="circle" activeColor="#E3AD7F" @change="radioChange" size="30">
|
||||
<view style="width: 100rpx;height: 100rpx;"></view>
|
||||
<view class="agreement" @click="isProtocol = !isProtocol">
|
||||
<u-checkbox-group >
|
||||
<u-checkbox :checked="isProtocol" shape="circle" activeColor="#E3AD7F" @change="radioChange" size="35" iconSize="20">
|
||||
</u-checkbox>
|
||||
</u-checkbox-group>
|
||||
<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> -->
|
||||
</view>
|
||||
<view class="recharge" @tap="$u.debounce(userbalancerechangesub, 500)">立即充值</view>
|
||||
</view>
|
||||
<registermember :show="memberOpen" :shopId="shopId" :userInfo="userInfo" @getRegisterMember="getRegisterMember"></registermember>
|
||||
<registermember :show="memberOpen" :shopUserInfo="shopUserInfo" :shopId="shopId" @getRegisterMember="getRegisterMember"></registermember>
|
||||
</view>
|
||||
|
||||
</template>
|
||||
@@ -98,8 +107,11 @@
|
||||
memberOpen: false,
|
||||
isProtocol: false,
|
||||
listdata: [],
|
||||
amount: '',
|
||||
amount: 0,
|
||||
minNum: 0,
|
||||
handselNum: 0,
|
||||
userInfo: {},
|
||||
shopUserInfo: null,
|
||||
shopId: '',
|
||||
giftList: [],
|
||||
cardManageList: [
|
||||
@@ -110,7 +122,6 @@
|
||||
}
|
||||
},
|
||||
async onLoad(e) {
|
||||
console.log(e)
|
||||
// if ( e.type == 'list' || e.type == 'index') {
|
||||
// this.shopId = e.shopId;
|
||||
// this.init();
|
||||
@@ -122,10 +133,12 @@
|
||||
// if (!uni.cache.get('token')) {
|
||||
// await this.$onLaunched;
|
||||
// }
|
||||
this.init();
|
||||
this.shopInfo();
|
||||
this.paygetActive()
|
||||
} else{
|
||||
this.shopId = e.shopId;
|
||||
this.init();
|
||||
this.shopInfo();
|
||||
this.paygetActive()
|
||||
}
|
||||
console.log(this.shopId)
|
||||
},
|
||||
@@ -133,20 +146,20 @@
|
||||
/**
|
||||
* 初始化
|
||||
*/
|
||||
async init() {
|
||||
async shopInfo() {
|
||||
|
||||
let res = await this.api.shopUserInfo({
|
||||
"shopId": this.shopId,
|
||||
"userId": uni.cache.get('userInfo').id,
|
||||
})
|
||||
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;
|
||||
return;
|
||||
}
|
||||
this.paygetShopByMember(this.shopId)
|
||||
this.paygetActive()
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
@@ -161,8 +174,10 @@
|
||||
|
||||
try {
|
||||
this.listdata = res.data.list;
|
||||
this.giftList = this.listdata[0].giftList;
|
||||
this.amount = res.data.list[0].minNum
|
||||
this.giftList = this.listdata[0].gives;
|
||||
this.amount = this.listdata[0].minNum;
|
||||
this.minNum = this.listdata[0].minNum;
|
||||
this.handselNum = this.listdata[0].handselNum
|
||||
} catch (e) {
|
||||
//TODO handle the exception
|
||||
}
|
||||
@@ -173,7 +188,9 @@
|
||||
* @param {Object} e
|
||||
*/
|
||||
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) {
|
||||
this.memberOpen = e;
|
||||
this.paygetShopByMember()
|
||||
this.shopInfo();
|
||||
this.paygetActive()
|
||||
},
|
||||
|
||||
@@ -212,11 +229,11 @@
|
||||
openLocation () {
|
||||
console.log('123');
|
||||
uni.openLocation({
|
||||
latitude: Number(this.usershopUserinfo.lat), // 目的地的纬度,浮点数,范围为-90~90
|
||||
longitude: Number(this.usershopUserinfo.lng), // 目的地的经度,浮点数,范围为-180~180
|
||||
latitude: Number(this.shopUserInfo.lat), // 目的地的纬度,浮点数,范围为-90~90
|
||||
longitude: Number(this.shopUserInfo.lng), // 目的地的经度,浮点数,范围为-180~180
|
||||
scale: 18, // 缩放比例,范围5~18
|
||||
name: this.usershopUserinfo.shopName, // 位置名
|
||||
address: this.usershopUserinfo.address, // 地址的详细说明
|
||||
name: this.shopUserInfo.shopName, // 位置名
|
||||
address: this.shopUserInfo.address, // 地址的详细说明
|
||||
success() {
|
||||
console.log('导航启动成功');
|
||||
|
||||
@@ -248,22 +265,6 @@
|
||||
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
|
||||
@@ -272,14 +273,17 @@
|
||||
clickinput(a, b) {
|
||||
console.log(a, b)
|
||||
this.inputshow = b;
|
||||
this.giftList = a.gives;
|
||||
this.amount = a.minNum;
|
||||
this.giftList = a.giftList;
|
||||
this.minNum = a.minNum;
|
||||
this.handselNum = a.handselNum;
|
||||
},
|
||||
|
||||
/**
|
||||
* 充值
|
||||
*/
|
||||
async userbalancerechangesub() {
|
||||
let _this = this;
|
||||
if (!this.isProtocol) {
|
||||
uni.showToast({
|
||||
title: '请勾选协议',
|
||||
@@ -325,15 +329,22 @@
|
||||
})
|
||||
uni.hideLoading()
|
||||
let pages = getCurrentPages()
|
||||
if ( pages.length > 1) {
|
||||
this.paygetShopByMember()
|
||||
} else {
|
||||
setTimeout(res => {
|
||||
uni.switchTab({
|
||||
url: '/pages/index/index'
|
||||
})
|
||||
}, 500)
|
||||
}
|
||||
uni.requestSubscribeMessage({
|
||||
tmplIds:["AV-KybUHaK3KtFVLqpy6PHccHBS7XeX__mOM4RbufnQ"],
|
||||
complete() {
|
||||
if ( pages.length > 1) {
|
||||
_this.shopInfo()
|
||||
} else {
|
||||
setTimeout(res => {
|
||||
uni.switchTab({
|
||||
url: '/pages/index/index'
|
||||
})
|
||||
}, 500)
|
||||
}
|
||||
},
|
||||
})
|
||||
|
||||
|
||||
|
||||
},
|
||||
fail: (res) => {
|
||||
@@ -356,7 +367,7 @@
|
||||
}
|
||||
|
||||
.content {
|
||||
padding: 16rpx 20rpx 0 20rpx;
|
||||
padding: 16rpx 20rpx 245rpx 20rpx;
|
||||
|
||||
.location{
|
||||
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{
|
||||
width: 100%;
|
||||
display: flex;
|
||||
@@ -533,6 +577,7 @@
|
||||
border-radius: 50%;
|
||||
background-color: #F7853D;
|
||||
margin-right: 8rpx;
|
||||
flex-shrink: 0;
|
||||
}
|
||||
.text{
|
||||
font-weight: 400;
|
||||
@@ -549,6 +594,7 @@
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
padding: 22rpx 24rpx;
|
||||
margin-bottom: 30rpx;
|
||||
.explain-top{
|
||||
// align-items: center;
|
||||
margin-bottom: 18rpx;
|
||||
@@ -583,7 +629,7 @@
|
||||
|
||||
.rechargeBox{
|
||||
width: 100%;
|
||||
padding: 16rpx 28rpx 84rpx 28rpx;
|
||||
padding: 0 28rpx 84rpx 28rpx;
|
||||
background-color: #fff;
|
||||
position: fixed;
|
||||
left: 0;
|
||||
@@ -592,7 +638,8 @@
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
margin-bottom: 20rpx;
|
||||
padding-top: 16rpx;
|
||||
padding-bottom: 20rpx;
|
||||
text{
|
||||
font-size: 24rpx;
|
||||
}
|
||||
|
||||
@@ -3,28 +3,29 @@
|
||||
<view class="content">
|
||||
<!-- <card :userInfo="userInfo"></card> -->
|
||||
<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_head">
|
||||
<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>
|
||||
<text class="card_head_left_name">{{userInfo.shopName}}会员卡</text>
|
||||
<view class="card_head_left_icon_box" v-if="userInfo.isVip != 0">
|
||||
<text class="card_head_left_name">{{shopUserInfo.shopName}}会员卡</text>
|
||||
<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>
|
||||
<text class="card_head_left_iconText">VL1</text>
|
||||
</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>
|
||||
</view>
|
||||
</view>
|
||||
<view class="card_cen">
|
||||
<view class="card_cen_left">{{ userInfo.isVip == 0 ? '尚未开通会员暂无法享受会员权益' : '欢迎加入本店会员~'}}</view>
|
||||
<view class="card_cen_right" v-if="userInfo.isVip != 0">查看特权</view>
|
||||
<view class="card_cen_left">{{ shopUserInfo.isVip == 0 ? '尚未开通会员暂无法享受会员权益' : '欢迎加入本店会员~'}}</view>
|
||||
<view class="card_cen_right" v-if="shopUserInfo.isVip != 0">查看特权</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)">
|
||||
<text>{{userInfo.amount || '0.00'}}</text><text>储值</text>
|
||||
<text>{{shopUserInfo.amount || '0.00'}}</text><text>储值</text>
|
||||
</view>
|
||||
<view class="card_bom_item">
|
||||
<text>0</text><text>积分</text>
|
||||
@@ -40,8 +41,8 @@
|
||||
</view>
|
||||
|
||||
|
||||
<view class="card_bottom" :class="userInfo.isVip == 0 ? 'n' : ''">
|
||||
<view class="card_bottom_Box" v-if="userInfo.isVip != 0">
|
||||
<view class="card_bottom" :class="shopUserInfo.isVip == 0 ? 'n' : ''">
|
||||
<view class="card_bottom_Box" v-if="shopUserInfo.isVip != 0">
|
||||
<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>
|
||||
<view class="">
|
||||
@@ -72,7 +73,7 @@
|
||||
</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>
|
||||
</template>
|
||||
@@ -88,13 +89,13 @@
|
||||
shopId_id: null,
|
||||
memberOpen: false,
|
||||
amount: '',
|
||||
userInfo: {},
|
||||
shopUserInfo: null,
|
||||
lucky: {
|
||||
list: ['鸿运当头',"财运亨通","时来运转","否极泰来","花逢时发"],
|
||||
index: 0,
|
||||
text: ""
|
||||
},
|
||||
usershopUserinfo:{},
|
||||
shopExtend: null,
|
||||
}
|
||||
},
|
||||
onLoad(e) {
|
||||
@@ -102,30 +103,42 @@
|
||||
},
|
||||
onShow() {
|
||||
this.init();
|
||||
|
||||
this.getShopExtend();
|
||||
},
|
||||
methods: {
|
||||
/**
|
||||
* 获取店铺信息
|
||||
*/
|
||||
async init() {
|
||||
|
||||
let res = await this.api.shopUserInfo({
|
||||
"shopId": this.shopId_id,
|
||||
"userId": uni.cache.get('userInfo').id,
|
||||
})
|
||||
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;
|
||||
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 ) {
|
||||
if ( type == 1) {
|
||||
uni.pro.navigateTo('member/index', {
|
||||
shopId: this.userInfo.shopId,
|
||||
shopId: this.shopUserInfo.shopId,
|
||||
type: 'index',
|
||||
})
|
||||
} else if ( type == 3 ) {
|
||||
@@ -144,7 +157,7 @@
|
||||
|
||||
clickEvent() {
|
||||
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;
|
||||
position: relative;
|
||||
z-index: 2;
|
||||
padding-top: 20rpx;
|
||||
.card_info_bg{
|
||||
width: 630rpx;
|
||||
height: 304rpx;
|
||||
position: absolute;
|
||||
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{
|
||||
position: relative;
|
||||
left: 0;
|
||||
|
||||
@@ -4,6 +4,10 @@
|
||||
<view class="box_item flex-between">
|
||||
<text class="top_box_one_text">当前账号</text>
|
||||
<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 class="box_item flex-between" style="position:relative;">
|
||||
<text class="top_box_one_text"></text>
|
||||
@@ -36,10 +40,10 @@
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
isPwd: uni.cache.get('userInfo').isPwd,
|
||||
mobile: uni.cache.get('userInfo').telephone.slice(0, 3)+'****'+uni.cache.get('userInfo').telephone.slice(7),
|
||||
isPwd: "",
|
||||
mobile: "",
|
||||
form: {
|
||||
mobile: uni.cache.get('userInfo').telephone,
|
||||
mobile: '',
|
||||
password: '',
|
||||
payPassword: '',
|
||||
checkCode: ''
|
||||
@@ -49,16 +53,20 @@
|
||||
// 注册定时器 初始值
|
||||
second: 60,
|
||||
showText: true,
|
||||
Recapture: '获取验证码'
|
||||
Recapture: '获取验证码',
|
||||
shopUserInfo: null,
|
||||
};
|
||||
},
|
||||
onLoad(e) {
|
||||
// if ( e.shopUserInfo ) {
|
||||
// this.shopUserInfo = JSON.parse(e.shopUserInfo);
|
||||
// this.isPwd = this.shopUserInfo.isPwd;
|
||||
// this.mobile = this.shopUserInfo.telephone.slice(0, 3)+'****'+this.shopUserInfo.telephone.slice(7);
|
||||
// this.form.mobile = this.shopUserInfo.telephone;
|
||||
// }
|
||||
console.log(e)
|
||||
if ( e.shopUserInfo ) {
|
||||
this.shopUserInfo = JSON.parse(e.shopUserInfo);
|
||||
console.log(this.shopUserInfo)
|
||||
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: {
|
||||
@@ -86,6 +94,33 @@
|
||||
}, 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() {
|
||||
let res = await this.api.loginwxuserInfo({
|
||||
userId: uni.cache.get('userInfo').id
|
||||
@@ -139,6 +174,7 @@
|
||||
return false;
|
||||
}
|
||||
let res = await this.api.loginresetPwd({
|
||||
vipId: this.shopUserInfo.id,
|
||||
pwd: this.form.password,
|
||||
code: this.form.checkCode
|
||||
})
|
||||
@@ -189,6 +225,7 @@
|
||||
|
||||
.box_item {
|
||||
border-bottom: 1rpx solid #E5E5E5;
|
||||
position: relative;
|
||||
.top_box_one_text {
|
||||
font-family: Source Han Sans CN, Source Han Sans CN;
|
||||
font-weight: 500;
|
||||
@@ -256,5 +293,16 @@
|
||||
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>
|
||||
@@ -13,7 +13,7 @@
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
userInfo: null,
|
||||
shopUserInfo: null,
|
||||
list: [
|
||||
{name: "余额明细", url: "member/billDetails"},
|
||||
{name: "密码设置", url: "member/setPassword"},
|
||||
@@ -22,7 +22,7 @@
|
||||
}
|
||||
},
|
||||
onLoad(e) {
|
||||
this.userInfo = e
|
||||
this.shopUserInfo = JSON.parse(e.shopUserInfo)
|
||||
},
|
||||
|
||||
methods: {
|
||||
@@ -30,7 +30,9 @@
|
||||
* 跳转
|
||||
*/
|
||||
handleClick ( item ) {
|
||||
uni.pro.navigateTo(item.url, this.userInfo)
|
||||
uni.navigateTo({
|
||||
url: `/pages/${item.url}?shopUserInfo=${JSON.stringify(this.shopUserInfo)}`
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -518,9 +518,8 @@
|
||||
if (res.data == 1) {
|
||||
this.showToastUppop('支付成功')
|
||||
let _this = this
|
||||
|
||||
uni.requestSubscribeMessage({
|
||||
tmplIds: ['z0fUG7-jhSfYCrw6poOvSRzh4_hgnPkm_5C7E5s5bCQ'],
|
||||
tmplIds:["z0fUG7-jhSfYCrw6poOvSRzh4_hgnPkm_5C7E5s5bCQ","AV-KybUHaK3KtFVLqpy6PHccHBS7XeX__mOM4RbufnQ"],
|
||||
complete() {
|
||||
uni.redirectTo({
|
||||
url: '/pages/order/order_detail?orderId=' + _this
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
:navigateBacknavtitle='true'></navseat>
|
||||
<!-- 顶部面板,可添加所需要放在页面顶部的内容代码。比如banner图 -->
|
||||
<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">
|
||||
</image>
|
||||
<view class="panelone">
|
||||
@@ -152,7 +152,7 @@
|
||||
<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="flex-end" >
|
||||
<view class="sku-wrap flex-center" style="background-color: #CECECE;">
|
||||
@@ -256,12 +256,12 @@
|
||||
</view>
|
||||
<view class="operation-wrap">
|
||||
<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>
|
||||
<text class="num" v-if="item.number">{{ item.number }}</text>
|
||||
<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>
|
||||
</view>
|
||||
@@ -330,11 +330,20 @@
|
||||
<view class="shop_sku_box_name">
|
||||
{{item.name}}
|
||||
</view>
|
||||
<!-- :class="item.start == index1 ?'shop_sku_box_item_selected':''"> -->
|
||||
<view class="flex-start">
|
||||
<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':''}"
|
||||
:class=" item.start == index1 ?'shop_sku_box_item_selected':''">
|
||||
@click="morloe(item1,index,index1,item)"
|
||||
:class="{'shop_sku_box_item_selected': item.start == index1, 'disabled': !item1.disabled || !item1.isGrounding || item1.isPauseSale==1}"
|
||||
>
|
||||
{{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>
|
||||
@@ -369,15 +378,18 @@
|
||||
</view>
|
||||
</view>
|
||||
</u-popup>
|
||||
<popupad :forceUpdate="forceUpdate" :showPosition="'make_order'"></popupad>
|
||||
</view>
|
||||
|
||||
</template>
|
||||
<script>
|
||||
import navseat from '@/components/navseat.vue'
|
||||
import webSocketUtils from '@/common/js/websocket.js';
|
||||
import popupad from '@/components/popupad.vue'
|
||||
export default {
|
||||
components: {
|
||||
navseat
|
||||
navseat,
|
||||
popupad
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
@@ -413,6 +425,8 @@
|
||||
lastbottom: '', //元素最低端的距离
|
||||
scrollxleft: true,
|
||||
orderdetailFlag: true,
|
||||
forceUpdate: false,
|
||||
shopExtend: null,
|
||||
}
|
||||
},
|
||||
onPageScroll(e) {
|
||||
@@ -460,17 +474,28 @@
|
||||
},
|
||||
async onShow() {
|
||||
let _this = this;
|
||||
this.forceUpdate = !this.forceUpdate;
|
||||
this.orderdetailFlag = true;
|
||||
uni.pageScrollTo({
|
||||
scrollTop: 0,
|
||||
duration: 0
|
||||
});
|
||||
console.log(uni.cache.get('token'))
|
||||
|
||||
console.log(14)
|
||||
|
||||
_this.getLocation()
|
||||
},
|
||||
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() {
|
||||
uni.pro.switchTab('index/index')
|
||||
},
|
||||
@@ -500,35 +525,40 @@
|
||||
* 获取定位
|
||||
*/
|
||||
getLocation() {
|
||||
try {
|
||||
uni.getLocation({
|
||||
type: 'wgs84',
|
||||
success: async (res) => {
|
||||
let successres = await this.api.geocodelocation({
|
||||
lng: res.longitude,
|
||||
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: "未央区"
|
||||
if ( !uni.cache.get('getLocationstorage') ) {
|
||||
try {
|
||||
uni.getLocation({
|
||||
type: 'wgs84',
|
||||
success: async (res) => {
|
||||
let successres = await this.api.geocodelocation({
|
||||
lng: res.longitude,
|
||||
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();
|
||||
}
|
||||
},
|
||||
fail: async (err) => {
|
||||
this.productqueryShop();
|
||||
}
|
||||
});
|
||||
} catch (e) {
|
||||
});
|
||||
} catch (e) {
|
||||
this.productqueryShop();
|
||||
//TODO handle the exception
|
||||
}
|
||||
} else {
|
||||
this.productqueryShop();
|
||||
//TODO handle the exception
|
||||
}
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
@@ -547,6 +577,7 @@
|
||||
this.shopInfo = res.data;
|
||||
this.productqueryProduct() //list 数据
|
||||
this.handlemessage() //监听websocket返回
|
||||
this.getShopExtend();
|
||||
} else {
|
||||
setTimeout(() => {
|
||||
uni.pro.switchTab('index/index')
|
||||
@@ -562,14 +593,17 @@
|
||||
this.shopProductList.productInfo[index].products[index1]['imgLoad'] = true;
|
||||
// e.currentTarget.src
|
||||
},
|
||||
|
||||
|
||||
/**
|
||||
* 跳转搜索
|
||||
* @param {Object} e
|
||||
*/
|
||||
searchStatus (e) {
|
||||
if ( e == "searchClick" ) {
|
||||
uni.navigateTo({
|
||||
url: '/pages/order_food/order_food_search?tableCode=' + uni.cache.get('tableCode')
|
||||
});
|
||||
}
|
||||
console.log(e)
|
||||
},
|
||||
|
||||
/**
|
||||
@@ -584,7 +618,16 @@
|
||||
if (b == '单规格') { //没有规格为空
|
||||
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;
|
||||
|
||||
this.hodgepodge(item, 1, a, cartNumber) //获取skuid /1添加购物车
|
||||
},
|
||||
|
||||
@@ -598,7 +641,13 @@
|
||||
*/
|
||||
shopAdd(item, index, index1, a, b) {
|
||||
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) {
|
||||
this.amountcartNumber = this.amountcartNumber + (this.skuSuit == 0 ? 1 : this.skuSuit);
|
||||
} else {
|
||||
@@ -624,6 +673,13 @@
|
||||
return;
|
||||
}
|
||||
let num = 0;
|
||||
if ( item.isVip == 1 && item.cartNumber >= item.limitNumber){
|
||||
uni.showToast({
|
||||
title: '当前商品已达到最大赠送数量',
|
||||
icon: 'none'
|
||||
})
|
||||
return;
|
||||
}
|
||||
if (item.typeEnum == "normal") {
|
||||
num = item.cartNumber + this.amountcartNumber;
|
||||
} else {
|
||||
@@ -633,6 +689,7 @@
|
||||
"skuId": this.skuId,
|
||||
"num": num, //数量
|
||||
"type": a == '+' ? 1 : 0,
|
||||
"isVip": item.isVip,
|
||||
"productId": item.id, //商品id
|
||||
"shopId": uni.cache.get('shopUser'),
|
||||
"userId": uni.cache.get('userInfo').id,
|
||||
@@ -649,10 +706,14 @@
|
||||
*/
|
||||
async cartListadd(item, index, c) {
|
||||
try {
|
||||
if ( c == "+" && item.isVip == 1){
|
||||
return;
|
||||
}
|
||||
let params = {
|
||||
"skuId": item.skuId,
|
||||
"num": c == '+' ? item.number + 1 : item.number - 1, //数量
|
||||
"type": c == '+' ? 1 : 0,
|
||||
"isVip": item.isVip,
|
||||
"productId": item.productId, //商品id
|
||||
"shopId": uni.cache.get('shopUser'),
|
||||
"userId": uni.cache.get('userInfo').id,
|
||||
@@ -694,7 +755,7 @@
|
||||
setNumber() {
|
||||
// 处理购物车相同id的情况下 数量相加
|
||||
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) {
|
||||
existing.number += current.number;
|
||||
} else {
|
||||
@@ -709,7 +770,7 @@
|
||||
return item.products.filter(e => {
|
||||
e.cartNumber = 0;
|
||||
return summedArray.find(i => {
|
||||
if (e.id == i.productId) {
|
||||
if (e.id == i.productId && e.isVip == i.isVip) {
|
||||
e.cartNumber = i.number
|
||||
}
|
||||
})
|
||||
@@ -762,7 +823,7 @@
|
||||
productId: item1.id, //商品id
|
||||
})
|
||||
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 = {
|
||||
id: item1.id, //商品id
|
||||
name: item.name,
|
||||
@@ -772,7 +833,9 @@
|
||||
item.value.split(",").forEach((v, e) => {
|
||||
res.children.push({
|
||||
name: v,
|
||||
isGrounding: false
|
||||
disabled: index == 0 ? true : false,
|
||||
isGrounding: index == 0 ? false : true,
|
||||
isPauseSale: index == 0 ? 1 : 0,
|
||||
})
|
||||
})
|
||||
return res
|
||||
@@ -786,9 +849,17 @@
|
||||
isSkuidname.push(this.specifications.tagSnap[0].children[o].name)
|
||||
//筛选符合条件的规格列表
|
||||
filteredJson = this.querySpecList.filter(obj => obj.specSnap.indexOf(isSkuidname) == 0);
|
||||
// 上下架初始化处理
|
||||
for (let i = 0; i < filteredJson.length; i++) {
|
||||
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; // 终止循环
|
||||
}
|
||||
}
|
||||
@@ -796,12 +867,7 @@
|
||||
}
|
||||
|
||||
this.skuBtnText = `您还没选择${this.specifications.tagSnap[0].name}哦`
|
||||
|
||||
// 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查找价格和数量
|
||||
this.hodgepodge(this.specifications, 2) //获取skuid /2查找价格和数量
|
||||
}
|
||||
|
||||
} catch (e) {
|
||||
@@ -817,23 +883,28 @@
|
||||
* @param {Object} item
|
||||
*/
|
||||
async morloe(e, index, index1, item) {
|
||||
if (!e.isGrounding) {
|
||||
if (!e.isGrounding || !e.disabled || e.isPauseSale == 1) {
|
||||
return;
|
||||
}
|
||||
|
||||
let querySpecList = [];
|
||||
this.skuBtnText = "添加到购物车";
|
||||
this.isSpec = true;
|
||||
// 设置当前选中下标
|
||||
if (this.specifications.tagSnap[index].start != index1) {
|
||||
this.$set(this.specifications.tagSnap[index], 'start', index1)
|
||||
} else {
|
||||
this.$set(this.specifications.tagSnap[index], 'start', -1)
|
||||
index = index - 1;
|
||||
}
|
||||
this.skuidname = [];
|
||||
this.specifications.tagSnap.forEach((val, i, arr) => { //初始化skuidname的数据 选择第一个
|
||||
// 选择规格下面的其他规格可点击状态重置
|
||||
this.specifications.tagSnap.forEach((val, i, arr) => {
|
||||
if (i > index) {
|
||||
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;
|
||||
}
|
||||
@@ -841,8 +912,8 @@
|
||||
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++) {
|
||||
if (this.specifications.tagSnap[i].start < 0) {
|
||||
this.isSpec = false;
|
||||
@@ -851,7 +922,6 @@
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
let filteredJson;
|
||||
let isSkuidname = [];
|
||||
//提前下一列规格循环,查看是否有下架规格
|
||||
@@ -859,11 +929,18 @@
|
||||
for (let o = 0; o < this.specifications.tagSnap[index + 1].children.length; o++) {
|
||||
isSkuidname = JSON.parse(JSON.stringify(this.skuidname));
|
||||
isSkuidname.push(this.specifications.tagSnap[index + 1].children[o].name)
|
||||
//筛选符合条件的规格列表
|
||||
// 上下架状态处理
|
||||
filteredJson = this.querySpecList.filter(obj => obj.specSnap.indexOf(isSkuidname) == 0);
|
||||
for (let i = 0; i < filteredJson.length; i++) {
|
||||
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; // 终止循环
|
||||
}
|
||||
}
|
||||
@@ -871,13 +948,8 @@
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// res.data.forEach((v,e)=>{
|
||||
// // this.$set(this.specifications.tagSnap[e], 'children', v.value)
|
||||
// })
|
||||
|
||||
this.$forceUpdate();
|
||||
this.hodgepodge(item, 2)
|
||||
this.hodgepodge(this.specifications, 2)
|
||||
},
|
||||
|
||||
/**
|
||||
@@ -894,6 +966,7 @@
|
||||
code: uni.cache.get('tableCode'),
|
||||
shopId: uni.cache.get('shopUser'),
|
||||
productId: item.id, //商品id
|
||||
isVip: item.isVip, //商品id
|
||||
spec_tag: this.skuidname.join(","),
|
||||
})
|
||||
this.salePrice = res.data.salePrice // 价格
|
||||
@@ -904,6 +977,7 @@
|
||||
"num": num, //数量
|
||||
"type": c == '+' ? 1 : 0,
|
||||
"productId": item.id, //商品id
|
||||
"isVip": item.isVip,
|
||||
"shopId": uni.cache.get('shopUser'),
|
||||
"userId": uni.cache.get('userInfo').id,
|
||||
"tableId": uni.cache.get('tableCode'),
|
||||
@@ -1472,14 +1546,41 @@
|
||||
border-radius: 8rpx;
|
||||
font-size: 24upx;
|
||||
margin-left: 56rpx;
|
||||
background: #F5F5F5;
|
||||
border: 2rpx solid #F5F5F5;
|
||||
background: #EFEFEF;
|
||||
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) {
|
||||
margin-left: 0;
|
||||
}
|
||||
|
||||
.disabled{
|
||||
color: #999;
|
||||
background-color: #F5F5F5;
|
||||
border: 2rpx solid #F5F5F5;
|
||||
}
|
||||
|
||||
.shop_sku_box_item_noselected {
|
||||
color: #666;
|
||||
}
|
||||
|
||||
@@ -144,7 +144,7 @@
|
||||
</view>
|
||||
<text class="num" v-if="item.number">{{ item.number }}</text>
|
||||
<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>
|
||||
</view>
|
||||
@@ -180,9 +180,17 @@
|
||||
</view>
|
||||
<view class="flex-start">
|
||||
<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':''}"
|
||||
:class=" item.start == index1 ?'shop_sku_box_item_selected':''">
|
||||
@click="morloe(item1,index,index1,item)"
|
||||
:class="{'shop_sku_box_item_selected': item.start == index1, 'disabled': !item1.disabled || !item1.isGrounding || item1.isPauseSale==1}"
|
||||
>
|
||||
{{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>
|
||||
@@ -271,13 +279,9 @@
|
||||
HeighT() { //手机类型的尺寸 导航栏高度
|
||||
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) {
|
||||
console.log(e)
|
||||
|
||||
},
|
||||
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) {
|
||||
this.searchList[index]['imgLoad'] = true;
|
||||
},
|
||||
|
||||
|
||||
/**
|
||||
* 搜索内容
|
||||
* @param {Object} val
|
||||
*/
|
||||
searchVal (val) {
|
||||
this.searchList = [];
|
||||
if ( val == "") {
|
||||
@@ -373,6 +397,13 @@
|
||||
if (b == '单规格') { //没有规格为空
|
||||
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;
|
||||
this.hodgepodge(item, 1, a, cartNumber) //获取skuid /1添加购物车
|
||||
},
|
||||
@@ -387,7 +418,13 @@
|
||||
*/
|
||||
shopAdd(item, 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) {
|
||||
this.amountcartNumber = this.amountcartNumber + (this.skuSuit == 0 ? 1 : this.skuSuit);
|
||||
} else {
|
||||
@@ -413,6 +450,13 @@
|
||||
return;
|
||||
}
|
||||
let num = 0;
|
||||
if ( item.isVip == 1 && item.cartNumber >= item.limitNumber){
|
||||
uni.showToast({
|
||||
title: '当前商品已达到最大赠送数量',
|
||||
icon: 'none'
|
||||
})
|
||||
return;
|
||||
}
|
||||
if (item.typeEnum == "normal") {
|
||||
num = item.cartNumber + this.amountcartNumber;
|
||||
} else {
|
||||
@@ -422,6 +466,7 @@
|
||||
"skuId": this.skuId,
|
||||
"num": num, //数量
|
||||
"type": a == '+' ? 1 : 0,
|
||||
"isVip": item.isVip,
|
||||
"productId": item.id, //商品id
|
||||
"shopId": uni.cache.get('shopUser'),
|
||||
"userId": uni.cache.get('userInfo').id,
|
||||
@@ -438,10 +483,14 @@
|
||||
*/
|
||||
async cartListadd(item, c) {
|
||||
try {
|
||||
if ( c == "+" && item.isVip == 1){
|
||||
return;
|
||||
}
|
||||
let params = {
|
||||
"skuId": item.skuId,
|
||||
"num": c == '+' ? item.number + 1 : item.number - 1, //数量
|
||||
"type": c == '+' ? 1 : 0,
|
||||
"isVip": item.isVip,
|
||||
"productId": item.productId, //商品id
|
||||
"shopId": uni.cache.get('shopUser'),
|
||||
"userId": uni.cache.get('userInfo').id,
|
||||
@@ -483,7 +532,7 @@
|
||||
setNumber() {
|
||||
// 处理购物车相同id的情况下 数量相加
|
||||
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) {
|
||||
existing.number += current.number;
|
||||
} else {
|
||||
@@ -498,7 +547,7 @@
|
||||
return item.products.filter(e => {
|
||||
e.cartNumber = 0;
|
||||
return summedArray.find(i => {
|
||||
if (e.id == i.productId) {
|
||||
if (e.id == i.productId && e.isVip == i.isVip) {
|
||||
e.cartNumber = i.number
|
||||
}
|
||||
})
|
||||
@@ -523,6 +572,7 @@
|
||||
this.cartLists_count = 0;
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
* 多规格选择
|
||||
* @param {Object} item1
|
||||
@@ -530,6 +580,7 @@
|
||||
* @param {Object} index1
|
||||
*/
|
||||
async clickspecifications(item1, index1, type) {
|
||||
console.log(item1)
|
||||
if ( item1.isPauseSale != 0 || item1.isSale == 0) {
|
||||
return;
|
||||
}
|
||||
@@ -544,13 +595,16 @@
|
||||
this.hodgepodge(this.specifications, 2) //获取skuid /2查找价格和数量
|
||||
this.skuBtnText = `添加到购物车`
|
||||
} else {
|
||||
console.log(3)
|
||||
// 多规格数据处理
|
||||
this.isSpec = false;
|
||||
let obj = await this.api.productquerySpec({
|
||||
productId: item1.id, //商品id
|
||||
})
|
||||
console.log(2)
|
||||
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 = {
|
||||
id: item1.id, //商品id
|
||||
name: item.name,
|
||||
@@ -560,12 +614,13 @@
|
||||
item.value.split(",").forEach((v, e) => {
|
||||
res.children.push({
|
||||
name: v,
|
||||
isGrounding: false
|
||||
disabled: index == 0 ? true : false,
|
||||
isGrounding: index == 0 ? false : true,
|
||||
isPauseSale: index == 0 ? 1 : 0,
|
||||
})
|
||||
})
|
||||
return res
|
||||
})
|
||||
|
||||
//初始化第一列规格可编辑
|
||||
let filteredJson;
|
||||
let isSkuidname = [];
|
||||
@@ -574,18 +629,26 @@
|
||||
isSkuidname.push(this.specifications.tagSnap[0].children[o].name)
|
||||
//筛选符合条件的规格列表
|
||||
filteredJson = this.querySpecList.filter(obj => obj.specSnap.indexOf(isSkuidname) == 0);
|
||||
// 上下架初始化处理
|
||||
for (let i = 0; i < filteredJson.length; i++) {
|
||||
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; // 终止循环
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
console.log(1)
|
||||
this.skuBtnText = `您还没选择${this.specifications.tagSnap[0].name}哦`
|
||||
|
||||
this.hodgepodge(this.specifications.tagSnap[0], 2) //获取skuid /2查找价格和数量
|
||||
console.log(this.specifications)
|
||||
this.hodgepodge(this.specifications, 2) //获取skuid /2查找价格和数量
|
||||
}
|
||||
|
||||
} catch (e) {
|
||||
@@ -601,23 +664,29 @@
|
||||
* @param {Object} item
|
||||
*/
|
||||
async morloe(e, index, index1, item) {
|
||||
if (!e.isGrounding) {
|
||||
|
||||
if (!e.isGrounding || !e.disabled || e.isPauseSale == 1) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
let querySpecList = [];
|
||||
this.skuBtnText = "添加到购物车";
|
||||
this.isSpec = true;
|
||||
// 设置当前选中下标
|
||||
if (this.specifications.tagSnap[index].start != index1) {
|
||||
this.$set(this.specifications.tagSnap[index], 'start', index1)
|
||||
} else {
|
||||
this.$set(this.specifications.tagSnap[index], 'start', -1)
|
||||
index = index - 1;
|
||||
}
|
||||
this.skuidname = [];
|
||||
this.specifications.tagSnap.forEach((val, i, arr) => { //初始化skuidname的数据 选择第一个
|
||||
// 选择规格下面的其他规格可点击状态重置
|
||||
this.specifications.tagSnap.forEach((val, i, arr) => {
|
||||
if (i > index) {
|
||||
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;
|
||||
}
|
||||
@@ -625,8 +694,8 @@
|
||||
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++) {
|
||||
if (this.specifications.tagSnap[i].start < 0) {
|
||||
this.isSpec = false;
|
||||
@@ -634,8 +703,7 @@
|
||||
break; // 终止循环
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
let filteredJson;
|
||||
let isSkuidname = [];
|
||||
//提前下一列规格循环,查看是否有下架规格
|
||||
@@ -643,15 +711,22 @@
|
||||
for (let o = 0; o < this.specifications.tagSnap[index + 1].children.length; o++) {
|
||||
isSkuidname = JSON.parse(JSON.stringify(this.skuidname));
|
||||
isSkuidname.push(this.specifications.tagSnap[index + 1].children[o].name)
|
||||
//筛选符合条件的规格列表
|
||||
// 上下架状态处理
|
||||
filteredJson = this.querySpecList.filter(obj => obj.specSnap.indexOf(isSkuidname) == 0);
|
||||
for (let i = 0; i < filteredJson.length; i++) {
|
||||
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; // 终止循环
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -668,13 +743,15 @@
|
||||
*/
|
||||
async hodgepodge(item, a, c, num) { //此接口去获取商品id !!!赋值库存 数量 价格等
|
||||
try {
|
||||
// console.log(this.skuidname.join(","))
|
||||
console.log(this.skuidname.join(","))
|
||||
let res = await this.api.productqueryProductSku({
|
||||
code: uni.cache.get('tableCode'),
|
||||
shopId: uni.cache.get('shopUser'),
|
||||
productId: item.id, //商品id
|
||||
isVip: item.isVip, //商品id
|
||||
spec_tag: this.skuidname.join(","),
|
||||
})
|
||||
console.log(res)
|
||||
this.salePrice = res.data.salePrice // 价格
|
||||
let data = null;
|
||||
if (a == 1) { //1添加购物车 2是websocket返回这个商品的价格(应为不同的多规格商品返回不同的价格)
|
||||
@@ -683,6 +760,7 @@
|
||||
"num": num, //数量
|
||||
"type": c == '+' ? 1 : 0,
|
||||
"productId": item.id, //商品id
|
||||
"isVip": item.isVip,
|
||||
"shopId": uni.cache.get('shopUser'),
|
||||
"userId": uni.cache.get('userInfo').id,
|
||||
"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;
|
||||
font-size: 24upx;
|
||||
margin-left: 56rpx;
|
||||
background: #F5F5F5;
|
||||
border: 2rpx solid #F5F5F5;
|
||||
background: #EFEFEF;
|
||||
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) {
|
||||
margin-left: 0;
|
||||
}
|
||||
|
||||
.disabled{
|
||||
color: #999;
|
||||
background-color: #F5F5F5;
|
||||
border: 2rpx solid #F5F5F5;
|
||||
}
|
||||
.shop_sku_box_item_noselected {
|
||||
color: #666;
|
||||
}
|
||||
|
||||
@@ -51,6 +51,8 @@
|
||||
<!-- <picker :show="calendarShow" mode="date"></picker> -->
|
||||
<u-datetime-picker
|
||||
mode="date"
|
||||
itemHeight="66"
|
||||
visibleItemCount="5"
|
||||
@cancel="calendarShow = false"
|
||||
:show="calendarShow"
|
||||
:minDate="-2208988800000"
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
<template>
|
||||
<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="my_info flex-between">
|
||||
<view class="my_info_left">
|
||||
@@ -70,6 +70,7 @@
|
||||
// { name: "关于", type: "", icon: "https://czg-qr-order.oss-cn-beijing.aliyuncs.com/my/inRegard.png"},
|
||||
],
|
||||
shopInfo: {},
|
||||
shopExtend: null,
|
||||
};
|
||||
},
|
||||
onLoad() {},
|
||||
@@ -87,6 +88,7 @@
|
||||
this.loginwxuserInfo()
|
||||
if (uni.cache.get('shopUser') ) {
|
||||
this.getShopInfo();
|
||||
this.getShopExtend();
|
||||
} else{
|
||||
|
||||
}
|
||||
@@ -94,7 +96,21 @@
|
||||
methods: {
|
||||
// 下面初始数据
|
||||
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;
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
|
||||
@@ -82,8 +82,8 @@ const store = new Vuex.Store({
|
||||
let curPage = pages[pages.length -1 ]
|
||||
curPage.onLoad(curPage.options)
|
||||
curPage.onShow()
|
||||
// curPage.mounted()
|
||||
curPage.onReady()
|
||||
this.$isResolve()
|
||||
}
|
||||
},
|
||||
fail: (err) => {}
|
||||
|
||||
Reference in New Issue
Block a user