Commit 4e1f3211 by songbingqi

完成下单授权接口调整

parent f20aca34
<template>
<view>
<image class="default-img" :style="{'height':!loadOver?height:0,'width':!loadOver?width:0}" :src="defaultSrc"/>
<image class="real-img" @load="loadOverFunction" :style="{'height':loadOver?height:0,'width':loadOver?width:0}" :src="realSrc" />
<view class="bnox">
<image class="default-img" v-if="!show" :style="{'height':height,'width':width}" :src="defaultSrc"/>
<view class="videoView">
<video autoplay muted :enable-progress-gesture="false" :controls="false" loop class="real-img":style="{'height':height,'width':width}" :src="realSrc" />
</view>
</view>
</template>
<script>
export default {
props:['defaultSrc','realSrc','width','height'],
watch:{
realSrc(val){
if(val){
setTimeout(() => {
this.show = true
}, 5000);
}
}
},
data(){
return {
loadOver:false
loadOver:false,
show:false
}
},
methods: {
......@@ -22,5 +34,16 @@ export default {
</script>
<style lang="scss" scoped>
.videoView {
z-index: 1;
}
.bnox {
position: relative;
.default-img {
position: absolute;
z-index: 2;
}
}
</style>
\ No newline at end of file
......@@ -131,14 +131,18 @@ export default {
this.BottomSafeHeight = uni.getStorageSync('BottomSafeHeight')
this.TermsStatus = uni.getStorageSync('TermsStatus') || false
},
onLoad(option) {
async onLoad(option) {
// 清除优惠卷信息
this.$store.commit("cleanInfo",{})
setTimeout(() => {
this.msgInfo.sendMsgFlag1 = ''
this.msgInfo.flagExpireData = ''
}, 1000);
const {data} = await User.getUserMsgInfo()
console.log(data)
const {data:newdata} = data
const {flagExpireDate,sendMsgFlag1 = '',sendMsgFlag2 = '',sendMsgFlag3 = ''} = newdata
this.sendMsgData.sendMsgFlag1 = sendMsgFlag1
this.sendMsgData.sendMsgFlag2 = sendMsgFlag2
this.sendMsgData.sendMsgFlag3 = sendMsgFlag3
this.sendMsgData.flagExpireData = flagExpireDate?Date.parse(flagExpireDate.substring(0,10)):''
if(!this.userms){
User.wxLoginAndGetOpenid(true).then(loginInfo=>{
......@@ -203,17 +207,17 @@ export default {
{
tmp:'1uErx-15S-3vuopXSvvsxCeM_Jd-1iZC-nXzd2yW3QU',
title:'下单成功通知',
status:false
status:true
},
{
tmp:'Q4HDwBEvpTXpwtZktqWm4SZOTEuQK1x48xjqjD2GqyM',
title:'订单状态变更通知',
status:false
status:true
},
{
tmp:'Fu_CPIXa0cnJ4EDdVKqFQ3qqKJccMqt2oorI5mfNq74',
title:'取餐提醒',
status:false
status:true
}
],
saveFlag:false,
......@@ -232,6 +236,11 @@ export default {
ticketNum:0,
msgInfo:{
},
sendMsgData: {
sendMsgFlag1:false,
sendMsgFlag2:false,
sendMsgFlag3:false
}
}
},
......@@ -295,26 +304,14 @@ export default {
},
// 保存用户通知授权信息
async submitMessage() {
const sendData = {
sendMsgFlag1:false,
sendMsgFlag2:false,
sendMsgFlag3:false,
saveFlag:this.saveFlag
}
this.messageList.forEach((item,index) => {
sendData[`sendMsgFlag${index+1}`] = item.status
this.sendMsgData[`sendMsgFlag${index+1}`] = item.status
})
// let a = await User.setAllow(sendData)
// console.log(a)
let { data } = await User.setAllow({...this.sendMsgData,rememberFlag:this.saveFlag})
this.messagePopup = false
if(data.code===200){
this.saveReserve()
}
},
changeContentFlag(index) {
this.messageList[index].status = !this.messageList[index].status
......@@ -349,18 +346,23 @@ export default {
},
messageAndSave() {
let needChoseMsg = true
const { sendMsgFlag1, flagExpireData } = this.msgInfo
if(!sendMsgFlag1&&!flagExpireData){
const { sendMsgFlag1, flagExpireData } = this.sendMsgData
const HasMessageFlag = JSON.stringify(sendMsgFlag1)=='true'||JSON.stringify(sendMsgFlag1)=='false'?true:true
if(!HasMessageFlag&&!flagExpireData){
console.log('用户从未选择过授权信息,弹框')
needChoseMsg = true
}else{
if(!flagExpireData&&sendMsgFlag1){
if(!flagExpireData&&HasMessageFlag){
console.log('用户已经永久授权信息,不弹框')
needChoseMsg = false
}else if(flagExpireData<new Date().valueOf()){
console.log('用户授权了信息没保存超过七天了,弹框')
needChoseMsg = true
}else{
console.log('用户授权了信息没保存没超过七天,不弹框')
needChoseMsg = false
}
}
console.log(needChoseMsg)
if(needChoseMsg) {
this.messagePopup = true
}else{
......@@ -444,9 +446,13 @@ export default {
// sendMsgFlag1:下单成功通知
// sendMsgFlag2:订单状态变更通知
// sendMsgFlag3:取餐提醒
const sendMsgFlag1 = val['1uErx-15S-3vuopXSvvsxCeM_Jd-1iZC-nXzd2yW3QU']?1:0
const sendMsgFlag2 = val['Q4HDwBEvpTXpwtZktqWm4SZOTEuQK1x48xjqjD2GqyM']?1:0
const sendMsgFlag3 = val['Fu_CPIXa0cnJ4EDdVKqFQ3qqKJccMqt2oorI5mfNq74']?1:0
const { sendMsgFlag1,
sendMsgFlag2,
sendMsgFlag3
} = this.sendMsgData
const sendMsgFlag1N = sendMsgFlag1?1:0
const sendMsgFlag2N = sendMsgFlag2?1:0
const sendMsgFlag3N = sendMsgFlag3?1:0
let res = await Utils.AssemblyOrder(this.shopData, this.totalPrice, this.totalNum, this.buyType, list);
if (res) {
......@@ -457,9 +463,9 @@ export default {
paidAmount:amount,
lat,
lng,
sendMsgFlag1,
sendMsgFlag2,
sendMsgFlag3
sendMsgFlag1:sendMsgFlag1N,
sendMsgFlag2:sendMsgFlag2N,
sendMsgFlag3:sendMsgFlag3N
}
if(JSON.stringify(this.selectCoupon)!="{}"){
sendData.couponId = this.selectCoupon.id||'',
......
<template>
<view class="menu-box">
<view class="menu-banner" :style="{'height':buied?'360rpx':'450rpx'}">
<image :src="img"/>
<!-- <ImageLoader :defaultSrc="'../../static/imgs/shouyezhanweitu.png'" :realSrc="img" width="100%" height="400rpx"/> -->
<!-- <image :src="img"/> -->
<ImageLoader :defaultSrc="'../../static/imgs/shouyezhanweitu.png'" :realSrc="img" width="100%" height="400rpx"/>
<!-- <video autoplay muted loop :controls="false" :enable-progress-gesture="false" objectFit='cover' src="http://songclound.oss-cn-hongkong.aliyuncs.com/2022/06/27/71d36be0ed966.mp4" /> -->
<!-- <HomeBanner /> -->
<view class="shop-info" :style="'top:100rpx'">
......@@ -97,11 +97,20 @@ export default {
},
created() {
let platform = uni.getSystemInfoSync().platform;
if(platform == 'android'){
this.img = '../../static/imgs/shouyezhanweitu.png'
}else{
this.img = 'https://s3.bmp.ovh/imgs/2022/07/02/2cfab823b35322e3.gif'
uni.downloadFile({
url: 'http://songclound.oss-cn-hongkong.aliyuncs.com/2022/06/27/71d36be0ed966.mp4', //仅为示例,并非真实的资源
success: (res) => {
if (res.statusCode === 200) {
console.log(res);
this.img = res.tempFilePath
}
}
});
// if(platform == 'android'){
// this.img = '../../static/imgs/shouyezhanweitu.png'
// }else{
// this.img = 'https://s3.bmp.ovh/imgs/2022/07/02/2cfab823b35322e3.gif'
// }
},
onLoad: async function () {
uni.getSetting({
......
......@@ -46,10 +46,8 @@ module.exports = (vm) => {
let Authorization = uni.getStorageSync(`Authorization`);
const configUrl = [
'/weixin/login',
'/weixin/getShop',
'/weixin/infoByShop',
'/application/getData',
'/weixin/getArea',
];
if (Authorization && configUrl.indexOf(config.url) == -1) {
config.header.Authorization = Authorization;
......
......@@ -156,7 +156,7 @@ export default {
});
},
setAllow(params) {
uni.$u.http
return uni.$u.http
.post('/system/customer/allow', params)
.then((res) => {
return res;
......@@ -168,4 +168,18 @@ export default {
return err
});
},
// 获取用户订阅消息
getUserMsgInfo(params) {
return uni.$u.http
.get('/system/customer/detail')
.then((res) => {
return res;
})
.catch((err) => {
const {data} = err
const {msg} = data
context.showToast({ title: msg, icon: 'none' });
return err
});
}
};
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment