支付接口调用

This commit is contained in:
duan
2024-05-21 16:59:31 +08:00
parent 07a6425ec4
commit 75ac4e967c
20 changed files with 512 additions and 245 deletions

View File

@@ -12,6 +12,10 @@ export default {
getproductorderConfirm(data) {
return uni.api.get("/product/orderConfirm", data);
},
// 会员支付
accountPay(data) {
return uni.api.get("/pay/accountPay", data);
},
// 下单
creatGroupOrder(data) {
return uni.api.post("/groupOrderInfo/creatGroupOrder", data);
@@ -63,6 +67,14 @@ export default {
paymodfiyOrderInfo(data) { //查询订单支付状态
return uni.api.post("/pay/modfiyOrderInfo", data);
},
// 优惠加倍
yhqDouble(data) { //查询订单支付状态
return uni.api.post("/order/yhqDouble", data);
},
// 优惠卷详情
getYhqDouble(data) { //通过选中的商品规格查询价格
return uni.api.get("/order/getYhqDouble", data);
},
productqueryProductSku(data) { //通过选中的商品规格查询价格
return uni.api.get("/product/queryProductSku", data);
},

View File

@@ -69,7 +69,7 @@
},
activeBackgroundColor: {
type: String,
default: '#fff'
default: 'rgba(0,0,0,0)'
},
label: {
type: String,
@@ -169,10 +169,11 @@
.nav-left-item {
padding: 10rpx 0;
font-size: 14px;
font-size: 28rpx;
display: flex;
align-items: center;
justify-content: center;
color: #666;
}
.nav-right {

View File

@@ -4,9 +4,11 @@ const proxyApi = "/api"
// #endif
// #ifdef MP-WEIXIN || APP
// const proxyApi = 'http://192.168.2.133:9889/cashierService' // 王伟
// const proxyApi = 'http://101.37.12.135:9889/cashierService' // 帆哥
// const proxyApi = 'http://192.168.2.74:9888/cashierService' // 帆哥
const proxyApi = 'https://wxcashiertest.sxczgkj.cn/cashierService' // 测试
const proxyApiwws = 'ws://wxcashiertest.sxczgkj.cn/cashierService' // 测试
// const proxyApiwws = 'ws://192.168.2.74:9888/cashierService' // 测试
const proxyApiwws = 'wss://wxcashiertest.sxczgkj.cn/cashierService' // 测试
// #endif
// #ifdef H5
@@ -14,13 +16,15 @@ const baseUrl = debug ? proxyApi : "https://wxcashiertest.sxczgkj.cn/cashierServ
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/cashierService' // 线上
// const baseUrl = debug ? proxyApi : 'https://cashier.sxczgkj.cn/cashierService'// 线上
// const baseUrlwws = debug ? proxyApiwws : 'wss://cashier.sxczgkj.cn/cashierService' // 线上
const baseUrl = 'https://wxcashiertest.sxczgkj.cn/cashierService'// 测试
const baseUrlwws ='wss://wxcashiertest.sxczgkj.cn/cashierService' // 测试
// #endif
// import VConsole from "./vConsole.js"
// if (debug) {
// // new VConsole()
// new VConsole()
// }
const version = '100'
const autoRemoveCache = {

View File

@@ -75,6 +75,8 @@ async function request(options) {
token: uni.cache.get('token'),
openId: uni.cache.get('miniAppOpenId'),
id: uni.cache.get('userInfo').id,
loginName:"",
clientType:''
}
} else {

View File

@@ -3,15 +3,15 @@
<view class="fontStyle">
<image src="https://czg-qr-order.oss-cn-beijing.aliyuncs.com/drder/Meituanquan.png"
style="width: 39.46rpx;height: 40rpx;" mode=""></image>
<text>美团</text>
<text>优惠</text>
</view>
<view class="content">
{{info.expDate}}
</view>
<button v-if="info.refundAble=='1'" class="buttonStyle" @click="makephone(info.phone)">申请退款</button>
<view style="height: 2rpx;width: 100%;background-color: #EFEFEF;margin-top: 16rpx;"> </view>
<view class="rightStyle" v-for="(item,i) in info.coupons" >
<text>
<view class="rightStyle" v-for="(item,i) in info.coupons">
<text :class="[item.isRefund==1?'tdl':'' ]">
{{item.couponNo}}
</text>
<image src="https://czg-qr-order.oss-cn-beijing.aliyuncs.com/drder/QRcode.png" v-if="info.status=='unused'"
@@ -102,4 +102,9 @@
justify-content: @start;
align-items: @position;
}
.tdl {
color: #999;
text-decoration: line-through
}
</style>

View File

@@ -32,7 +32,7 @@
<view style="height: 100rpx;" v-if="listinfo.status == 'unpaid'"> </view>
<!-- 待支付按钮 -->
<view class="payBox" v-if="listinfo.status == 'unpaid'">
<button @click="payEvent" class="payStyle">立即支付</button>
<button @click="payEvent" class="payStyle">立即支付</button>
</view>
<!-- 二维码展示 -->
<view class="qrimg" v-if="isQrimg" @click="clickEvent">
@@ -90,11 +90,11 @@
if (res) {
uni.requestPayment({
provider: 'wxpay', //支付类型-固定值
partnerid: res.data.payAppId, // 微信支付商户号
timeStamp: res.data.payTimeStamp, // 时间戳(单位:秒)
nonceStr: res.data.paynonceStr, // 随机字符串
package: res.data.payPackage, // 固定值
signType: res.data.paySignType, //固定值
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({
@@ -115,7 +115,9 @@
}
},
clickEvent() {
this.qrValue = this.qrEvent()
this.qrValue =this.listinfo.coupons[0].couponNo
console.log(this.listinfo.coupons[0].couponNo)
// this.qrValue = this.qrEvent()
this.isQrimg = !this.isQrimg
},
qrR(e) {
@@ -182,7 +184,7 @@
bottom: 0%;
left: 50%;
transform: translate(-50%);
.payStyle {
background-color: #fe7620;

View File

@@ -2,11 +2,10 @@
<view class="onecontent flex-between">
<view class="onecontentleft">
现有<text style="color: #FC851E;font-size: 24rpx;">
{{bannervo.coupons==null?116:bannervo.coupons}}
</text>
{{bannervo.coupons==null?116:bannervo.coupons}}
</text>
已免单
</view>
<view class="onecontentright flex-start">
<view class="onecontentrightimage">
<view class="swiperPanel" @touchstart="startMove" @touchend="endMove">
@@ -112,7 +111,7 @@
// newList.push(newList[0])
// newList.splice(0, 1)
// }
this.$emit('changeValue',newList);
this.$emit('changeValue', newList);
this.$forceUpdate();
}
@@ -123,7 +122,7 @@
<style scoped lang="scss">
.onecontent {
position: relative;
margin-top: -30rpx;
margin-top: -34rpx;
padding: 14rpx 28rpx 44rpx 28rpx;
width: 100%;
background: linear-gradient(92deg, #FCECAA 0%, #fff 100%);
@@ -134,6 +133,9 @@
font-weight: 700;
font-size: 24rpx;
color: #333333;
display: flex;
align-items: center;
justify-content: center;
text {
color: #FC851E;
@@ -147,7 +149,9 @@
font-weight: 400;
font-size: 24rpx;
color: #333333;
display: flex;
align-items: center;
justify-content: center;
.onecontentrightimage {
width: 65rpx;

View File

@@ -252,7 +252,7 @@
.therecontent_box_imge_right {
font-family: Source Han Sans CN, Source Han Sans CN;
font-weight: 500;
// font-weight: 500;
font-size: 24rpx;
color: #666666;
}

View File

@@ -53,7 +53,7 @@
<image :src="item.image" mode=""></image>
<view class="fivecontent_item_boxitemleft flex-colum-start">
<view class="fivecontent_item_boxitemleftone flex-between">
<view>{{item.productName}}</view>
<view>{{item.productName.length>7?item.productName.substring(0,7)+'...':item.productName}}</view>
<text>已抢{{item.realSalesNumber}}</text>
</view>
<view class="flex-start flexstartboxfttow">
@@ -577,10 +577,18 @@
.indexboxitemlefttheretext {
// width: 100%;
margin-top: 12rpx;
align-items: flex-end;
// align-items: flex-end;
display: flex;
justify-content: center;
align-items: center;
.fivecontent_item_boxitemlefthere_one {
align-items: flex-end;
display: flex;
justify-content: center;
align-items: center;
.flex_startone {
font-family: Source Han Sans CN, Source Han Sans CN;

View File

@@ -34,25 +34,25 @@
<view class="towcontentoneboxswiper">
<view class="swiper-item" style="margin-bottom: 32rpx;">
<view class="swiper_itemone">
金额
免单状态
</view>
<view class="swiper_itemtow">
订单号
</view>
<view class="swiper_itemthere">
免单状态
金额
</view>
</view>
<view class="swiperitem" v-for="(item,index) in ordermineWinnerList" :key="index">
<view class="swiper-item" style="margin-top: 32rpx;">
<view class="swiper_itemone">
{{item.orderAmount}}
{{item.isRefund == true ? '已免单':'待免单'}}
</view>
<view class="swiper_itemtow">
{{item.orderNo}}
</view>
<view class="swiper_itemthere">
{{item.isRefund == true ? '已免单':'待免单'}}
{{item.orderAmount}}
</view>
</view>
</view>

View File

@@ -54,7 +54,7 @@
<view class="fourcontent_item flex-start" v-for="(item,index) in hometoplist.menu" :key="index"
@click="viewHistory(item,index)"
:class="!item.isChild && viewHistoryindex == index ? 'fourcontent_itemactev':''">
<text style="margin-right: 16rpx;">{{item.name}}</text>
<text style="margin-right: 10rpx;">{{item.name}}</text>
<u-icon v-if="item.isChild" style="margin-left: 10rpx;" name="arrow-down-fill" color="#333333"
size="16"></u-icon>
</view>
@@ -708,7 +708,7 @@
}
.fourcontent_itemactev {
background: #fee06a;
// background: #fee06a;
}
.fourcontent_item:nth-child(1) {
@@ -745,14 +745,14 @@
margin-top: 16rpx;
font-family: Source Han Sans CN, Source Han Sans CN;
font-weight: 400;
font-size: 24rpx;
color: #666666;
font-size: 28rpx;
color: #333;
}
.sixcontentitemP_itemactive {
font-family: Source Han Sans CN, Source Han Sans CN;
font-weight: bold;
font-size: 24rpx;
font-size: 28rpx;
color: #666666;
}
}
@@ -844,8 +844,8 @@
text {
font-family: Source Han Sans CN, Source Han Sans CN;
font-weight: 700;
font-size: 28rpx;
// font-weight: 700;
font-size: 24rpx;
color: #999999;
}

View File

@@ -65,8 +65,8 @@
}
},
onLoad(e) {
this.shopUser = uni.cache.get('shopUser')
this.userInfo = uni.cache.get('userInfo')
// this.shopUser = uni.cache.get('shopUser')
// this.userInfo = uni.cache.get('userInfo')
},
methods: {
async userbalancerechangesub() {

View File

@@ -2,10 +2,10 @@
<view>
<view class="navtab flex-center">
<view class="navtabpost flex-center">
<view :class="navtabindex == 0 ? 'navtabone':'navtabtow'" @click="navtabclick(0)">
<view :class="navtabindex == 0 ? 'navtabone':'navtabtow'" style="border-radius: 12rpx 0 0 12rpx;" @click="navtabclick(0)">
团购订单
</view>
<view :class="navtabindex == 1 ? 'navtabone':'navtabtow'" @click="navtabclick(1)">
<view :class="navtabindex == 1 ? 'navtabone':'navtabtow'" style="border-radius: 0 12rpx 12rpx 0;" @click="navtabclick(1)">
到店订单
</view>
</view>
@@ -297,7 +297,7 @@
this.form.status = 'loading';
this.form.page = ++this.form.page;
setTimeout(() => {
this.list = [...this.list, ...res.data];
this.list = [...this.list, ...res.data.list];
this.form.status = 'loading';
if (res.data.pageNum == res.data.pages) {
this.form.status = 'nomore';
@@ -355,11 +355,11 @@
position: relative;
.navtabone {
margin-left: -10rpx;
// margin-left: -10rpx;
width: 162rpx;
height: 56rpx;
background: #FFEAB1;
border-radius: 12rpx 12rpx 12rpx 12rpx;
// border-radius: 12rpx 0 0 12rpx;
font-family: Source Han Sans CN, Source Han Sans CN;
font-weight: 500;
font-size: 28rpx;
@@ -370,18 +370,18 @@
}
.navtabtow {
margin-left: -10rpx;
// margin-left: -10rpx;
z-index: 9;
width: 166rpx;
height: 56rpx;
line-height: 56rpx;
text-align: center;
background: #FFFFFF;
border-radius: 12rpx 12rpx 12rpx 12rpx;
// border-radius: 0 12rpx 12rpx 0;
font-family: Source Han Sans CN, Source Han Sans CN;
font-weight: 400;
font-size: 24rpx;
color: #666666;
line-height: 56rpx;
text-align: center;
}
}
}

View File

@@ -15,14 +15,14 @@
</view>
<view class="towcontent">
<view class="towcontentone">
75.00
{{orderinfo.couponsPrice}}
</view>
<view class="towcontentow flex-between">
<view class="towcontentow_O">
订单编号
</view>
<view class="towcontentow_T">
94789546123301
{{orderinfo.orderId}}
</view>
</view>
<view class="towcontentow flex-between">
@@ -30,7 +30,7 @@
下单时间
</view>
<view class="towcontentow_T">
2023-05-16 13:20:12
{{orderinfo.createTime}}
</view>
</view>
<view class="towcontentow flex-between">
@@ -49,22 +49,22 @@
<view class="towcontenthereimage flex-colum">
<view class="towcontenthereimageone">
<text style="font-size:28rpx; color: #FF7C0D;"></text>
30.00
{{orderinfo.couponsAmount}}
</view>
<view class="towcontenthereimagetow">
通用红包券
</view>
<view class="towcontenthereimagethere">
有效至 2024 07 11
有效至 {{orderinfo.endTime}}
</view>
<view class="towcontenthereimagefour">
限时红包变大 快来领取
</view>
<view class="towcontenthereimagefive flex-between">
<view class="towcontenthereimagefiveone">
<view class="towcontenthereimagefiveone" @click="wantEvent">
我在想想
</view>
<view class="towcontenthereimagefivetow">
<view class="towcontenthereimagefivetow" @click="DoublingEvent">
马上翻倍
</view>
</view>
@@ -84,6 +84,7 @@
data() {
return {
titlename: '支付详情',
orderId:"",
opacitys: false,
towcontentclickindex: 0,
windowHeight: '',
@@ -101,6 +102,7 @@
name: '饮品小吃'
}
],
orderinfo:null,
form: {
address: '', //地址
type: '', //品类
@@ -124,10 +126,13 @@
this.isFixedTop = false
}
},
onLoad() {
onLoad(e) {
console.log('调试',e)
this.orderId = e.orderId
setTimeout(() => {
this.GetTop()
}, 1000)
this.getinfo(e.orderId)
},
computed: {
HeighT() { //手机类型的尺寸
@@ -135,6 +140,25 @@
},
},
methods: {
async getinfo(id){
let res = await this.api.getYhqDouble({
orderId:id
})
console.log('调试1',res)
if(res.code==0){
this.orderinfo= res.data
}
},
wantEvent(){
uni.redirectTo({
url: '/pages/index/index'
});
},
async DoublingEvent(){
let res = await this.api.yhqDouble({
conponsId: this.listinfoid
})
},
//G滚动底部
loadMore(e) {
console.log(e)

View File

@@ -78,7 +78,43 @@
<text style="color: red;">{{emitorderfoodform.couponsPrice}}</text>
</view>
</view>
<view class="sixcontent" v-if="listinfo.status == 'unpaid'">
<!-- 支付方式 -->
<view class="payType">
<view class="">
支付方式
</view>
<view class="">
<u-radio-group v-model="radiovalue1" iconPlacement="right" :size="28" placement="column">
<u-radio activeColor="#ffd158" name="1">
<view class="dfs">
<image style="width:44rpx;height:44rpx"
src="https://czg-qr-order.oss-cn-beijing.aliyuncs.com/drder/balance.png" mode="">
</image>
<text style="font-size: 28rpx;margin-left: 16rpx;">
微信支付
</text>
</view>
</u-radio>
<view style="margin: 22rpx 0;width: 100%;height: 2rpx;background-color: #E5E5E5;">
</view>
<u-radio activeColor="#ffd158" name="2">
<view class="dfs">
<image style="width:44rpx;height:44rpx"
src="https://czg-qr-order.oss-cn-beijing.aliyuncs.com/drder/wechat.png" mode="">
</image>
<text style="font-size: 28rpx;margin-left: 16rpx;">
会员卡支付</text>
</view>
</u-radio>
</u-radio-group>
<view style="font-weight: 400;font-size: 24rpx;color: #333333;">
会员卡余额{{ amountVIP}} <text style="font-weight: 500;font-size: 28rpx;color: #FF4C11;"
@click="goRecharge">去充值</text>
</view>
</view>
</view>
<!-- <view class="sixcontent" >
<view class="sixcontentone flex-between">
<view class="sixcontent_one">
支付方式
@@ -96,7 +132,7 @@
</view>
</view>
<!-- <view class="sixcontenttowitem flex-between" @click="clickselect(2)">
<view class="sixcontenttowitem flex-between" @click="clickselect(2)">
<view class="sixcontenttowitemone flex-start">
<u-icon name="zhifubao" color="#999999" size="26"></u-icon>
<text class="sixcontenttowitemonetext">余额支付</text>
@@ -105,31 +141,31 @@
<u-icon v-if="pay_type == 2" name="checkmark-circle-fill" color="#333333" size="26"></u-icon>
<u-icon v-else name="checkmark-circle-fill" color="#999999" size="26"></u-icon>
</view>
</view> -->
</view>
</view>
<view :style="{height:height}">
</view>
</view>
</view> -->
<view :style="{height:height}">
</view>
<view class="fixedview">
<view class="flex-between">
<view class="fixedview_one flex-start">
<view class="fixedview_oneone">
实付金额
</view>
<view class="fixedview_onetow">
<text>¥</text>{{listinfo.amount}}
</view>
<view class="fixedview_onethere" v-if="emitorderfoodform.couponsPrice">
以优惠¥{{emitorderfoodform.couponsPrice}}
</view>
</view>
<view class="fixedview">
<view class="flex-between">
<view class="fixedview_one flex-start">
<view class="fixedview_oneone">
实付金额
</view>
<view class="fixedview_tow" @click="showpopupclick">
立即付款
<view class="fixedview_onetow">
<text>¥</text>{{listinfo.amount}}
</view>
<view class="fixedview_onethere" v-if="emitorderfoodform.couponsPrice">
以优惠¥{{emitorderfoodform.couponsPrice}}
</view>
</view>
<view class="fixedview_tow" @click="showpopupclick">
立即付款
</view>
</view>
</view>
</view>
</template>
<script>
@@ -139,7 +175,7 @@
return {
height: '',
pay_type: 1,
info: {},
listinfoid: '',
listinfo: {
detailList: [],
amount: '',
@@ -147,22 +183,29 @@
},
emitorderfoodform: {
clickiconone: ''
}
},
amountVIP:0,
radiovalue1: '1',
vipId:null,
};
},
onUnload() {
uni.$off('createOrdermessage')
uni.$off('getMessage')
},
onLoad(e) {
console.log(e, 140)
// console.log(e, 140)
let res = JSON.parse(e.tableId)
// .toFixed(2)
this.listinfo.detailList = res
this.listinfo.amount = e.amount
this.listinfo.amounts = e.amount
this.listinfo.amount = e.amount // 算完了的价格
this.listinfo.amounts = e.amount //本来的价格
this.handlemessage()
// uni.$on('createOrdermessage', this.creategetMessage)
uni.$on('message', this.getMessage)
this.amountVIP = uni.cache.get('userInfo').amount
this.vipId = uni.cache.get('userInfo').id
},
onShow() {
@@ -182,18 +225,21 @@
})
},
methods: {
creategetMessage(msg) {
getMessage(msg) {
console.log('tiaoshi1', msg)
if (msg.status != 'success') {
uni.showToast({
title: msg.msg,
icon: "none",
})
this.socketTicket.Close()
uni.$off('createOrdermessage')
uni.$off('getMessage')
return false;
} else {
switch (msg.type) {
case 'createOrder': //去结算
console.log('tiaoshi2', msg)
this.listinfoid = msg.data.id //下单需要的id
this.showpopupclickdd()
// let item = JSON.stringify(msg.data)
// uni.redirectTo({
@@ -206,7 +252,7 @@
handlemessage() {
this.socketTicket ? this.socketTicket.Close() : null //调用前先判断是否有socket正在进行 先关闭后链接
this.socketTicket = new webSocketUtils(
`${uni.conf.baseUrlwws}/websocket/table/${this.tableCode}/${uni.cache.get('shopUser')}/${uni.cache.get('userInfo').id}`,
`${uni.conf.baseUrlwws}/websocket/table/${uni.cache.get('tableCode')}/${uni.cache.get('shopUser')}/${uni.cache.get('userInfo').id}`,
5000)
},
@@ -223,14 +269,6 @@
})
},
async ordercreatOrder() {
let res = await this.api.ordercreatOrder({
tableId: this.info.tableId,
shopId: this.info.shopId,
userId: this.info.userId
})
this.listinfo = res.data
},
copyHandle(e) {
uni.setClipboardData({
data: e,
@@ -244,30 +282,42 @@
},
async paymodfiyOrderInfo() {
let res = await this.api.paymodfiyOrderInfo({
orderId: this.listinfo.id
orderId: this.listinfoid
})
},
// 去结算
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
}
console.log(data)
uni.$u.debounce(this.socketSendMsg(data), 500)
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')
}
console.log(data)
uni.$u.debounce(this.socketSendMsg(data), 500)
},
async showpopupclickdd() {
// 余额支付
async accountPayevent(id){
let res = await this.api.accountPay({
orderId: id,
memberId:this.vipId
})
console.log(res,'调试12')
if (res.code == 0) {
}
},
async showpopupclickdd(i) {
let res = await this.api.payorderPay({
orderId: this.listinfo.id,
orderId: this.listinfoid
}) //判断是否支付成功
if (res.code == 0) {
uni.showLoading({
@@ -275,43 +325,48 @@
mask: true
})
// #ifdef MP-WEIXIN
uni.requestPayment({
provider: 'wxpay', //支付类型-固定值
partnerid: res.data.payAppId, // 微信支付商户号
timeStamp: res.data.payTimeStamp, // 时间戳(单位:秒)
nonceStr: res.data.paynonceStr, // 随机字符串
package: res.data.payPackage, // 固定值
signType: res.data.paySignType, //固定值
paySign: res.data.paySign, //签名
success: (res) => {
uni.showToast({
title: "支付成功"
})
setTimeout(res => {
uni.redirectTo({
url: '/pages/order/order_detail?orderId=' + this
.listinfo.id
});
}, 1000)
this.paymodfiyOrderInfo()
// uni.redirectTo({
// url: "/pages/mall/order/ordersuccess?id=" + datareslane.data
// .order_id,
// });
},
fail: (err) => {
setTimeout(res => {
if(this.radiovalue1==1){
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({
icon: 'none',
title: '支付失败'
title: "支付成功"
})
uni.hideLoading()
}, 2000)
uni.redirectTo({
url: '/pages/order/order_detail?orderId=' + this.listinfo.id
});
setTimeout(res => {
uni.redirectTo({
url: '/pages/order/successful?orderId=' + this
.listinfoid
});
}, 1000)
this.paymodfiyOrderInfo()
// uni.redirectTo({
// url: "/pages/mall/order/ordersuccess?id=" + datareslane.data
// .order_id,
// });
},
fail: (err) => {
setTimeout(res => {
uni.showToast({
icon: 'none',
title: '支付失败'
})
uni.hideLoading()
}, 2000)
uni.redirectTo({
url: '/pages/order/order_detail?orderId=' + this.listinfoid
});
}
});
}else{
this.accountPayevent(this.listinfoid)
}
});
// #endif
}
},
@@ -506,6 +561,28 @@
}
}
.payType {
padding: 32rpx 34rpx;
margin-top: 48rpx;
background-color: #fff;
>view:first-child {
font-weight: 500;
font-size: 28rpx;
color: #333333;
}
>view:last-child {
margin-top: 32rpx;
}
.dfs {
display: flex;
align-items: center;
}
}
.fixedview {
position: fixed;
bottom: 0;

View File

@@ -276,27 +276,13 @@
if (e.q) {
this.tableCode = this.getQueryString(decodeURIComponent(e.q), 'code')
uni.cache.set('tableCode', this.tableCode)
// this.scanCodehandle()
this.scanCodehandle()
} else {
this.tableCode = e.tableCode
uni.cache.set('tableCode', this.tableCode)
// this.handlemessage()
}
let res = await this.api.productqueryShopIdByTableCode({
code: uni.cache.get('tableCode')
})
try {
if (res.data) {
uni.cache.set('shopUser', res.data)
if (e.q) {
this.scanCodehandle()
} else {
this.handlemessage()
}
}
} catch (e) {
//TODO handle the exception
this.productqueryShopIdByTableCode()//获取shop User id
}
uni.$on('message', this.getMessage)
this.$nextTick(() => {
@@ -308,7 +294,21 @@
uni.$off('message')
},
methods: {
getMessage(msg) {
// 单独获取他的shopUserid
async productqueryShopIdByTableCode() {
let res = await this.api.productqueryShopIdByTableCode({
code: uni.cache.get('tableCode')
})
try {
if (res.data) {
uni.cache.set('shopUser', res.data)
this.handlemessage()
}
} catch (e) {
//TODO handle the exception
}
},
getMessage(msg) { //wss 回显数据
if (msg.status != 'success') {
uni.showToast({
title: msg.msg,
@@ -348,12 +348,12 @@
this.cartLists = msg
this.productqueryProduct() //list 数据
break;
case 'createOrder': //去结算
let item = JSON.stringify(msg.data)
uni.redirectTo({
url: '/pages/order_detail/order_detail?tableId=' + item
});
break;
// case 'createOrder': //去结算
// let item = JSON.stringify(msg.data)
// uni.redirectTo({
// url: '/pages/order_detail/order_detail?tableId=' + item
// });
// break;
case 'queryCart': //待提交
// let queryCart = JSON.stringify(msg.data)
// uni.pro.navigateTo('order_detail/order_detail', {
@@ -399,7 +399,7 @@
}
},
scanCodehandle(e) {
// #ifdef MP-WEIXIN || MP-ALIPAY
uni.login({ //alipay weixin
provider: 'weixin',
@@ -423,8 +423,7 @@
uni.cache.set('miniAppOpenId', res.data.userInfo
.miniAppOpenId)
uni.cache.set('userInfo', res.data.userInfo);
// uni.cache.set('shopUser', res.data.shopUser);
this.handlemessage()
this.productqueryShopIdByTableCode()//获取shop User id
}
},
fail: (err) => {

View File

@@ -472,6 +472,7 @@
z-index: 999;
.fixedview_letr {
margin-left: 14rpx;
.fixedview_letr_item:nth-child(1) {
margin: 0;
}
@@ -580,7 +581,7 @@
.onetowcontent_oneo {
font-family: Source Han Sans CN, Source Han Sans CN;
font-weight: bold;
font-size: 32rpx;
font-size: 24rpx;
color: #FFFFFF;
}
@@ -604,7 +605,7 @@
}
.onetowcontent_onefour {
margin-left: 4rpx;
margin-left: 16rpx;
font-family: Source Han Sans CN, Source Han Sans CN;
font-weight: 400;
font-size: 24rpx;
@@ -801,8 +802,7 @@
.fourcontent_th_tow {
.fourcontent_th_towo {
font-family: Source Han Sans CN, Source Han Sans CN;
font-weight: 500;
font-size: 32rpx;
font-size: 24rpx;
color: #999999;
}

View File

@@ -18,7 +18,7 @@
</view>
<u-number-box v-model="Quantity">
<view slot="minus" class="minus">
<u-icon name="minus" color="#CCCCCC" bold size="40"></u-icon>
<u-icon name="minus" color="#CCCCCC" bold size="30"></u-icon>
</view>
<text slot="input" style="width: 20px;text-align: center;">{{Quantity}}</text>
<view slot="plus" class="plus">
@@ -37,7 +37,7 @@
{{info.couponDetail.name}}
</view>
</view>
<view style="background-color: #F6F6F6;height: 2rpx;width: 100%;margin-top: 8rpx;"></view>
<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>
@@ -46,6 +46,42 @@
小计<text style="color: #FF4C11;font-weight: 500;">{{info.salePrice * Quantity}}</text>
</text>
</view>
</view>
<!-- 支付方式 -->
<view class="payType" v-if="false">
<view class="">
支付方式
</view>
<view class="">
<u-radio-group v-model="radiovalue1" iconPlacement="right" :size="28" placement="column">
<u-radio activeColor="#ffd158" name="1">
<view class="dfs">
<image style="width:44rpx;height:44rpx"
src="https://czg-qr-order.oss-cn-beijing.aliyuncs.com/drder/balance.png" mode="">
</image>
<text style="font-size: 28rpx;margin-left: 16rpx;">
微信支付
</text>
</view>
</u-radio>
<view style="margin: 22rpx 0;width: 100%;height: 2rpx;background-color: #E5E5E5;">
</view>
<u-radio activeColor="#ffd158" name="2">
<view class="dfs">
<image style="width:44rpx;height:44rpx"
src="https://czg-qr-order.oss-cn-beijing.aliyuncs.com/drder/wechat.png" mode="">
</image>
<text style="font-size: 28rpx;margin-left: 16rpx;">
会员卡支付</text>
</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;"
@click="goRecharge">去充值</text>
</view>
</view>
</view>
<view class="placeBottom">
<view class="">
@@ -65,42 +101,63 @@
export default {
onLoad(e) {
this.getInfo(e.id)
this.orderIds= e.id
this.amount = uni.cache.get('userInfo').amount
this.vipId = uni.cache.get('userInfo').id
},
data() {
return {
info: null,
Quantity: 1
Quantity: 1,
radiovalue1: '1',
amount: 0,
orderIds:null,
vipId:null
}
},
methods: {
goRecharge() {
// uni.pro.to
},
async sumbitFrom() {
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.payEvent(res.data.id)
// 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) {
// 调用支付接口
this.payEvent(res.data.id)
}
}else{
let res = await this.api.accountPay({
orderId: this.orderIds,
memberId:this.vipId
})
if (res.code == 0) {
}
}
},
async payEvent(id) {
let res = await this.api.payOrderPay({
payType:'wechatPay',
orderId:id,
orderType:'group'
payType: 'wechatPay',
orderId: id,
orderType: 'group'
})
if (res) {
console.log(res, '调试1')
uni.requestPayment({
provider: 'wxpay', //支付类型-固定值
partnerid: res.data.payAppId, // 微信支付商户号
timeStamp: res.data.payTimeStamp, // 时间戳(单位:秒)
nonceStr: res.data.paynonceStr, // 随机字符串
package: res.data.payPackage, // 固定值
signType: res.data.paySignType, //固定值
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({
@@ -119,7 +176,7 @@
}
});
}
},
async getInfo(id) {
let res = await this.api.getproductorderConfirm({
@@ -164,7 +221,6 @@
}
.placetopmoney {
>view:first-child {
margin-bottom: 20rpx;
@@ -209,10 +265,9 @@
}
.jiesuanmoney {
height: 50rpx;
line-height: 50rpx;
// height: 50rpx;
// line-height: 50rpx;
text-align: right;
margin-top: 8rpx;
>text:first-child {
font-size: 24rpx;
@@ -224,6 +279,23 @@
}
}
}
.payType {
padding: 32rpx 34rpx;
margin-top: 48rpx;
background-color: #fff;
>view:first-child {
font-weight: 500;
font-size: 28rpx;
color: #333333;
}
>view:last-child {
margin-top: 32rpx;
}
}
.placeBottom {
@@ -231,7 +303,7 @@
bottom: 0%;
left: 0;
width: 100%;
height: 148rpx;
height: 180rpx;
background-color: #fff;
padding: 16rpx 34rpx;
@@ -260,6 +332,11 @@
}
}
.dfs {
display: flex;
align-items: center;
}
.m(@top, @right: 0, @bottom: 0, @left: 0) {
margin: @top, @right, @bottom, @left
}

View File

@@ -5,12 +5,20 @@
<view class="onecontent">
<view :style="[{'padding-top':HeighT.customBar +44+'px'}]"></view>
<view class="onecontentbox">
<image class="onecontentboximage" :src="userHeadImg" mode="" @click="uploadImg"></image>
<!-- <button open-type="chooseAvatar" @chooseavatar="uploadImg">
<image class="onecontentboximage" :src="userHeadImg" mode=""></image>
</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>
</button>
<view class="onecontentboxitem flex-between">
<view class="onecontentboxitemtext">
昵称
</view>
<input class="onecontentboxiteminput" v-model="userName" type="text" placeholder="请输入昵称">
<input class="onecontentboxiteminput" v-model="userName" type="nickname" placeholder="请输入昵称">
</view>
<view class="onecontentboxitem flex-between" style="border-top: 1rpx dotted #333333;">
<view class="onecontentboxitemtext">
@@ -65,43 +73,72 @@
}
},
methods: {
uploadImg() {
let _this = this
uni.chooseImage({
crop: {
width: 200,
height: 200
},
success: (chooseImageRes) => {
const tempFilePaths = chooseImageRes.tempFilePaths;
uni.uploadFile({
url: uni.conf.baseUrl + '/common/upload',
filePath: tempFilePaths[0],
header: {
environment: 'app',
type: 'android',
version: '1.7.3',
},
name: "file",
formData: {
file: chooseImageRes.tempFiles[0],
},
success: (uploadFileRes) => {
let {
data
} = JSON.parse(uploadFileRes.data)
this.userHeadImg = data
},
});
},
})
// uploadImg() {
// let _this = this
// uni.chooseImage({
// crop: {
// width: 200,
// height: 200
// },
// success: (chooseImageRes) => {
// const tempFilePaths = chooseImageRes.tempFilePaths;
// uni.uploadFile({
// url: uni.conf.baseUrl + '/common/upload',
// filePath: tempFilePaths[0],
// header: {
// environment: 'app',
// type: 'android',
// version: '1.7.3',
// },
// name: "file",
// formData: {
// file: chooseImageRes.tempFiles[0],
// },
// success: (uploadFileRes) => {
// let {
// data
// } = JSON.parse(uploadFileRes.data)
// this.userHeadImg = data
// },
// });
// },
// })
// },
uploadImg(e) {
const {
avatarUrl
} = e.detail
console.log(e)
console.log(e.detail)
// this.userHeadImg = avatarUrl
uni.uploadFile({
url: 'https://wxcashiertest.sxczgkj.cn/cashierService/common/upload',
// url: uni.conf.baseUrl + '/common/upload',
filePath: avatarUrl,
header: {
environment: 'app',
type: 'android',
version: '1.7.3',
},
name: "file",
formData: {
file:avatarUrl,
},
success: (uploadFileRes) => {
let {
data
} = JSON.parse(uploadFileRes.data)
this.userHeadImg = data
},
});
},
async sumbit() {
let res = await this.api.upUserInfo({
headImg: this.userHeadImg,
nickName: this.userName
})
if(res.code == 0){
if (res.code == 0) {
uni.navigateBack()
}
}
@@ -180,4 +217,15 @@
}
}
}
.btn{
width: 200rpx;
height: 200rpx;
border-radius: 100%;
padding: 0;
>view{
width: 200rpx;
height: 200rpx;
border-radius: 100%;
}
}
</style>

View File

@@ -3,7 +3,7 @@
<view class="user-info-wrap" @click="clickinformation">
<view style="width: 108rpx; height: 108rpx;border-radius: 50%;">
<image style="width: 108rpx; height: 108rpx; border-radius: 50%;" v-if="userInfo.headImg"
:src="userInfo.headImg" mode="aspectFill" >
:src="userInfo.headImg" mode="aspectFill">
</image>
<image style="width: 108rpx; height: 108rpx; border-radius: 50%;" v-else src="@/static/avatar.png"
mode="aspectFill">
@@ -42,7 +42,7 @@
userInfo: {},
shopInfo: {},
teblist: [],
list:[]
list: []
};
},
onLoad() {
@@ -55,7 +55,7 @@
}
},
methods: {
clickinformation(){
clickinformation() {
uni.pro.navigateTo('user/information')
},
//退出登录
@@ -118,6 +118,7 @@
} catch (e) {}
},
clickinfo(item, index) {
console.log(item, '调试121')
switch (item.jumpType) {
case 'scan': //特殊处理点击
switch (item.value) {
@@ -126,6 +127,9 @@
break;
}
break;
case 'scan_applet':
uni.navigateToMiniProgram(JSON.parse(item.value))
break
case 'relative': //内部页面
uni.pro.navigateTo(item.absUrl)
break;