This commit is contained in:
魏啾
2024-05-27 14:26:14 +08:00
43 changed files with 1087 additions and 239 deletions

View File

@@ -10,7 +10,7 @@
</view>
<view class="addreeStyle">
<image src="https://czg-qr-order.oss-cn-beijing.aliyuncs.com/drder/dingwei.png"
style="width: 17.9rpx;height: 22rpx;margin-right: 6rpx;" mode=""></image>{{info.distances}}km |
style="width: 17.9rpx;height: 22rpx;margin-right: 6rpx;" mode=""></image>{{info.distances}} |
{{info.address}}
</view>
<view class="rightStyle">

View File

@@ -193,7 +193,8 @@
userId: uni.cache.get('userInfo').id,
status: 0,
page: this.form.page,
size: this.form.size
size: this.form.size,
orderId:''
})
try {
this.totalnumber = res.data.total

View File

@@ -35,7 +35,7 @@
{{item.shopName}}
</view>
<view>
龙首.{{item.distances}}km
{{item.distances}}
</view>
</view>
<view class="fivecontent_item_nav_lefttopstart flex-start">

View File

@@ -47,7 +47,7 @@
</image>
<view> {{item.productName}}</view>
</view>
<text class="fivecontent_item_boxitemlefttow_t">{{item.distances}}km</text>
<text class="fivecontent_item_boxitemlefttow_t">{{item.distances}}</text>
</view>
<view class="fivecontent_item_boxitemlefthere flex-start">
<view class="fivecontent_item_boxitemlefthere_one flex-start">

View File

@@ -137,7 +137,7 @@
</view>
</view>
</view>
</view>
</view>
<u-loadmore height='40' :status="form.status" iconSize='24' fontSize='24' />
<!-- </scroll-view> -->

View File

@@ -27,7 +27,7 @@
{{item.address.length>7?item.address.substring(0,7)+'...':item.address}}
</view>
<view class="fivecontent_itemoneboxtow_t">
{{item.distances}}km
{{item.distances}}
</view>
</view>
</view>

View File

@@ -49,7 +49,7 @@
}
},
onLoad(e) {
console.log(e)
console.log(e,'调试')
if (e.type == 'list') {//从列表进来的
this.paygetShopByMember(e.shopId_id)
}else{

View File

@@ -11,9 +11,10 @@
<view class="towcontentitemone flex-start">
<image class="towcontentitemoneimage" :src="item.logo" mode="aspectFill"></image>
<text class="towcontentitemonetext" style="color: #333333;">{{item.chainName}}</text>
<!-- 余额<text class="towcontentitemtheretext">{{userInfo.amount || '0.00'}}</text> -->
</view>
<view class="towcontentitemtow flex-between">
<text class="towcontentitemtowetext" style="color:#333333;">{{item.is_vip}}</text>
<text class="towcontentitemtowetext" style="color:#333333;">余额:{{item.amount}}</text>
<text>{{item.shopName}}</text>
</view>
</view>

View File

@@ -148,9 +148,6 @@
}, 1000)
this.getinfo(e.orderId)
this.orderInfo = JSON.parse(e.orderInfo)
console.log('调试1', e)
console.log('调试2', JSON.parse(e.orderInfo))
console.log('调试3', this.orderInfo)
},
computed: {
HeighT() { //手机类型的尺寸

View File

@@ -82,10 +82,10 @@
<view>
<image src="https://czg-qr-order.oss-cn-beijing.aliyuncs.com/drder/hongbao.png"
style="width: 30rpx;height: 30.24rpx;;" mode=""></image>
红包/低佣
红包/抵用
</view>
<view @click="orderfoodindex">
<!-- {{info.couponDetail.name}} -->
可用优惠券{{couponAmount}}
</view>
</view>
<!-- 支付方式 -->
@@ -118,7 +118,8 @@
</u-radio>
</u-radio-group>
<view style="font-weight: 400;font-size: 24rpx;color: #333333;margin-left: 60rpx;">
会员卡余额{{ amountVIP.amount}} <text style="font-weight: 500;font-size: 28rpx;margin-left: 16rpx;color: #FF4C11;"
会员卡余额{{ amountVIP.amount}} <text
style="font-weight: 500;font-size: 28rpx;margin-left: 16rpx;color: #FF4C11;"
@click="goRecharge">去充值</text>
</view>
</view>
@@ -170,17 +171,23 @@
以优惠¥{{emitorderfoodform.couponsPrice}}
</view>
</view>
<view class="fixedview_tow" @click="showpopupclick">
<view class="fixedview_tow" @click="shopEvent">
立即付款
</view>
</view>
</view>
<!-- 支付密码 -->
<payPassword ref="payPwd" @accountPayevent="accountPayevent" v-show="ispws"></payPassword>
</view>
</template>
<script>
import webSocketUtils from '@/common/js/websocket.js'
import payPassword from '@/components/payPassword.vue'
export default {
components: {
payPassword
},
data() {
return {
height: '',
@@ -197,14 +204,25 @@
amountVIP: null,
radiovalue1: '1',
vipId: null,
orderInfo: ''
orderInfo: '',
// 可用优惠券数据
couponAmount: 0,
// 输入支付密码 123
passwordArr: [],
ispws: false,
numValue: 0
};
},
onUnload() {
uni.$off('getMessage')
// uni.showToast({
// title: this.radiovalue1 + '-110',
// duration:5000
// })
},
onLoad(e) {
// console.log(e, 140)
let res = JSON.parse(e.tableId)
this.listinfo.detailList = res
@@ -213,42 +231,53 @@
this.handlemessage()
uni.$on('message', this.getMessage)
// 获取余额
this.getAount()
// 获取余额
this.getAount()
// 获取可用优惠券数量
this.getcoupon()
this.vipId = uni.cache.get('userInfo').id
},
onShow() {
},
created() {
uni.$on('emitclickorderfood', (num) => {
console.log(num)
// 总金额 couponsAmount 优惠卷购买金额 couponsPrice优惠金额
// 总金额 couponsAmount 优惠卷购买金额 couponsPrice优惠金额 等于1是团购/不等于1
if (num.clickiconone == 1) {
this.listinfo.amount = (Number(this.listinfo.amounts) - Number(num.couponsPrice)).toFixed(2)
this.listinfo.amount = (Number(this.listinfo.amounts) + Number(num.couponsPrice) - Number(num
.couponsAmount)).toFixed(2)
} else {
this.listinfo.amount = (Number(this.listinfo.amounts) + Number(num.couponsAmount) - Number(num
.couponsPrice)).toFixed(2)
this.listinfo.amount = (Number(this.listinfo.amounts) - Number(num.couponsAmount)).toFixed(2)
}
this.emitorderfoodform = num
// this.num += num
})
},
methods: {
async getAount(){
async getcoupon() {
let res = await this.api.userCoupon({
"orderNum": this.listinfo.amount,
"userId": uni.cache.get('userInfo').id,
})
if (res.code == 0) {
this.couponAmount = res.data
}
},
async getAount() {
let res = await this.api.shopUserInfo({
// shopId:店铺ID
"shopId": uni.cache.get('shopUser'),
"userId": uni.cache.get('userInfo').id,
})
if(res.code==0){
if (res.code == 0) {
this.amountVIP = res.data
}
},
getMessage(msg) {
console.log('tiaoshi1', msg)
if (msg.status != 'success') {
uni.showToast({
title: msg.msg,
@@ -260,7 +289,6 @@ this.getAount()
} else {
switch (msg.type) {
case 'createOrder': //去结算
console.log('tiaoshi2', msg)
this.listinfoid = msg.data.id //下单需要的id
this.orderInfo = msg.data
this.showpopupclickdd()
@@ -288,8 +316,8 @@ this.getAount()
orderfoodindex() {
uni.pro.navigateTo('index/coupons/index', {
orderfood: 0,
orderId :this.listinfoid,
amount: this.listinfo.amounts
})
},
copyHandle(e) {
@@ -308,56 +336,51 @@ this.getAount()
orderId: this.listinfoid
})
},
// 防抖去结算
shopEvent(){
uni.$u.throttle(this.showpopupclick, 500)
},
// 去结算
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": uni.cache.get('shopUser'),
"userId": uni.cache.get('userInfo').id,
// tableId:uni.cache.get('tableCode')
if (this.numValue == 0) {
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": uni.cache.get('shopUser'),
"userId": uni.cache.get('userInfo').id,
// tableId:uni.cache.get('tableCode')
}
this.numValue = 1
uni.$u.debounce(this.socketSendMsg(data), 500)
} else {
this.showpopupclickdd()
}
console.log(data)
uni.$u.debounce(this.socketSendMsg(data), 500)
},
// 去充值
goRecharge() {
uni.pro.navigateTo('/pages/member/index')
},
// 余额支付
async accountPayevent(id) {
let res = await this.api.accountPay({
orderId: id,
memberId: this.vipId
uni.pro.navigateTo('/pages/member/index', {
shopId_id: uni.cache.get('shopUser')
})
console.log(res, '调试12')
if (res) {
} else {
setTimeout(() => {
this.goRecharge()
}, 1000)
}
},
async showpopupclickdd(i) {
let res = await this.api.payorderPay({
orderId: this.listinfoid
}) //判断是否支付成功
if (res.code == 0) {
uni.showLoading({
title: '加载中',
mask: true
})
// #ifdef MP-WEIXIN
if (this.radiovalue1 == 1) {
if (this.radiovalue1 == 1) {
let res = await this.api.payorderPay({
orderId: this.listinfoid
}) //判断是否支付成功
if (res.code == 0) {
// uni.showLoading({
// title: '加载中',
// mask: true
// })
// #ifdef MP-WEIXIN
// 微信支付还是余额支付
uni.requestPayment({
provider: 'wxpay', //支付类型-固定值
partnerid: res.data.appId, // 微信支付商户号
@@ -370,7 +393,7 @@ this.getAount()
uni.showToast({
title: "支付成功"
})
uni.cache.set('shopUser','')//删除shopUser
uni.cache.set('shopUser', '') //删除shopUser
this.paymodfiyOrderInfo()
setTimeout(res => {
uni.redirectTo({
@@ -385,31 +408,75 @@ this.getAount()
// });
},
fail: (err) => {
setTimeout(() => {
uni.showToast({
icon: 'none',
title: '支付失败'
})
uni.hideLoading()
}, 2000)
uni.redirectTo({
url: '/pages/order/order_detail?orderId=' + this.listinfoid
});
// uni.redirectTo({
// url: '/pages/order/order_detail?orderId=' + this.listinfoid
// });
},
complete: (data) => {
console.log(data, '成功与否')
}
});
} else {
this.accountPayevent(this.listinfoid)
// #endif
}
} else {
// 判断是否有绑定支付密码
// 先判断是否设置支付密码。0是没设置。没设置的情况下跳转到设置页面。有的话输入支付密码
let isVip = uni.cache.get('userInfo').isPwd
if (isVip == 0) {
uni.pro.navigateTo('/pages/user/repairpassword', {
shopId_id: uni.cache.get('shopUser')
})
} else {
this.ispws = true
this.$nextTick(() => {
this.$refs.payPwd.onPayUp();
})
}
// #endif
}
},
// 余额支付
async accountPayevent(pwd) {
this.ispws = false
let res = await this.api.accountPay({
orderId: this.listinfoid,
memberId: this.amountVIP.id,
pwd: pwd
})
if (res.code == 0) {
uni.showToast({
icon: 'none',
title: '支付成功',
success: () => {
setTimeout(res => {
uni.redirectTo({
url: '/pages/order/successful?orderId=' + this
.listinfoid + '&orderInfo=' + JSON.stringify(
this.orderInfo)
});
}, 1000)
}
})
} else if (res.data == 1) {
setTimeout(() => {
// 去充值
this.goRecharge()
}, 2000)
}
},
clickselect(b) {
this.pay_type = b
},
},
mounted() {
//#ifdef MP-WEIXIN || H5

View File

@@ -17,7 +17,7 @@
<image class="contentitemthere_image"
src="https://czg-qr-order.oss-cn-beijing.aliyuncs.com/product/d.png" mode="aspectFill"></image>
<view class="contentitemthere_t">
距您{{item.distances}}km<text v-if="item.address">,{{item.address}}</text>
距您{{item.distances}}<text v-if="item.address">,{{item.address}}</text>
</view>
<u-icon name="arrow-right" color="#999999" size="28"></u-icon>
</view>

View File

@@ -467,6 +467,7 @@
bottom: 0;
left: 0;
width: 100%;
height: 180rpx;
padding: 24rpx 28rpx;
background: #FFFFFF;
z-index: 999;

View File

@@ -31,7 +31,7 @@
<view>
<image src="https://czg-qr-order.oss-cn-beijing.aliyuncs.com/drder/hongbao.png"
style="width: 30rpx;height: 30.24rpx;;" mode=""></image>
红包/低佣
红包/抵用
</view>
<view>
{{info.couponDetail.name}}
@@ -40,16 +40,16 @@
<view style="background-color: #F6F6F6;height: 2rpx;width: 100%;margin: 16rpx 0;"></view>
<view class="jiesuanmoney">
<text>
优惠<text style="color: #FF4C11;font-weight: 500;">{{info.save * Quantity}}</text>
优惠<text style="color: #FF4C11;font-weight: 500;">{{calculateEvent(info.save)}}</text>
</text>
<text>
小计<text style="color: #FF4C11;font-weight: 500;">{{info.salePrice * Quantity}}</text>
小计<text style="color: #FF4C11;font-weight: 500;">{{calculateEvent(info.salePrice) }}</text>
</text>
</view>
</view>
<!-- 支付方式 -->
<view class="payType" v-if="false">
<view class="payType" >
<view class="">
支付方式
</view>
@@ -65,9 +65,8 @@
</text>
</view>
</u-radio>
<view style="margin: 22rpx 0;width: 100%;height: 2rpx;background-color: #E5E5E5;">
</view>
<u-radio activeColor="#ffd158" name="2">
<view style="margin: 22rpx 0;width: 100%;height: 2rpx;background-color: #E5E5E5;" v-if="info.isUseVip==1"> </view>
<u-radio activeColor="#ffd158" name="2" v-if="info.isUseVip==1">
<view class="dfs">
<image style="width:44rpx;height:44rpx"
src="https://czg-qr-order.oss-cn-beijing.aliyuncs.com/drder/wechat.png" mode="">
@@ -77,31 +76,41 @@
</view>
</u-radio>
</u-radio-group>
<view style="font-weight: 400;font-size: 24rpx;color: #333333;">
会员卡余额${{ amount}} <text style="font-weight: 500;font-size: 28rpx;color: #FF4C11;"
<view style="font-weight: 400;font-size: 24rpx;color: #333333;margin-left: 60rpx;" v-if="info.isUseVip==1">
会员卡余额{{ amountVIP.amount}} <text
style="font-weight: 500;font-size: 28rpx;margin-left: 16rpx;color: #FF4C11;"
@click="goRecharge">去充值</text>
</view>
</view>
</view>
<view class="placeBottom">
<view class="">
<text style="font-size: 24rpx;font-weight: bold;"> 合计 </text><text
style="font-size: 32rpx;font-weight: bold;color:#FF4C11"> {{info.salePrice * Quantity}} </text>
style="font-size: 32rpx;font-weight: bold;color:#FF4C11"> {{calculateEvent(info.salePrice)}}
</text>
<text style="font-size: 24rpx;font-weight: 400;color: # 999;">含优惠卷包0</text>
</view>
<view class="">
{{Quantity}} 已优惠{{info.save * Quantity}}
{{Quantity}} 已优惠{{calculateEvent(info.save) }}
</view>
<button class="btnStyle" @click="sumbitFrom">提交订单</button>
<button class="btnStyle" @click="sumbitFroms">提交订单</button>
</view>
<payPassword ref="payPwd" @accountPayevent="accountPayevent" v-show="ispws"></payPassword>
</view>
</template>
<script>
import payPassword from '@/components/payPassword.vue'
export default {
components: {
payPassword
},
onLoad(e) {
this.getInfo(e.id)
this.orderIds= e.id
this.orderIds = e.id
this.amount = uni.cache.get('userInfo').amount
this.vipId = uni.cache.get('userInfo').id
},
@@ -111,37 +120,101 @@
Quantity: 1,
radiovalue1: '1',
amount: 0,
orderIds:null,
vipId:null
orderIds: null,
vipId: null,
ispws: false,
amountVIP: null,
listinfoid: null
}
},
methods: {
async getAount() {
let res = await this.api.shopUserInfo({
// shopId:店铺ID
"shopId": this.info.shopId,
"userId": uni.cache.get('userInfo').id
})
if (res.code == 0) {
this.amountVIP = res.data
}
},
// 余额支付
async accountPayevent(pwd) {
this.ispws = false
let res = await this.api.payOrderPay({
orderId: this.listinfoid.id,
payType: "deposit",
pwd
})
if (res.code == 0) {
let orderInfo = {
createdAt:this.listinfoid.createTime,
orderNo:this.listinfoid.orderNo,
orderAmount:this.calculateEvent(this.info.salePrice)
}
uni.showToast({
icon: 'none',
title: '支付成功',
success: () => {
setTimeout(res => {
uni.redirectTo({
url: '/pages/order/successful?orderId=' + this
.listinfoid.id + '&orderInfo=' + JSON.stringify(orderInfo)
});
}, 1000)
}
})
} else if (res.data == 1) {
setTimeout(() => {
// 去充值
this.goRecharge()
}, 2000)
}
},
calculateEvent(d) {
return (d * 1000 * this.Quantity)/1000
},
goRecharge() {
// uni.pro.to
uni.pro.navigateTo('/pages/member/index', {
shopId_id: this.info.shopId
})
},
// 防抖
sumbitFroms(){
uni.$u.throttle(this.sumbitFrom, 500)
},
async sumbitFrom() {
// radiovalue1:为1的时候微信支付,为2是会员卡,需要输入支付密码
if (this.radiovalue1 == 1) {
let payMoney = this.info.salePrice * this.Quantity
let res = await this.api.creatGroupOrder({
num: this.Quantity,
proId: this.info.proId,
shopId: this.info.shopId,
payAmount: payMoney,
orderAmount: payMoney
})
if (res.code == 0) {
let payMoney = this.info.salePrice * this.Quantity
let res = await this.api.creatGroupOrder({
num: this.Quantity,
proId: this.info.proId,
shopId: this.info.shopId,
payAmount: payMoney,
orderAmount: payMoney
})
if (res.code == 0) {
this.listinfoid = res.data
// radiovalue1:为1的时候微信支付,为2是会员卡,需要输入支付密码
if (this.radiovalue1 == 1) {
// 调用支付接口
this.payEvent(res.data.id)
}
}else{
let res = await this.api.accountPay({
orderId: this.orderIds,
memberId:this.vipId
})
if (res.code == 0) {
} else {
// 先判断是否设置支付密码。0是没设置。没设置的情况下跳转到设置页面。有的话输入支付密码
let isVip = uni.cache.get('userInfo').isPwd
if (isVip == 0) {
uni.pro.navigateTo('/pages/user/repairpassword', {
shopId_id: uni.cache.get('shopUser')
})
} else {
this.ispws = true
this.$nextTick(() => {
this.$refs.payPwd.onPayUp();
})
}
}
}
},
async payEvent(id) {
let res = await this.api.payOrderPay({
@@ -150,7 +223,6 @@
orderType: 'group'
})
if (res) {
console.log(res, '调试1')
uni.requestPayment({
provider: 'wxpay', //支付类型-固定值
partnerid: res.data.appId, // 微信支付商户号
@@ -184,6 +256,9 @@
})
if (res.code == 0) {
this.info = res.data
uni.cache.set('shopUser', res.data.shopId);
// 获取余额
this.getAount()
}
}
}
@@ -296,6 +371,12 @@
>view:last-child {
margin-top: 32rpx;
}
.dfs {
display: flex;
align-items: center;
}
}
.placeBottom {

View File

@@ -109,7 +109,8 @@
userId: uni.cache.get('userInfo').id,
status: this.form.statuses,
page: this.form.page,
size: this.form.size
size: this.form.size,
orderId:""
})
if (res.data.pages < this.form.page) {
this.form.status = 'nomore'

View File

@@ -10,7 +10,7 @@
</button> -->
<!-- <image class="onecontentboximage" :src="userHeadImg" mode="" @click="uploadImg"></image> -->
<button type="default" class="btn" open-type="chooseAvatar" @chooseavatar="uploadImg">
<view class="" :style="'background-image:url('+userHeadImg+');'" style="width: 200rxp;height: 200rpx;"></view>
<view class="" :style="'background-image:url('+userHeadImg+');'" style="width: 180rxp;height: 180rpx; background-position: center;"></view>
</button>
@@ -218,13 +218,11 @@
}
}
.btn{
width: 200rpx;
height: 200rpx;
width: 180rpx;
height: 180rpx;
border-radius: 100%;
padding: 0;
>view{
width: 200rpx;
height: 200rpx;
border-radius: 100%;
}
}

View File

@@ -52,6 +52,7 @@
};
},
onLoad() {
if (uni.cache.get('userInfo').isPwd != 0) {
uni.setNavigationBarTitle({
title: '忘记支付密码', // 标题文本,必须是字符串
@@ -84,6 +85,14 @@
}, 60000);
}
},
async loginwxuserInfo() {
let res = await this.api.loginwxuserInfo({
userId: uni.cache.get('userInfo').id
})
if (res.code == 0) {
uni.cache.set('userInfo', res.data);
}
},
async userInfosavePayPassword() {
if (this.form.mobile.length != 11 && this.isPwd == 0) {
@@ -145,6 +154,8 @@
icon: 'none'
});
}
// 获取用户信息
this.loginwxuserInfo()
setTimeout(() => {
uni.navigateBack();
}, 1000);

View File

@@ -23,7 +23,7 @@
<!-- #endif -->
<view class="boxtop_top flex-between">
<view class="boxtop_topleft">
<view class="flex-start" v-if="userInfo.nickName">
<view class="flex-start" v-if="userInfo.nickName" @click="clickinformation">
<image style="width: 108rpx; height: 108rpx; border-radius: 50%;" v-if="userInfo.headImg"
:src="userInfo.headImg" mode="aspectFill">
</image>
@@ -33,7 +33,7 @@
<text>去登录</text>
</view>
</view>
<image style="width: 44rpx; height: 42.26rpx;"
<image style="width: 44rpx; height: 42.26rpx;" @click="clickphone()"
src="https://czg-qr-order.oss-cn-beijing.aliyuncs.com/user/kf.png" mode="aspectFill">
</view>
@@ -99,6 +99,11 @@
}
},
methods: {
clickphone() {
uni.makePhoneCall({
phoneNumber: uni.cache.get('userInfo').custPhone
});
},
clickinformation() {
uni.pro.navigateTo('user/information')
},