支付接口调用

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) { getproductorderConfirm(data) {
return uni.api.get("/product/orderConfirm", data); return uni.api.get("/product/orderConfirm", data);
}, },
// 会员支付
accountPay(data) {
return uni.api.get("/pay/accountPay", data);
},
// 下单 // 下单
creatGroupOrder(data) { creatGroupOrder(data) {
return uni.api.post("/groupOrderInfo/creatGroupOrder", data); return uni.api.post("/groupOrderInfo/creatGroupOrder", data);
@@ -63,6 +67,14 @@ export default {
paymodfiyOrderInfo(data) { //查询订单支付状态 paymodfiyOrderInfo(data) { //查询订单支付状态
return uni.api.post("/pay/modfiyOrderInfo", 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) { //通过选中的商品规格查询价格 productqueryProductSku(data) { //通过选中的商品规格查询价格
return uni.api.get("/product/queryProductSku", data); return uni.api.get("/product/queryProductSku", data);
}, },

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@@ -78,7 +78,43 @@
<text style="color: red;">{{emitorderfoodform.couponsPrice}}</text> <text style="color: red;">{{emitorderfoodform.couponsPrice}}</text>
</view> </view>
</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="sixcontentone flex-between">
<view class="sixcontent_one"> <view class="sixcontent_one">
支付方式 支付方式
@@ -96,7 +132,7 @@
</view> </view>
</view> </view>
<!-- <view class="sixcontenttowitem flex-between" @click="clickselect(2)"> <view class="sixcontenttowitem flex-between" @click="clickselect(2)">
<view class="sixcontenttowitemone flex-start"> <view class="sixcontenttowitemone flex-start">
<u-icon name="zhifubao" color="#999999" size="26"></u-icon> <u-icon name="zhifubao" color="#999999" size="26"></u-icon>
<text class="sixcontenttowitemonetext">余额支付</text> <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-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> <u-icon v-else name="checkmark-circle-fill" color="#999999" size="26"></u-icon>
</view> </view>
</view> --> </view>
</view> </view>
</view> </view> -->
<view :style="{height:height}"> <view :style="{height:height}">
</view> </view>
<view class="fixedview"> <view class="fixedview">
<view class="flex-between"> <view class="flex-between">
<view class="fixedview_one flex-start"> <view class="fixedview_one flex-start">
<view class="fixedview_oneone"> <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>
<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> </view>
<view class="fixedview_tow" @click="showpopupclick">
立即付款
</view>
</view> </view>
</view> </view>
</view>
</template> </template>
<script> <script>
@@ -139,7 +175,7 @@
return { return {
height: '', height: '',
pay_type: 1, pay_type: 1,
info: {}, listinfoid: '',
listinfo: { listinfo: {
detailList: [], detailList: [],
amount: '', amount: '',
@@ -147,22 +183,29 @@
}, },
emitorderfoodform: { emitorderfoodform: {
clickiconone: '' clickiconone: ''
} },
amountVIP:0,
radiovalue1: '1',
vipId:null,
}; };
}, },
onUnload() { onUnload() {
uni.$off('createOrdermessage') uni.$off('getMessage')
}, },
onLoad(e) { onLoad(e) {
console.log(e, 140) // console.log(e, 140)
let res = JSON.parse(e.tableId) let res = JSON.parse(e.tableId)
// .toFixed(2)
this.listinfo.detailList = res this.listinfo.detailList = res
this.listinfo.amount = e.amount this.listinfo.amount = e.amount // 算完了的价格
this.listinfo.amounts = e.amount this.listinfo.amounts = e.amount //本来的价格
this.handlemessage() 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() { onShow() {
@@ -182,18 +225,21 @@
}) })
}, },
methods: { methods: {
creategetMessage(msg) { getMessage(msg) {
console.log('tiaoshi1', msg)
if (msg.status != 'success') { if (msg.status != 'success') {
uni.showToast({ uni.showToast({
title: msg.msg, title: msg.msg,
icon: "none", icon: "none",
}) })
this.socketTicket.Close() this.socketTicket.Close()
uni.$off('createOrdermessage') uni.$off('getMessage')
return false; return false;
} else { } else {
switch (msg.type) { switch (msg.type) {
case 'createOrder': //去结算 case 'createOrder': //去结算
console.log('tiaoshi2', msg)
this.listinfoid = msg.data.id //下单需要的id
this.showpopupclickdd() this.showpopupclickdd()
// let item = JSON.stringify(msg.data) // let item = JSON.stringify(msg.data)
// uni.redirectTo({ // uni.redirectTo({
@@ -206,7 +252,7 @@
handlemessage() { handlemessage() {
this.socketTicket ? this.socketTicket.Close() : null //调用前先判断是否有socket正在进行 先关闭后链接 this.socketTicket ? this.socketTicket.Close() : null //调用前先判断是否有socket正在进行 先关闭后链接
this.socketTicket = new webSocketUtils( 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) 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) { copyHandle(e) {
uni.setClipboardData({ uni.setClipboardData({
data: e, data: e,
@@ -244,30 +282,42 @@
}, },
async paymodfiyOrderInfo() { async paymodfiyOrderInfo() {
let res = await this.api.paymodfiyOrderInfo({ let res = await this.api.paymodfiyOrderInfo({
orderId: this.listinfo.id orderId: this.listinfoid
}) })
}, },
// 去结算 // 去结算
showpopupclick() { showpopupclick() {
let data = { //定义socket数据传参 let data = { //定义socket数据传参
"skuId": '', "skuId": '',
"num": '', //数量 "num": '', //数量
"type": "createOrder", //“addcart:添加购物车create0rder:生成订单clearCart:庆康购物车”, "type": "createOrder", //“addcart:添加购物车create0rder:生成订单clearCart:庆康购物车”,
"couponsId": this.emitorderfoodform.id ? this.emitorderfoodform.id : '', //优惠券ID, "couponsId": this.emitorderfoodform.id ? this.emitorderfoodform.id : '', //优惠券ID,
"isYhq": this.emitorderfoodform.id ? 1 : 0, // 是否使用优惠券( 1 使用, 0 不使用), "isYhq": this.emitorderfoodform.id ? 1 : 0, // 是否使用优惠券( 1 使用, 0 不使用),
"isBuyYhq": this.emitorderfoodform.clickiconone == 1 ? 1 : 0, // 是否购买优惠券( 1 购买, 0 不够买) "isBuyYhq": this.emitorderfoodform.clickiconone == 1 ? 1 : 0, // 是否购买优惠券( 1 购买, 0 不够买)
"productId": '', //商品id "productId": '', //商品id
"shopId": uni.cache.get('shopUser'), "shopId": uni.cache.get('shopUser'),
"userId": uni.cache.get('userInfo').id "userId": uni.cache.get('userInfo').id,
} // tableId:uni.cache.get('tableCode')
console.log(data) }
uni.$u.debounce(this.socketSendMsg(data), 500) 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({ let res = await this.api.payorderPay({
orderId: this.listinfo.id, orderId: this.listinfoid
}) //判断是否支付成功 }) //判断是否支付成功
if (res.code == 0) { if (res.code == 0) {
uni.showLoading({ uni.showLoading({
@@ -275,43 +325,48 @@
mask: true mask: true
}) })
// #ifdef MP-WEIXIN // #ifdef MP-WEIXIN
uni.requestPayment({ if(this.radiovalue1==1){
provider: 'wxpay', //支付类型-固定值 uni.requestPayment({
partnerid: res.data.payAppId, // 微信支付商户号 provider: 'wxpay', //支付类型-固定值
timeStamp: res.data.payTimeStamp, // 时间戳(单位:秒) partnerid: res.data.appId, // 微信支付商户号
nonceStr: res.data.paynonceStr, // 随机字符串 timeStamp: res.data.timeStamp, // 时间戳(单位:秒)
package: res.data.payPackage, // 固定值 nonceStr: res.data.nonceStr, // 随机字符串
signType: res.data.paySignType, //固定值 package: res.data.package, // 固定值
paySign: res.data.paySign, //签名 signType: res.data.signType, //固定值
success: (res) => { paySign: res.data.paySign, //签名
uni.showToast({ success: (res) => {
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 => {
uni.showToast({ uni.showToast({
icon: 'none', title: "支付成功"
title: '支付失败'
}) })
uni.hideLoading() setTimeout(res => {
}, 2000) uni.redirectTo({
uni.redirectTo({ url: '/pages/order/successful?orderId=' + this
url: '/pages/order/order_detail?orderId=' + this.listinfo.id .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 // #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 { .fixedview {
position: fixed; position: fixed;
bottom: 0; bottom: 0;

View File

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

View File

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

View File

@@ -18,7 +18,7 @@
</view> </view>
<u-number-box v-model="Quantity"> <u-number-box v-model="Quantity">
<view slot="minus" class="minus"> <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> </view>
<text slot="input" style="width: 20px;text-align: center;">{{Quantity}}</text> <text slot="input" style="width: 20px;text-align: center;">{{Quantity}}</text>
<view slot="plus" class="plus"> <view slot="plus" class="plus">
@@ -37,7 +37,7 @@
{{info.couponDetail.name}} {{info.couponDetail.name}}
</view> </view>
</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"> <view class="jiesuanmoney">
<text> <text>
优惠<text style="color: #FF4C11;font-weight: 500;">{{info.save * Quantity}}</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 style="color: #FF4C11;font-weight: 500;">{{info.salePrice * Quantity}}</text>
</text> </text>
</view> </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>
<view class="placeBottom"> <view class="placeBottom">
<view class=""> <view class="">
@@ -65,42 +101,63 @@
export default { export default {
onLoad(e) { onLoad(e) {
this.getInfo(e.id) this.getInfo(e.id)
this.orderIds= e.id
this.amount = uni.cache.get('userInfo').amount
this.vipId = uni.cache.get('userInfo').id
}, },
data() { data() {
return { return {
info: null, info: null,
Quantity: 1 Quantity: 1,
radiovalue1: '1',
amount: 0,
orderIds:null,
vipId:null
} }
}, },
methods: { methods: {
goRecharge() {
// uni.pro.to
},
async sumbitFrom() { async sumbitFrom() {
let payMoney = this.info.salePrice * this.Quantity // radiovalue1:为1的时候微信支付,为2是会员卡,需要输入支付密码
let res = await this.api.creatGroupOrder({ if (this.radiovalue1 == 1) {
num: this.Quantity, let payMoney = this.info.salePrice * this.Quantity
proId: this.info.proId, let res = await this.api.creatGroupOrder({
shopId: this.info.shopId, num: this.Quantity,
payAmount: payMoney, proId: this.info.proId,
orderAmount: payMoney shopId: this.info.shopId,
}) payAmount: payMoney,
if (res.code == 0) { orderAmount: payMoney
// 调用支付接口 })
this.payEvent(res.data.id) 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) { async payEvent(id) {
let res = await this.api.payOrderPay({ let res = await this.api.payOrderPay({
payType:'wechatPay', payType: 'wechatPay',
orderId:id, orderId: id,
orderType:'group' orderType: 'group'
}) })
if (res) { if (res) {
console.log(res, '调试1')
uni.requestPayment({ uni.requestPayment({
provider: 'wxpay', //支付类型-固定值 provider: 'wxpay', //支付类型-固定值
partnerid: res.data.payAppId, // 微信支付商户号 partnerid: res.data.appId, // 微信支付商户号
timeStamp: res.data.payTimeStamp, // 时间戳(单位:秒) timeStamp: res.data.timeStamp, // 时间戳(单位:秒)
nonceStr: res.data.paynonceStr, // 随机字符串 nonceStr: res.data.nonceStr, // 随机字符串
package: res.data.payPackage, // 固定值 package: res.data.package, // 固定值
signType: res.data.paySignType, //固定值 signType: res.data.signType, //固定值
paySign: res.data.paySign, //签名 paySign: res.data.paySign, //签名
success: (res) => { success: (res) => {
uni.showToast({ uni.showToast({
@@ -119,7 +176,7 @@
} }
}); });
} }
}, },
async getInfo(id) { async getInfo(id) {
let res = await this.api.getproductorderConfirm({ let res = await this.api.getproductorderConfirm({
@@ -164,7 +221,6 @@
} }
.placetopmoney { .placetopmoney {
>view:first-child { >view:first-child {
margin-bottom: 20rpx; margin-bottom: 20rpx;
@@ -209,10 +265,9 @@
} }
.jiesuanmoney { .jiesuanmoney {
height: 50rpx; // height: 50rpx;
line-height: 50rpx; // line-height: 50rpx;
text-align: right; text-align: right;
margin-top: 8rpx;
>text:first-child { >text:first-child {
font-size: 24rpx; 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 { .placeBottom {
@@ -231,7 +303,7 @@
bottom: 0%; bottom: 0%;
left: 0; left: 0;
width: 100%; width: 100%;
height: 148rpx; height: 180rpx;
background-color: #fff; background-color: #fff;
padding: 16rpx 34rpx; padding: 16rpx 34rpx;
@@ -260,6 +332,11 @@
} }
} }
.dfs {
display: flex;
align-items: center;
}
.m(@top, @right: 0, @bottom: 0, @left: 0) { .m(@top, @right: 0, @bottom: 0, @left: 0) {
margin: @top, @right, @bottom, @left margin: @top, @right, @bottom, @left
} }

View File

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

View File

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