更新优化

This commit is contained in:
魏啾
2024-06-14 18:30:19 +08:00
parent 139e4039a5
commit cba4e6065e
20 changed files with 94 additions and 258 deletions

View File

@@ -16,7 +16,6 @@ export default {
accountPay(data) {
return uni.api.get("/pay/accountPay", data);
},
// 下单
creatGroupOrder(data) {
return uni.api.post("/groupOrderInfo/creatGroupOrder", data);

View File

@@ -1,5 +1,5 @@
<template>
<u-image :src="src" :radius="radius" :width="width" :height="height" :fade="false"></u-image>
<u-image :src="src" :radius="radius" :width="width" :height="height" :fade="false" :lazy-load="true" slot="loading"></u-image>
</template>
<script>

View File

@@ -54,9 +54,7 @@
methods: {
// 忘记支付密码
gopaypassword() {
uni.pro.navigateTo('/pages/user/repairpassword', {
// shopId_id: uni.cache.get('shopUser')
})
uni.pro.navigateTo('/pages/user/repairpassword')
},
/**
* 唤起键盘

View File

@@ -66,7 +66,6 @@
return {
banners: [require('@/static/banner1.png')],
footerBanners: [require('@/static/footer_banner1.png')],
shopUser: {},
userInfo: {},
shopInfo:{}
};

View File

@@ -290,7 +290,6 @@
url: '/pages/order_food/order_food'
});
} else {
// uni.cache.set('shopUser', res.data.shopUser);
uni.pro.switchTab('index/index')
}
@@ -341,7 +340,6 @@
uni.cache.set('miniAppOpenId', res.data.userInfo
.miniAppOpenId)
uni.cache.set('userInfo', res.data.userInfo);
// uni.cache.set('shopUser', res.data.shopUser);
if (this.types == 0) {
uni.reLaunch({
url: '/pages/order_food/order_food'

View File

@@ -72,7 +72,6 @@
uni.cache.set('miniAppOpenId', res.data.userInfo
.miniAppOpenId)
uni.cache.set('userInfo', res.data.userInfo);
uni.cache.set('shopUser', res.data.shopUser);
uni.pro.switchTab('index/index')
}
},

View File

@@ -27,7 +27,6 @@
export default {
data() {
return {
shopUser: {},
userInfo: {},
shopInfo:{}
};

View File

@@ -25,7 +25,8 @@
<!-- <image :src="require('')" style="width: 76rpx;height: 76rpx;float: left;" mode=""></image> -->
<view class="listrigth">
<view>{{item.biz_name}}</view>
<view :class="[checkIn(item.biz_code)?'colorStyle':'']">{{checkIn(item.biz_code)?'+':'-'}}{{item.amount}}</view>
<view :class="[item.type == '+'?'colorStyle':'']">{{item.type}}{{item.amount}}
</view>
</view>
<view class="listrigth2">
<view>{{$u.timeFormat(item.create_time, 'yyyy-mm-dd hh:MM:ss')}}</view>
@@ -60,9 +61,9 @@
},
methods: {
// 检测是否包含In
checkIn(str) {
    let reg = RegExp(/In/)
    return str.match(reg)
checkIn(str) {
let reg = RegExp(/In/)
return str.match(reg)
},
async getlist() {
if (this.active == 1) {
@@ -155,9 +156,10 @@
}
.listrigth {
.colorStyle{
.colorStyle {
color: #FF7127;
}
>view {
font-weight: bold;
font-size: 32rpx;

View File

@@ -13,7 +13,7 @@
<text class="towcontentitemtowetext">VIP{{userInfo.code || '无'}}</text>
</view>
<view class="towcontentitevip">
VIP{{userInfo.is_vip}}
VIP{{userInfo.isVip}}
</view>
<image src="https://czg-qr-order.oss-cn-beijing.aliyuncs.com/drder/erweima.png" class="imgStyle" mode=""
@click="clickEvent"></image>

View File

@@ -35,8 +35,6 @@
}
},
onLoad(e) {
console.log(e, '调试2')
this.shopId = e.shopId
if (e.type == 'list') { //从列表进来的
this.paygetShopByMember(e.shopId)
@@ -51,13 +49,13 @@
page: 1,
pageSize: 10,
userId: uni.cache.get('userInfo').id,
shopId: w
shopId: this.shopId
})
this.userInfo = res.data.list[0]
},
async paygetActive(shopid) {
async paygetActive() {
let res = await this.api.paygetActive({
shopId: shopid,
shopId: this.shopId,
page: 1,
pageSize: 10
})
@@ -80,7 +78,11 @@
shopId: this.shopId, // 判断显示哪家的作品,
amount: this.amount // 判断显示哪家的作品,
})
if (res) {
if (res.code == 0) {
uni.showLoading({
title: '加载中',
mask: true
})
// #ifdef MP-WEIXIN
uni.requestPayment({
provider: 'wxpay', //支付类型-固定值
@@ -94,11 +96,16 @@
uni.showToast({
title: "支付成功"
})
uni.hideLoading()
setTimeout(res => {
uni.navigateBack()
}, 500)
},
fail: (res) => {
uni.hideLoading()
}
});
uni.hideLoading()
// #endif
}
},

View File

@@ -40,15 +40,17 @@
size: 10, //页容量
status: 'loadmore',
},
userId:null
userId: uni.cache.get('userInfo').id
}
},
onLoad() {
this.userId = uni.cache.get('userInfo').id
// this.paygetShopByMember()
},
onShow() {
this.paygetShopByMember()
this.list = []
this.form = {
page: 1, //页数
size: 10, //页容量
status: 'loadmore',
},
this.paygetShopByMember()
},
onReachBottom() {
this.paygetShopByMember()
@@ -84,10 +86,8 @@
}
},
eeInfo(item) {
uni.pro.navigateTo('member/memberdetails', {
shopId_id: item.shopId,
type: 'list'
shopId_id: item.shopId
})
},
}

View File

@@ -8,7 +8,7 @@
<text>账单明细</text>
<uni-icons type="right" style="color: #333;" size="20"></uni-icons>
</view>
<view @click="goUrl('member/index')">
<view @click="goUrlinfo('member/index')">
<text>会员充值</text>
<uni-icons type="right" style="color: #333;" size="20"></uni-icons>
</view>
@@ -20,31 +20,26 @@
<script>
import card from './components/card.vue'
export default {
components:{card},
components: {
card
},
data() {
return {
info:null,
shopId_id: null,
inputshow: 0,
memberlist: {},
listdata: [],
amount: '',
shopUser: {},
userInfo: {},
}
},
onLoad(e) {
this.info = e
if (e.type == 'list') { //从列表进来的
this.paygetShopByMember(e.shopId_id)
} else {
this.paygetShopByMember(e.shopId_id)
}
// this.paygetActive() //列表
console.log(e)
this.shopId_id = e.shopId_id
},
onShow() {
this.paygetShopByMember(this.info.shopId_id)
this.paygetShopByMember(this.shopId_id)
},
methods: {
async paygetShopByMember(w) {
@@ -56,71 +51,21 @@
})
this.userInfo = res.data.list[0]
},
async paygetActive() {
let res = await this.api.paygetActive({
shopId: uni.cache.get('shopUser'),
page: 1,
pageSize: 10
})
try {
this.listdata = res.data.list
this.amount = res.data.list[0].minNum
} catch (e) {
//TODO handle the exception
}
},
async userbalancerechangesub() {
if (this.amount == null || this.amount == '') {
uni.showToast({
title: '金额不能为空',
icon: 'none'
});
return false;
}
let res = await this.api.paymemeberIn({
shopId: uni.cache.get('shopUser'), // 判断显示哪家的作品,
amount: this.amount // 判断显示哪家的作品,
})
if (res) {
// #ifdef MP-WEIXIN
uni.requestPayment({
provider: 'wxpay', //支付类型-固定值
partnerid: res.data.appId, // 微信支付商户号
timeStamp: res.data.timeStamp, // 时间戳(单位:秒)
nonceStr: res.data.nonceStr, // 随机字符串
package: res.data.package, // 固定值
signType: res.data.signType, //固定值
paySign: res.data.paySign, //签名
success: (res) => {
uni.showToast({
title: "支付成功"
})
setTimeout(res => {
uni.navigateBack()
}, 1000)
},
fail: (err) => {
uni.showToast({
icon: 'none',
title: '支付失败'
})
setTimeout(res => {
uni.hideLoading()
}, 1000)
}
});
// #endif
}
},
clickinput(a, b) {
console.log(a, b)
this.inputshow = b
this.amount = a.minNum
},
goUrl(url){
uni.pro.navigateTo(url,this.userInfo)
goUrl(url) {
uni.pro.navigateTo(url, this.userInfo)
},
goUrlinfo(url) {
uni.pro.navigateTo(url, {
shopId: this.shopId_id,
type: 'list'
})
}
}
}
</script>

View File

@@ -47,8 +47,6 @@
<text class="status" v-if="item.status == 'unsend'">
<text>待发货</text>
</text>
<text class="status" v-if="item.status == 'closed'">
<text>订单完成</text>
</text>
@@ -62,7 +60,7 @@
<text>退单</text>
</text>
<text class="status" v-if="item.status == 'cancelled'">
<text>取消订单</text>
<text>取消</text>
</text>
<text class="status" v-if="item.status == 'merge'">
<text>合台</text>
@@ -81,8 +79,8 @@
</view> -->
</view>
</view>
<view class="total">
<text class="t">{{item.status == 'unpaid' || item.status == 'paying'?'需':'已'}}付款</text>
<view class="total" v-if="item.status != 'cancelled'">
<text class="t">{{item.description}}</text>
<text class="i"></text>
<text class="num">{{item.orderAmount}}</text>
</view>
@@ -209,6 +207,7 @@
} else {
this.active = (this.tabs.findIndex((item) => item.type == this.useStorage.get('orderType')));
}
this.swiperCurrent = ''
this.init_fn()
},
onReachBottom() {
@@ -354,7 +353,8 @@
position: relative;
background: #FFFFFF;
border-radius: 12rpx;
padding:0 10rpx;
padding: 0 10rpx;
.navtabone {
// margin-left: -10rpx;
width: 166rpx;

View File

@@ -5,7 +5,6 @@
<text class="title">
<text>{{listinfo.name}}</text>
</text>
<text class="status" v-if="listinfo.status == 'unpaid' || listinfo.status == 'paying'">
<text> 待支付 </text>
</text>
@@ -25,7 +24,7 @@
<text>退单</text>
</text>
<text class="status" v-if="listinfo.status == 'cancelled'">
<text>取消订单</text>
<text>取消</text>
</text>
<text class="status" v-if="listinfo.status == 'merge'">
<text>合台</text>
@@ -38,7 +37,8 @@
<text class="tag" v-if="listinfo.sendType == 'takeself'">自提</text>
<text class="tag" v-if="listinfo.sendType == 'table'">堂食</text>
</view>
<view class="number-wrap" v-if="listinfo.status != 'unpaid' && listinfo.status != 'paying'&& listinfo.status != 'cancelled'">
<view class="number-wrap"
v-if="listinfo.status != 'unpaid' && listinfo.status != 'paying'&& listinfo.status != 'cancelled'">
<text class="t">取餐号</text>
<text class="number">{{listinfo.tableName}}</text>
</view>
@@ -48,8 +48,9 @@
<text class="title">
<text>点单详情</text>
</text>
<view style="display: flex;align-items: center;" v-if="listinfo.status == 'unpaid' || listinfo.status == 'paying'">
<view style="display: flex;align-items: center;"
v-if="listinfo.status == 'unpaid' || listinfo.status == 'paying'">
<!-- <text style="font-size:24rpx;">支付时间:</text> -->
<uni-countdown :show-day="false" color="#ff0000" border-color="#00B26A" splitorColor="#000"
:font-size="14" :hour="0" :minute="listinfo.expiredMinutes" :second="listinfo.expiredSeconds" />
@@ -135,12 +136,9 @@
async onLoad(e) {
console.log(e)
this.orderId = e.orderId
this.orderorderInfo()
},
onShow() {
if (this.orderId) {
this.orderorderInfo()
}
this.orderorderInfo()
},
onUnload() {
uni.switchTab({
@@ -196,33 +194,28 @@
signType: res.data.signType, //固定值
paySign: res.data.paySign, //签名
success: (res) => {
uni.hideLoading()
uni.showToast({
title: "支付成功"
})
setTimeout(res => {
uni.hideLoading()
uni.switchTab({
url: '/pages/order/order'
});
}, 2000)
}, 500)
this.paymodfiyOrderInfo()
// uni.redirectTo({
// url: "/pages/mall/order/ordersuccess?id=" + datareslane.data
// .order_id,
// });
},
fail: (err) => {
uni.hideLoading()
uni.showToast({
icon: 'none',
title: '支付失败'
})
setTimeout(res => {
uni.hideLoading()
uni.switchTab({
url: '/pages/order/order'
});
}, 2000)
}, 500)
}
});

View File

@@ -220,7 +220,6 @@
},
onLoad(e) {
// console.log(e, 140)
this.$store.dispatch("set_shopid"); //获取shapid
let res = JSON.parse(e.tableId)
this.listinfo.detailList = res
this.listinfo.amount = e.amount // 算完了的价格

View File

@@ -183,24 +183,6 @@
</template>
<script>
/** 扫码支付逻辑
* 进入该页面调用一次获取用户信息的接口
* 扫码后,未登录去登录
* 登录后链接wx接口拿到列表
* 下单后,通过切换微信\余额两种支付方式
* 余额支付点击立即付款获取userinfo中的字段是否设置支付密码。未设置去设置
* 如果设置发送数据通过wx接口获取creatdorder返回调用支付密码。。。
* 输入完支付密码后,接口返回
* 微信支付
*
*
*
* 接口/pay/accountPay
* 返回 code 都为0
* data -> 1 支付成功
* -> 2 余额不足
* ->3 未设置支付密码前后都做。根据userinfo的ispws做判断的。
**/
import webSocketUtils from '@/common/js/websocket.js'
import payPassword from '@/components/payPassword.vue'
export default {
@@ -231,39 +213,19 @@
},
onUnload() {
// uni.switchTab({
// url: '/pages/order/order'
// })
uni.$off('getMessage')
this.ispws = false
},
onLoad(e) {
this.listinfo = JSON.parse(e.tablelist)
// 获取余额
// this.getAount()
// 获取用户信息,判断是否设置支付密码
this.getuserinfo()
},
onShow() {
// this.$store.dispatch("set_shopid"); //获取shapid
// 获取余额
this.getAount()
this.getuserinfo()
},
methods: {
async getuserinfo() {
let res = await this.api.loginwxuserInfo({
userId: uni.cache.get('userInfo').id
})
if (res.code == 0) {
uni.cache.set('userInfo', res.data);
}
},
groupChange(n) {
this.radiovalue1 = n
uni.cache.set('radiovalue1', n)
},
async getcoupon() {
let res = await this.api.userCoupon({
@@ -276,12 +238,10 @@
},
async getAount() {
let res = await this.api.shopUserInfo({
// shopId:店铺ID
"shopId": this.$store.state.shopId,
"shopId": uni.cache.get('shopUser'),
"userId": uni.cache.get('userInfo').id,
})
if (res.code == 0) {
this.amountVIP = res.data
}
},
@@ -293,35 +253,16 @@
})
this.socketTicket.Close()
uni.$off('getMessage')
console.log(msg, 'socke返回数据')
} else if (msg.type == 'createOrder') {
console.log(msg, 'createOrder执行')
this.listinfoid = msg.data.id //下单需要的id
this.orderInfo = msg.data
if (this.radiovalue1 == 1) {
this.showpopupclickdds() //微信支付
// this.showpopupclickdds() //微信支付
}
}
},
handlemessage() {
console.log(this.socketTicket, 'detail页面')
this.socketTicket ? this.socketTicket.Close() : null //调用前先判断是否有socket正在进行 先关闭后链接
// this.socketTicket = new webSocketUtils(
// `${uni.conf.baseUrlwws}/websocket/table/${uni.cache.get('tableCode')}/${uni.cache.get('shopUser')}/${uni.cache.get('userInfo').id}`,
// 5000)
this.socketTicket = new webSocketUtils(
`${uni.conf.baseUrlwws}`,
5000, {
tableId: uni.cache.get('tableCode'),
shopId: uni.cache.get('shopUser'),
userId: uni.cache.get('userInfo').id,
"type": "connect",
})
},
// 数据处理
socketSendMsg(data) {
if (this.socketTicket) {
@@ -351,54 +292,13 @@
orderId: this.listinfo.id,
})
},
creactorder() {
let data = { //定义socket数据传参
"skuId": '',
"num": '', //数量
"type": "createOrder", //“addcart:添加购物车create0rder:生成订单clearCart:庆康购物车”,
"couponsId": this.emitorderfoodform.id ? this.emitorderfoodform.id : '', //优惠券ID,
"isYhq": this.emitorderfoodform.id ? 1 : 0, // 是否使用优惠券( 1 使用, 0 不使用),
"isBuyYhq": this.emitorderfoodform.clickiconone == 1 ? 1 : 0, // 是否购买优惠券( 1 购买, 0 不够买)
"productId": '', //商品id
"shopId": this.$store.state.shopId,
"userId": uni.cache.get('userInfo').id,
// tableId:uni.cache.get('tableCode')
}
let res = 0
if (res.code == 0) {
this.listinfoid = msg.data.id //下单需要的id
this.orderInfo = msg.data
if (this.radiovalue1 == 1) {
this.showpopupclickdds() //微信支付
}
}
},
// 去结算
showpopupclick() {
let data = { //定义socket数据传参
"skuId": '',
"num": '', //数量
"type": "createOrder", //“addcart:添加购物车create0rder:生成订单clearCart:庆康购物车”,
"couponsId": this.emitorderfoodform.id ? this.emitorderfoodform.id : '', //优惠券ID,
"isYhq": this.emitorderfoodform.id ? 1 : 0, // 是否使用优惠券( 1 使用, 0 不使用),
"isBuyYhq": this.emitorderfoodform.clickiconone == 1 ? 1 : 0, // 是否购买优惠券( 1 购买, 0 不够买)
"productId": '', //商品id
"shopId": this.$store.state.shopId,
"userId": uni.cache.get('userInfo').id,
// tableId:uni.cache.get('tableCode')
}
this.socketSendMsg(data)
},
// 去充值
goRecharge() {
uni.pro.navigateTo('/pages/member/index', {
shopId: this.amountVIP.shopId
shopId: uni.cache.get('shopUser')
})
},
showpopupclickdd() {
// radiovalue1为1是微信支付
if (this.radiovalue1 == 1) {
this.showpopupclickdds() //微信支付
@@ -426,10 +326,10 @@
orderId: this.listinfo.id
}) //判断是否支付成功
if (res.code == 0) {
// uni.showLoading({
// title: '加载中',
// mask: true
// })
uni.showLoading({
title: '加载中',
mask: true
})
// #ifdef MP-WEIXIN
// 微信支付还是余额支付
uni.requestPayment({
@@ -451,14 +351,19 @@
uni.cache.set('shopUser', '') //删除shopUser
_this.paymodfiyOrderInfo()
uni.redirectTo({
url: '/pages/order/order_detail?orderId=' + _this
url: '/pages/order/order_detail?orderId=' +
_this
.listinfo.id
});
},
})
},
fail: () => {
uni.hideLoading()
}
});
// #endif
uni.hideLoading()
}
},
// 余额支付

View File

@@ -1,5 +1,9 @@
<template>
<view id="wrapper">
<view v-if="fixedtrue"
style="height: 100vh; width: 100%; position: fixed; z-index: 999; top: 0; left: 0; background-color: #fff; display: flex; justify-content: center; align-items: center;">
<u-loadmore status="loading" fontSize="50" iconSize="30"/>
</view>
<view class="nav-wrap" :class="{ 'is-fixed': isFixed }"
:style="{ paddingTop: `${menuInfo.top}px`, paddingBottom: `${paddingBtmSize}px` }">
<view class="content" :style="{ height: `${menuInfo.height}px`, paddingLeft: `${paddingBtmSize}px` }">
@@ -103,7 +107,7 @@
mode="aspectFit" @click="showCart = !showCart">
</image>
<text class="i"></text>
<text class="num">{{cartLists.amount}}</text>
<text class="num">{{cartLists.amount||'0.00'}}</text>
</view>
<view class="btn" @tap="$u.debounce(orderdetail, 500)">
<text class="t">提交订单</text>
@@ -254,7 +258,8 @@
socketTicket: null,
amountcartNumber: 0,
skuidsearch: '', //
salePrice: '' //钱数
salePrice: '' ,//钱数
fixedtrue:true
};
},
onPageScroll(e) {
@@ -312,8 +317,6 @@
code: uni.cache.get('tableCode')
})
if (res.code == 0) {
let time = new Date
console.log(time, '时间戳')
uni.cache.set('shopUser', res.data)
this.handlemessage()
this.productqueryProduct() //list 数据
@@ -372,10 +375,6 @@
});
break;
case 'queryCart': //待提交
// let queryCart = JSON.stringify(msg.data)
// uni.pro.navigateTo('order_detail/order_detail', {
// tableId: JSON.stringify(msg.data)
// })
uni.redirectTo({
url: '/pages/order_detail/order_detail?tableId=' + JSON.stringify(msg.data) +
'&amount=' + msg.amount
@@ -389,9 +388,6 @@
if (item.skuId == this.skuidsearch) {
nums = item.number
}
// else {
// this.$set(this, 'amountcartNumber', 0)
// }
})
this.$set(this, 'amountcartNumber', nums)
} else {
@@ -500,6 +496,7 @@
})
if (res.code == 0) {
this.shopList = res.data
this.fixedtrue = false
this.$nextTick(() => {
this.countTitleTopNum();
});
@@ -606,7 +603,6 @@
"shopId": uni.cache.get('shopUser'),
"userId": uni.cache.get('userInfo').id,
}
this.$store.dispatch("set_shopid"); //获取shapid
uni.$u.debounce(this.socketSendMsg(data), 500)
},
orderfoodindex() {

View File

@@ -186,8 +186,6 @@
</view> -->
</view>
</view>
<!-- <view class="bottomcontent flex-between">
<view class="bottomcontent_texttop flex-start">
附近推荐

View File

@@ -129,10 +129,10 @@
}
},
methods: {
async getAount() {
async getAount(shopUser) {
let res = await this.api.shopUserInfo({
// shopId:店铺ID
"shopId": this.$store.state.shopId,
"shopId": shopUser,
"userId": uni.cache.get('userInfo').id
})
if (res.code == 0) {
@@ -161,7 +161,8 @@
setTimeout(res => {
uni.redirectTo({
url: '/pages/order/successful?orderId=' + this
.listinfoid.id + '&orderInfo=' + JSON.stringify(orderInfo)+'&radiovalue1=' + this.radiovalue1
.listinfoid.id + '&orderInfo=' + JSON.stringify(
orderInfo) + '&radiovalue1=' + this.radiovalue1
});
}, 1000)
}
@@ -258,9 +259,8 @@
})
if (res.code == 0) {
this.info = res.data
uni.cache.set('shopUser', res.data.shopId);
// 获取余额
this.getAount()
this.getAount(res.data.shopId)
}
}
}

View File

@@ -194,7 +194,6 @@
} catch (e) {}
},
clickinfo(item, index) {
console.log(item, '调试121')
switch (item.jumpType) {
case 'scan': //特殊处理点击
switch (item.value) {