支付宝兼容,排队预约修改,订单逻辑修改

This commit is contained in:
GaoHao
2024-09-24 15:22:34 +08:00
parent 861e97b775
commit 5f03e44701
31 changed files with 823 additions and 737 deletions

View File

@@ -58,7 +58,9 @@
let tableCode = this.getQueryString(decodeURIComponent(res.result), 'code')
uni.cache.set('tableCode', tableCode)
if (tableCode) {
uni.pro.navigateTo('order_food/order_food')
uni.pro.navigateTo('order_food/order_food', {
tableCode: tableCode,
})
}
},
fail:( res) =>{

View File

@@ -236,7 +236,7 @@
</view>
<indexs v-if="showindex == 'shopIndex'" :shopExtend="shopExtend" :usershopUserinfo='usershopUserinfo' :userInfo='userInfo'></indexs>
<indexs v-if="showindex == 'shopIndex'" :shopExtend="shopExtend" :shopUserInfo='shopUserInfo' ></indexs>
<popupad id="popupad" :forceUpdate='forceUpdate' :showPosition="'home'"></popupad>
</view>
</view>
@@ -265,7 +265,6 @@
data() {
return {
showindex: "",
userInfo: {},//个人信息
NAME: uni.cache.get('NAME'),
timersetInterval: '0', //定时器
isFixedTop: false, //吸顶是否显示
@@ -305,7 +304,7 @@
categoryList: [],
subCategoryList: [], //二级菜单数据
// 登录后店铺信息
usershopUserinfo:{},
shopUserInfo:{},
popupadList: [], //广告数据
forceUpdate: false,
shopExtend: null,
@@ -368,10 +367,9 @@
"userId": uni.cache.get('userInfo').id,
})
if (res.code == 0) {
this.usershopUserinfo = res.data
uni.cache.set('shopUserInfo',this.usershopUserinfo)
this.shopUserInfo = res.data
uni.cache.set('shopUserInfo',this.shopUserInfo)
}
this.loginwxuserInfo() //个人信息接口
if ( uni.cache.get('forceUpdate') == 1) {
this.forceUpdate = !this.forceUpdate;
}
@@ -442,17 +440,7 @@
this.shopExtend = res.data;
}
},
// 个人信息
async loginwxuserInfo() {
let res = await this.api.loginwxuserInfo({
userId: uni.cache.get('userInfo').id
})
if (res.code == 0) {
uni.cache.set('userInfo', res.data);
this.userInfo = uni.cache.get('userInfo')
}
},
closeproductlist() {
this.showproductlist = false
// console.log('close');

View File

@@ -9,7 +9,7 @@
<text class="contentboxitemlefttexttow">在线点不排队</text>
</view>
<view class="contentboxitemright">
<view class="contentboxitemright_item flex-between" @click="scanCodehandle(1)">
<view class="contentboxitemright_item flex-between" @click="memberindex('member/memberdetails')">
<image src="https://czg-qr-order.oss-cn-beijing.aliyuncs.com/indexs/Xvip.png" mode="aspectFill">
</image>
<view class="contentboxitemright_itembox flex-colum">
@@ -17,7 +17,7 @@
<text>入会享权益</text>
</view>
</view>
<view class="contentboxitemright_item flex-between" @click="memberindex(0)">
<view class="contentboxitemright_item flex-between" @click="memberindex('member/index')">
<image src="https://czg-qr-order.oss-cn-beijing.aliyuncs.com/indexs/Xchong.png"
mode="aspectFill"></image>
<view class="contentboxitemright_itembox flex-colum">
@@ -34,10 +34,12 @@
<script>
export default {
data() {
return {};
return {
userInfo: null,
};
},
props: {
usershopUserinfo: {
shopUserInfo: {
type: Object,
default () {
return {
@@ -46,12 +48,6 @@
}
}
},
userInfo: {
type: Object,
default () {
return {}
}
},
shopExtend: {
type: Object,
default () {
@@ -59,51 +55,34 @@
}
},
},
mounted() {
this.userInfo = uni.cache.get('userInfo');
},
methods: {
scanCodehandle(i) {
setTimeout(()=>{
uni.cache.set('forceUpdate',2)
},200)
if (i == 0) {
uni.scanCode({
success: (res) => {
let tableCode = this.getQueryString(decodeURIComponent(res.result), 'code')
uni.cache.set('tableCode', tableCode)
if (tableCode) {
uni.pro.navigateTo('order_food/order_food', {
// shopId_id: uni.cache.get('shopId'),
})
}
},
fail: () => {
uni.scanCode({
success: (res) => {
let tableCode = this.getQueryString(decodeURIComponent(res.result), 'code')
uni.cache.set('tableCode', tableCode)
if (tableCode) {
uni.pro.navigateTo('order_food/order_food', {
tableCode: tableCode,
})
// uni.pro.navigateTo('/pagesOrder/orderAMeal/index')
}
})
} else {
uni.pro.navigateTo('member/memberdetails', {
shopId_id: uni.cache.get('shopId'),
})
}
},
memberindex(i) {
console.log(2)
if (i == 0) {
uni.pro.navigateTo('member/index', {
shopId: uni.cache.get('shopId'),
type: 'index',
})
} else {
let data = {
shopName: this.usershopUserinfo.shopName,
amount: this.usershopUserinfo.amount,
shopId: uni.cache.get('shopId')
},
fail: () => {
}
uni.navigateTo({
url: '/pages/pay_code/pay_code?shopInfo=' + JSON.stringify(data)
})
}
})
},
memberindex(url) {
uni.pro.navigateTo(url, {
shopId: uni.cache.get('shopId'),
type: 'index',
})
},
getQueryString(url, name) { //解码
var reg = new RegExp('(^|&|/?)' + name + '=([^&|/?]*)(&|/?|$)', 'i')
@@ -114,30 +93,6 @@
return null;
},
// / 更换头像
onChooseAvatar(e) {
uni.showLoading({
title: '上传中',
mask: true
})
console.log(e.detail.avatarUrl)
let file = e.detail.avatarUrl;
uploadImage(file, 'avatar',
result => {
//将上传后的图片以对象官方要求的格式的形式存入uni-file-picker的value值imageValueimageValue值的结构为数组包对象用于图片回显
// let objAge = {
// 'url': result,
// 'extname': 'png',
// 'name': 'imgss.png'
// };
// this.userlist.avatar.push(objAge)
this.userInfo.avatar = result
console.log(this.userInfo.avatar)
uni.hideLoading()
}, result => {
uni.hideLoading()
})
},
}
};

View File

@@ -59,9 +59,8 @@
uni.getUserInfo({
provider: 'weixin',
success: async (infoRes) => {
uni.cache.set('weixincode', data.code);
let res = await this.api.userwxlogin({
code: uni.cache.get('weixincode'), //临时登录凭证
code: data.code, //临时登录凭证
rawData: infoRes.rawData,
// signature: infoRes.signature,
// iv: infoRes.detail.iv,

View File

@@ -55,10 +55,8 @@
uni.getUserInfo({
provider: 'weixin',
success: async (infoRes) => {
console.log(infoRes, 81);
uni.cache.set('weixincode', data.code);
let res = await this.api.userwxlogin({
code: uni.cache.get('weixincode'), //临时登录凭证
code: data.code, //临时登录凭证
encryptedData: infoRes
.encryptedData, // 用户非敏感信息
rawData: infoRes.rawData,

View File

@@ -1,13 +1,18 @@
<template>
<!-- 店铺详情 -->
<u-popup :show="show" :round="20" overlayOpacity="0.8" mode="bottom" @close="showClose" height="500">
<u-popup :show="memberOpen" :round="20" overlayOpacity="0.8" mode="bottom" @close="showClose" height="500">
<view class="register-member-wrap">
<view class="register-title">欢迎加入{{shopUserInfo.shopName?shopUserInfo.shopName:'本店'}}</view>
<view class="register-tip">请完善个人信息完成会员注册</view>
<view class="register-content">
<view class="reg-head">
<view class="reg-head-img">
<!-- #ifdef MP-WEIXIN -->
<button class="reg-head-img" type="default" open-type="chooseAvatar" @chooseavatar="uploadImg">
<!-- #endif -->
<!-- #ifdef MP-ALIPAY -->
<button class="reg-head-img" type="default" open-type="chooseAvatar" @chooseAvatar="uploadImg">
<!-- #endif -->
<image class="reg-head-img" :src="userHeadImg || 'https://czg-qr-order.oss-cn-beijing.aliyuncs.com/menber/head_default.png'" mode="aspectFill"></image>
</button>
</view>
@@ -37,7 +42,13 @@
<view class="reg-cell">
<view class="lable">手机号</view>
<u-input class="value" v-model="telephone" fontSize="14px" type="text" input-align="left" readonly placeholder="获取微信手机号" :custom-style="{border:'none'}" placeholder-style="color:#999;font-size: 28rpx"/>
<!-- #ifdef MP-WEIXIN -->
<button class="getPhone" open-type="getPhoneNumber" @getphonenumber="getPhone">
<!-- #endif -->
<!-- #ifdef MP-ALIPAY -->
<button class="getPhone" open-type="getAuthorize" scope='phoneNumber' @getAuthorize="getPhone" @error="getPhoneError">
<!-- #endif -->
<view class="text">{{phonetitle || '获取微信手机号'}}</view>
</button>
</view>
@@ -64,7 +75,18 @@
<script>
export default {
props: ['show',"shopId"],
props: {
shopId: {
type: String,
default: ''
},
show: {
type: Boolean,
default: false,
},
},
data() {
return {
value1: Number(new Date()),
@@ -76,10 +98,13 @@
birthDay: "",
isProtocol: false,
shopUserInfo: null,
memberOpen: false,
}
},
mounted() {
console.log(13)
this.shopId = uni.cache.get('shopId')
console.log(this.memberOpen)
this.init()
// console.log(this.userInfo)
// this.userId = this.userInfo.id;
@@ -88,14 +113,18 @@
methods: {
async init() {
let res = await this.api.shopUserInfo({
"shopId": this.shopId,
"userId": uni.cache.get('userInfo').id,
})
console.log(res)
if (res.code == 0) {
this.shopUserInfo = res.data;
if ( uni.cache.get('shopUserInfo') && this.shopId == uni.cache.get('shopUserInfo').id ) {
this.shopUserInfo = uni.cache.get('shopUserInfo');
} else {
let res = await this.api.shopUserInfo({
"shopId": this.shopId,
"userId": uni.cache.get('userInfo').id,
})
if (res.code == 0) {
this.shopUserInfo = res.data;
}
}
this.memberOpen = this.shopUserInfo.isVip == 0 ? true : false;
this.userHeadImg = this.shopUserInfo.headImg;
this.nickName = this.shopUserInfo.nickName && this.shopUserInfo.nickName != '微信用户' ? this.shopUserInfo.nickName : '';
this.telephone = this.shopUserInfo.telephone;
@@ -126,15 +155,12 @@
* @param {Object} e
*/
uploadImg(e) {
console.log(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',
// url: uni.conf.baseUrl + '/common/upload',
filePath: avatarUrl,
header: {
@@ -150,6 +176,9 @@
let { data } = JSON.parse(uploadFileRes.data)
this.userHeadImg = data
},
fail: (res) => {
console.log(res)
}
});
},
@@ -168,6 +197,7 @@
* @param {Object} d
*/
async getPhone(d) {
// #ifdef MP-WEIXIN
if (d.detail.iv) {
uni.login({
provider: 'weixin',
@@ -182,6 +212,32 @@
}
})
}
// #endif
// #ifdef MP-ALIPAY
// 支付宝小程序环境
my.getAuthCode({
scopes: 'auth_user',
success: (res) => {
console.log(res)
my.getPhoneNumber({
success: async (data) => {
console.log(data)
let res = await this.api.userwxlogins({
code: res.authCode,
encryptedData: d.response,
iv: d.detail.iv,
})
this.phonetitle = res.data.substr(0, 3) + "****" + res.data.substr(7)
this.mobile = res.data;
}
});
}
});
// #endif
},
getPhoneError (e) {
console.log(e)
},
/**
@@ -252,6 +308,7 @@
if ( res.code == 0 ) {
this.$emit('getRegisterMember', false)
this.memberOpen = false;
let res = await this.api.loginwxuserInfo({
userId: uni.cache.get('userInfo').id
})
@@ -330,12 +387,19 @@
}
}
.getPhone{
line-height: initial;
background-color: none;
border: 2rpx solid #E3AD7F;
color: #E3AD7F;
font-size: 28rpx;
padding: 5rpx 10rpx;
// #ifdef MP-ALIPAY
padding-top: 0;
display: initial;
height: 70rpx;
line-height: 70rpx;
box-sizing: border-box;
border-radius: 5rpx;
// #endif
}
}
.agreement{

View File

@@ -90,7 +90,7 @@
</view>
<view class="recharge" @tap="$u.debounce(userbalancerechangesub, 500)">立即充值</view>
</view>
<registermember :show="memberOpen" :shopUserInfo="shopUserInfo" :shopId="shopId" @getRegisterMember="getRegisterMember"></registermember>
<registermember :show="memberOpen" :shopId="shopId" @getRegisterMember="getRegisterMember"></registermember>
</view>
</template>
@@ -129,6 +129,7 @@
uni.cache.set('forceUpdate',1)
if (e.q) {
this.shopId = this.getQueryString(decodeURIComponent(e.q), 'shopId')
uni.cache.set('shopId',this.shopId)
this.tokenShow = false;
// 等待登录结果返回
// if (!uni.cache.get('token')) {
@@ -138,25 +139,26 @@
this.paygetActive()
} else{
this.shopId = e.shopId;
uni.cache.set('shopId',this.shopId)
this.shopInfo();
this.paygetActive()
}
console.log(this.shopId)
},
methods: {
/**
* 初始化
*/
async shopInfo() {
let res = await this.api.shopUserInfo({
"shopId": this.shopId,
"userId": uni.cache.get('userInfo').id,
shopId: this.shopId,
userId: uni.cache.get('userInfo').id,
})
if (res.code == 0) {
this.shopUserInfo = res.data;
uni.cache.remove('memberOpen',this.memberOpen)
if ( this.shopUserInfo.isVip == 0 ) {
this.memberOpen = true;
uni.cache.set('memberOpen',this.memberOpen)
}
} else {
let pages = getCurrentPages()
@@ -177,7 +179,8 @@
}
this.$forceUpdate();
console.log(this.memberOpen)
},

View File

@@ -19,7 +19,7 @@
</view>
</view>
</view>
<view v-if="list.length <= 0" class="flex-colum">
<view v-if="list.length <= 0 && is_end" class="flex-colum">
<image style="width: 402rpx;height: 442rpx;margin:240rpx auto 32rpx;" src="https://czg-qr-order.oss-cn-beijing.aliyuncs.com/nomore.png" mode="aspectFill"></image>
</view>
<u-loadmore :status="form.status" iconSize='24' fontSize='24' height='40' />
@@ -91,20 +91,28 @@
}, 500)
}
},
eeInfo(item) {
if ( this.type && this.type == 'user_payCode') {
uni.navigateTo({
url: '/pages/pay_code/pay_code?shopInfo=' + JSON.stringify(item)
})
} else if ( this.type && this.type == 'user_recharge') {
uni.pro.navigateTo('member/index', {
shopId: item.shopId,
type: 'index',
})
} else {
uni.pro.navigateTo('member/memberdetails', {
shopId_id: item.shopId
})
async eeInfo(item) {
let res = await this.api.shopUserInfo({
"shopId": item.shopId,
"userId": uni.cache.get('userInfo').id,
})
if ( res.code == 0 ) {
uni.cache.set('shopUserInfo',res.data)
uni.cache.set('shopId', item.shopId)
if ( this.type && this.type == 'user_payCode') {
uni.navigateTo({
url: '/pages/pay_code/pay_code?shopInfo=' + JSON.stringify(item)
})
} else if ( this.type && this.type == 'user_recharge') {
uni.pro.navigateTo('member/index', {
shopId: item.shopId,
type: 'index',
})
} else {
uni.pro.navigateTo('member/memberdetails', {
shopId_id: item.shopId
})
}
}
},

View File

@@ -9,7 +9,7 @@
<view class="card_head">
<view class="card_head_left">
<image class="card_head_left_head" src="https://czg-qr-order.oss-cn-beijing.aliyuncs.com/menber/member_head.png" mode="aspectFill"></image>
<text class="card_head_left_name">{{shopUserInfo.shopName}}会员卡</text>
<text class="card_head_left_name">{{shopUserInfo.shopName||''}}会员卡</text>
<view class="card_head_left_icon_box" v-if="shopUserInfo.isVip != 0">
<image class="card_head_left_icon1" src="https://czg-qr-order.oss-cn-beijing.aliyuncs.com/menber/member_icon1.png" mode="aspectFill"></image>
<text class="card_head_left_iconText">VL1</text>
@@ -73,7 +73,7 @@
</view>
</view>
<registermember :show="memberOpen" :shopUserInfo="shopUserInfo" :shopId="shopId_id" @getRegisterMember="getRegisterMember"></registermember>
<registermember :show="memberOpen" :shopId="shopId" @getRegisterMember="getRegisterMember"></registermember>
</view>
</template>
@@ -86,7 +86,7 @@
},
data() {
return {
shopId_id: null,
shopId: null,
memberOpen: false,
amount: '',
shopUserInfo: null,
@@ -99,11 +99,12 @@
}
},
onLoad(e) {
this.shopId_id = e.shopId_id;
this.shopId = e.shopId;
this.shopUserInfo = uni.cache.get('shopUserInfo')
uni.cache.set('forceUpdate',1)
this.init();
},
onShow() {
this.init();
this.getShopExtend();
},
methods: {
@@ -111,16 +112,7 @@
* 获取店铺信息
*/
async init() {
let res = await this.api.shopUserInfo({
"shopId": this.shopId_id,
"userId": uni.cache.get('userInfo').id,
})
if (res.code == 0) {
this.shopUserInfo = res.data
uni.cache.set('shopUserInfo',res.data)
}
if ( this.shopUserInfo.isVip == 0 ) {
if ( this.shopUserInfo.isVip == 0) {
this.memberOpen = true;
}
},
@@ -129,7 +121,7 @@
*/
async getShopExtend () {
let res = await this.api.getShopExtend({
shopId: this.shopId_id,
shopId: this.shopId,
autokey: "member_bg" //index_bg my_bg member_bg shopInfo_bg
})
if ( res.code == 0) {
@@ -139,7 +131,7 @@
itemClick ( type ) {
if ( type == 1) {
uni.pro.navigateTo('member/index', {
shopId: this.shopUserInfo.shopId,
shopId: this.shopUserInfo.id,
type: 'index',
})
} else if ( type == 3 ) {

View File

@@ -185,9 +185,7 @@
};
},
onShow() {
if (uni.cache.get('token')) {
this.loginwxuserInfo()
}
if (this.tabs.findIndex((item) => item.type == this.useStorage.get('orderType')) == -1) {
this.active = 0
} else {
@@ -223,17 +221,9 @@
this.navtabindex = i
this.init_fn()
},
async loginwxuserInfo() {
let res = await this.api.loginwxuserInfo({
userId: uni.cache.get('userInfo').id
})
if (res.code == 0) {
uni.cache.set('userInfo', res.data);
this.userInfo = uni.cache.get('userInfo')
}
},
orderinfo(e) {
uni.pro.navigateTo('order/order_detail', {
uni.pro.navigateTo('/pagesOrder/order_detail/index', {
orderId: e.id
})
},
@@ -383,7 +373,7 @@
// uni.cache.set('shopUser', '') //删除shopUser
_this.paymodfiyOrderInfo()
uni.redirectTo({
url: '/pages/order/order_detail?orderId=' + _this
url: '/pagesOrder/order_detail/index?orderId=' + _this
.listinfoid
});
},

View File

@@ -1,559 +0,0 @@
<template>
<view class="container">
<view class="card_box">
<view class="card_head_box">
<view class="card_head_item"></view>
<view class="card_head_item"></view>
<view class="card_head_item"></view>
<view class="card_head_item"></view>
<view class="card_head_item"></view>
<view class="card_head_item"></view>
<view class="card_head_item"></view>
<view class="card_head_item"></view>
</view>
<view class="card">
<!-- 订单头部 -->
<view class="head">
<view class="head_left">
<text class="shopName">{{listinfo.name}}</text>
<text class="tableName" v-if="listinfo.tableName">桌号{{listinfo.tableName}}</text>
</view>
<text class="status" v-if="listinfo.status == 'unpaid' || listinfo.status == 'paying'">
<text> 待支付 </text>
</text>
<text class="status" v-if="listinfo.status == 'unsend'">
<text>待发货</text>
</text>
<text class="status" v-if="listinfo.status == 'closed'">
<text>订单完成</text>
</text>
<text class="status" v-if="listinfo.status == 'send'">
<text> 已发</text>
</text>
<text class="status" v-if="listinfo.status == 'refunding'">
<text>申请退单</text>
</text>
<text class="status" v-if="listinfo.status == 'refund'">
<text>退单</text>
</text>
<text class="status" v-if="listinfo.status == 'cancelled'">
<text>已取消</text>
</text>
<text class="status" v-if="listinfo.status == 'merge'">
<text>合台</text>
</text>
</view>
<!-- 取餐号 -->
<view class="number-wrap"
v-if="listinfo.status != 'unpaid' && listinfo.status != 'paying'&& listinfo.status != 'cancelled'">
<text class="t">取餐号</text>
<text class="number">{{listinfo.outNumber}}</text>
</view>
<!-- 订单详情 -->
<view class="shop-box">
<view class="shop-head">
<view class="shop-head-left">
<view class="tag-wrap">
<text class="tag" v-if="listinfo.sendType == 'post'">快递</text>
<text class="tag" v-if="listinfo.sendType == 'takeaway'">外卖</text>
<text class="tag" v-if="listinfo.sendType == 'takeself'">自提</text>
<text class="tag" v-if="listinfo.sendType == 'table'">堂食</text>
</view>
<text class="title">订单详情</text>
</view>
<view style="display: flex;align-items: center;"
v-if="listinfo.status == 'unpaid' || listinfo.status == 'paying'"
>
<!-- <text style="font-size:24rpx;">支付时间:</text> -->
<uni-countdown :show-day="false" color="#E3AD7F" border-color="#E3AD7F" splitorColor="#E3AD7F"
:font-size="16" :hour="0" :minute="listinfo.expiredMinutes" :second="listinfo.expiredSeconds" />
</view>
</view>
<view class="shop-info">
<view class="item" v-for="(item,index) in listinfo.details" :key="index">
<view class="cover">
<u-image width="152" height="152" radius="16" :src='item.productImg'></u-image>
</view>
<view class="info">
<text class="productName">{{item.productName}}</text>
<text class="productSkuName" v-if="item.productSkuName">{{item.productSkuName}}</text>
</view>
<view class="price">
<view class="priceAmount">{{item.priceAmount}}</view>
<view class="num">x{{item.num}}</view>
</view>
</view>
</view>
<view class="total-wrap">
<view>合计</view>
<view class="price"> {{listinfo.payAmount}} </view>
</view>
</view>
<!-- 订单信息 -->
<view class="order_footer">
<view class="order_footer_icon">
<view class="order_footer_left_icon"></view>
<view class="order_footer_right_icon"></view>
</view>
<view class="title">订单信息</view>
<view class="order-info">
<view class="row" @click="copyHandle(listinfo.orderNo)">
<text class="t">订单信息</text>
<text class="info">{{listinfo.orderNo}}点击复制</text>
</view>
<view class="row">
<text class="t">创建时间</text>
<text class="info">{{$u.timeFormat(listinfo.time, 'yyyy-mm-dd hh:MM:ss')}}</text>
</view>
</view>
</view>
</view>
</view>
<view class="fixedview">
<view class="flex-between" v-if="listinfo.status == 'unpaid' || listinfo.status == 'paying'">
<view class="fixedview_one flex-start">
<view class="fixedview_oneone"> 实付金额 </view>
<view class="fixedview_onetow">
<text>¥</text>{{listinfo.payAmount}}
</view>
</view>
<view class="fixedview_tow" @tap="$u.debounce(showpopupclick,1000)">
立即付款
</view>
</view>
</view>
</view>
</template>
<script>
export default {
data() {
return {
pay_type: 1,
orderId: '',
listinfo: {},
srcimge: 'https://czg-qr-order.oss-cn-beijing.aliyuncs.com/wx.jpg'
};
},
async onLoad(e) {
console.log(e)
this.orderId = e.orderId
},
onShow() {
this.orderorderInfo()
},
onUnload() {
uni.switchTab({
url: '/pages/order/order'
})
},
methods: {
/**
* 获取订单信息
*/
async orderorderInfo() {
let res = await this.api.orderorderInfo({
orderId: this.orderId
})
if (res.code == 0) {
this.listinfo = res.data;
}
},
/**
* 支付完成后请求
*/
async paymodfiyOrderInfo() {
let res = await this.api.paymodfiyOrderInfo({
orderId: this.listinfo.orderId,
})
},
/**
* 立即付款
*/
async showpopupclick() {
let res = await this.api.payorderPay({
orderId: this.orderId,
}) //判断是否支付成功
if (res.code == 0) {
uni.showLoading({
title: '加载中',
mask: true
})
// #ifdef MP-WEIXIN
uni.requestPayment({
provider: 'wxpay', //支付类型-固定值
partnerid: res.data.appId, // 微信支付商户号
timeStamp: res.data.timeStamp, // 时间戳(单位:秒)
nonceStr: res.data.nonceStr, // 随机字符串
package: res.data.package, // 固定值
signType: res.data.signType, //固定值
paySign: res.data.paySign, //签名
success: (res) => {
uni.showToast({
title: "支付成功"
})
setTimeout(res => {
uni.hideLoading()
uni.switchTab({
url: '/pages/order/order'
});
}, 500)
this.paymodfiyOrderInfo()
},
fail: (err) => {
uni.showToast({
icon: 'none',
title: '支付失败'
})
setTimeout(res => {
uni.hideLoading()
uni.switchTab({
url: '/pages/order/order'
});
}, 500)
}
});
// #endif
}
},
/**
* 复制订单号
* @param {Object} e
*/
copyHandle(e) {
uni.setClipboardData({
data: e,
success() {
uni.showToast({
title: '复制成功',
icon: 'none'
});
}
});
},
},
};
</script>
<style scoped lang="scss">
page{
background-color: #F7F7F7;
}
.container {
padding: 32rpx 28rpx 194rpx 28rpx;
}
.card_box{
background-color: #fff;
// box-shadow: 0rpx 8rpx 12rpx 2rpx rgba(87,86,86,0.35);
position: relative;
width: 100%;
height: 100%;
box-shadow: 0rpx 4rpx 12rpx 2rpx rgba(87,86,86,0.35);
border-radius: 18rpx;
.card_head_box{
width: 100%;
display: flex;
justify-content: space-between;
position: absolute;
top: -22.5rpx;
padding: 0 44rpx;
.card_head_item{
width: 45rpx;
height: 45rpx;
background-color: #f9f9f9;
border-radius: 50%;
box-shadow: inset 0rpx -13rpx 18rpx -16rpx rgba(87, 86, 86, 0.35);
}
}
}
.card {
// background-color: #fff;
border-radius: 20upx;
margin-bottom: 28upx;
position: relative;
.head {
display: flex;
justify-content: space-between;
padding: 50rpx 34rpx 32rpx 34rpx;
border-bottom: 2rpx dashed #E3E3E3;
.head_left{
.shopName{
font-weight: bold;
font-size: 32rpx;
color: #333333;
}
.tableName{
font-weight: 400;
font-size: 28rpx;
color: #333333;
}
}
.status {
text{
font-weight: 500;
font-size: 28rpx;
color: #333333;
}
}
}
.number-wrap {
display: flex;
flex-direction: column;
align-items: center;
margin-top: 32rpx;
.t{
font-weight: 400;
font-size: 28rpx;
color: #333333;
}
.number {
font-weight: bold;
font-size: 56rpx;
color: #333333;
}
}
.price {
.i {
font-size: 20upx;
}
.num {
font-size: 38upx;
}
}
.shop-box{
padding: 36rpx 34rpx 30rpx 34rpx;
border-bottom: 2rpx dashed #E3E3E3;
.shop-head{
display: flex;
justify-content: space-between;
align-items: center;
.shop-head-left{
display: flex;
align-items: center;
.tag-wrap{
width: 80rpx;
height: 48rpx;
background: #FFFFFF;
border-radius: 10rpx 10rpx 10rpx 10rpx;
border: 2rpx solid #E3AD7F;
margin-right: 18rpx;
display: flex;
align-items: center;
justify-content: center;
.tag{
font-weight: 400;
font-size: 24rpx;
color: #E3AD7F;
}
}
.title{
font-weight: bold;
font-size: 28rpx;
color: #333333;
}
}
}
.shop-info {
margin-top: 32rpx;
.item:nth-child(1) {
margin-top: 0;
}
.item {
margin-bottom: 32rpx;
display: flex;
.cover{
}
.info {
flex: 1;
display: flex;
flex-direction: column;
padding-left: 16upx;
.productName{
font-weight: bold;
font-size: 28rpx;
color: #333333;
margin-top: 20rpx;
}
.productSkuName{
font-weight: 400;
font-size: 24rpx;
color: #999999;
display: -webkit-box;
-webkit-box-orient: vertical;
-webkit-line-clamp: 3;
overflow: hidden;
text-overflow: ellipsis;
}
.n {
font-size: 24upx;
color: #999;
}
}
.price{
display: flex;
flex-direction: column;
align-items: flex-end;
padding-left: 68rpx;
.priceAmount{
font-weight: 500;
font-size: 28rpx;
color: #333333;
margin-top: 26rpx;
}
.num{
font-weight: 400;
font-size: 24rpx;
color: #999999;
margin-top: 22rpx;
}
}
}
}
.total-wrap {
width: 100%;
display: flex;
justify-content: space-between;
font-weight: 500;
font-size: 28rpx;
.price{
font-weight: bold;
font-size: 32rpx;
}
}
}
.order_footer{
display: flex;
flex-direction: column;
padding: 34rpx;
position: relative;
.order_footer_icon{
width: 100%;
position: absolute;
top: -22.5rpx;
left: 0;
display: flex;
justify-content: space-between;
.order_footer_left_icon{
width: 45rpx;
height: 45rpx;
margin-left: -22.5rpx;
background-color: #f9f9f9;
border-radius: 50%;
box-shadow: inset -20rpx 0rpx 22rpx -20rpx rgba(87, 86, 86, 0.35);
}
.order_footer_right_icon{
width: 45rpx;
height: 45rpx;
margin-right: -22.5rpx;
background-color: #f9f9f9;
border-radius: 50%;
box-shadow: inset 13rpx 0rpx 16rpx -9rpx rgba(87, 86, 86, 0.35);
}
}
.title{
font-weight: bold;
font-size: 28rpx;
color: #333333;
}
.order-info {
.row {
display: flex;
justify-content: space-between;
padding-top: 32upx;
.t {
font-weight: normal;
font-size: 28rpx;
color: #333333;
}
.info {
font-weight: 400;
font-size: 24rpx;
color: #666666;
}
}
}
}
}
.fixedview {
position: fixed;
bottom: 0;
left: 0;
width: 100%;
.flex-between {
width: 100%;
padding: 36rpx 54rpx 102rpx 54rpx;
background: #FFFFFF;
.fixedview_one {
display: flex;
align-items: flex-end;
.fixedview_oneone {
font-weight: 400;
font-size: 28rpx;
color: #666666;
}
.fixedview_onetow {
font-weight: bold;
font-size: 32rpx;
color: #333333;
text {
font-size: 24rpx;
}
}
}
.fixedview_tow {
width: 140rpx;
height: 56rpx;
line-height: 56rpx;
text-align: center;
background: #E3AD7F;
border-radius: 12rpx 12rpx 12rpx 12rpx;
font-weight: 400;
font-size: 28rpx;
color: #FFFFFF;
}
}
}
</style>

View File

@@ -1,336 +0,0 @@
<template>
<view>
<u-sticky bgColor="#fff">
<view class="tab-wrap">
<view class="item" v-for="(item, index) in tabs" :key="index" @click="orderswitch(item,index)">
<text>{{ item.name }}</text>
</view>
<view class="line-wrap"
:style="{ left: `${(100 / tabs.length) * active}%`, width: `${100 / tabs.length}%` }">
<view class="line"></view>
</view>
</view>
</u-sticky>
<view class="list-wrap">
<view class="item" v-for="(item,index) in list" :key="index" @click="orderinfo(item)">
<view class="header-wrap">
<text v-if="item.sendType == 'post'">快递</text>
<text v-if="item.sendType == 'takeaway'">外卖</text>
<text v-if="item.sendType == 'takeself'">自提</text>
<text v-if="item.sendType == 'table'">堂食</text>
<text class="status" v-if="item.status == 'unpaid' || item.status == 'paying'">
<text>待支付</text>
</text>
<text class="status" v-if="item.status == 'unsend'">
<text>待发货</text>
</text>
<text class="status" v-if="item.status == 'closed'">
<text>订单完成</text>
</text>
<text class="status" v-if="item.status == 'send'">
<text> 已发</text>
</text>
<text class="status" v-if="item.status == 'refunding'">
<text>申请退单</text>
</text>
<text class="status" v-if="item.status == 'refund'">
<text>退单</text>
</text>
<text class="status" v-if="item.status == 'cancelled'">
<text>取消订单</text>
</text>
<text class="status" v-if="item.status == 'merge'">
<text>合台</text>
</text>
</view>
<view class="content">
<view class="shop-info">
<view class="shop-item">
<view class="cover flex-start" v-for="(item1,index1) in item.detailList" :key="index1">
<!-- <image :src="item1.productImg" style="width: 200rpx;height: 200rpx; border-radius: 20rpx;" mode="widthFix"></image> -->
<u-image width="200" height="200" radius="20" :src="item1.productImg"></u-image>
</view>
<!-- <view class="info">
<text class="name">美味大宅蟹</text>
<text class="num">数量1</text>
</view> -->
</view>
</view>
<view class="total">
<text class="t">需付款</text>
<text class="i"></text>
<text class="num">{{item.orderAmount}}</text>
</view>
<view class="intro-wrap">
<text class="time">下单日期{{$u.timeFormat(item.createdAt, 'yyyy-mm-dd hh:MM')}}</text>
<text class="intro num">{{item.totalNumber}}件商品 合计{{item.orderAmount}}</text>
</view>
</view>
<view class="footer-wrap">
<view class="btn">
<text>查看详情</text>
</view>
</view>
</view>
</view>
<u-loadmore :status="form.status" fontSize="28" color="#999" iconSize="28" />
</view>
</template>
<script>
import list from '../../uni_modules/uview-ui/libs/config/props/list';
export default {
data() {
return {
active: 0,
tabs: [{
name: '全部',
type: 1,
status: ''
},
{
name: '待支付',
type: 2,
status: 'unpaid'
},
{
name: '待发货',
type: 3,
status: 'unsend'
},
{
name: '已完成',
type: 4,
status: 'closed'
},
{
name: '退款',
type: 5,
status: 'refund'
}
],
list: [],
is_end: false,
swiperCurrent: '',
form: {
page: 1,
size: 10,
status: 'loadmore',
},
};
},
onShow() {
if (uni.cache.get('token')) {
this.loginwxuserInfo()
}
if (this.tabs.findIndex((item) => item.type == this.useStorage.get('orderType')) == -1) {
this.active = 0
} else {
this.active = (this.tabs.findIndex((item) => item.type == this.useStorage.get('orderType')));
}
this.init_fn()
},
onReachBottom() {
this.orderorderList()
},
methods: {
async loginwxuserInfo() {
let res = await this.api.loginwxuserInfo({
userId: uni.cache.get('userInfo').id
})
if (res.code == 0) {
uni.cache.set('userInfo', res.data);
this.userInfo = uni.cache.get('userInfo')
}
},
orderinfo(e) {
uni.pro.navigateTo('order/order_detail', {
orderId: e.id
})
},
init_fn() {
this.list = []
this.is_end = false
this.form.page = 1
this.form.status = 'loadmore'
this.orderorderList()
},
orderswitch(e, a) {
this.active = a
if (e.type == 1) {
this.swiperCurrent = ''
} else {
this.swiperCurrent = e.status
}
this.init_fn()
},
async orderorderList() {
let res = await this.api.orderorderList({
page: this.form.page,
size: this.form.size,
userId: uni.cache.get('userInfo').id, //userId
status: this.swiperCurrent
})
if (res.data.length == 0) {
this.is_end = true
this.form.status = 'nomore'
return false;
} else {
this.form.status = 'loading';
this.form.page = ++this.form.page;
setTimeout(() => {
this.list = [...this.list, ...res.data];
if (res.data.length == 10) {
this.form.status = 'loading';
} else {
this.is_end = true;
this.form.status = 'nomore';
}
}, 500)
}
},
}
};
</script>
<style scoped lang="scss">
$tabH: 80upx;
$color: #ff411d;
.tab-wrap {
display: flex;
height: $tabH;
position: relative;
.item {
flex: 1;
display: flex;
align-items: center;
justify-content: center;
position: relative;
z-index: 2;
}
.line-wrap {
position: absolute;
bottom: 0;
display: flex;
justify-content: center;
padding-bottom: 8upx;
transition: all 0.3s ease-in-out;
.line {
$h: 6upx;
width: 30%;
height: $h;
border-radius: $h;
background-color: $color;
}
}
}
.list-wrap {
padding: $paddingSize;
.item {
border-radius: 20upx;
background-color: #fff;
&:not(:first-child) {
margin-top: $paddingSize;
}
.header-wrap {
padding: $paddingSize;
border-bottom: 1upx solid #ececec;
display: flex;
justify-content: space-between;
.status {
color: $color;
}
}
.content {
padding: $paddingSize;
.shop-info {
.shop-item {
display: flex;
overflow: hidden;
overflow-x: scroll;
.cover:nth-child(1) {
margin-left: 0rpx;
}
.cover {
// white-space: nowrap;
margin-left: 10rpx;
}
.info {
flex: 1;
display: flex;
flex-direction: column;
justify-content: space-around;
padding-left: 20upx;
}
}
}
.total {
display: flex;
align-items: flex-end;
justify-content: flex-end;
.t {
font-weight: bold;
font-size: 32upx;
}
.i {
font-size: 24upx;
}
.num {
font-size: 38upx;
position: relative;
top: 8upx;
}
}
.intro-wrap {
display: flex;
justify-content: space-between;
padding-top: $paddingSize;
.time {
color: #999;
font-size: 24upx;
}
.intro {
font-size: 24upx;
}
}
}
.footer-wrap {
display: flex;
justify-content: flex-end;
border-top: 1upx solid #ececec;
padding: $paddingSize;
.btn {
padding: 8upx 24upx;
border-radius: 100upx;
border: 1px solid #333;
display: flex;
align-items: center;
}
}
}
}
</style>

View File

@@ -170,7 +170,7 @@
},
wantEvent() {
uni.redirectTo({
url: '/pages/order/order_detail?orderId=' + this.orderId
url: '/pagesOrder/order_detail/index?orderId=' + this.orderId
});
},
async DoublingEvent() {

File diff suppressed because it is too large Load Diff

View File

@@ -226,6 +226,8 @@
</view>
</view>
</view>
<view class="placedOrderTip"><u-avatar :src="src" shape="circle"></u-avatar><view style="margin-left: 8rpx;">已下单菜品</view></view>
<!-- 购物车 -->
<u-popup :show="showCart" :round="20" :safeAreaInsetBottom="false" :zIndex="98" :overlayStyle="{ zIndex: 98 }"
@@ -241,31 +243,41 @@
<scroll-view scroll-y class="scroll-view">
<view class="list-wrap">
<view class="shop-item" v-for="(item,index) in cartLists.data" :key="item.id">
<view class="cover">
<u-image :src="item.coverImg" width="120" height="120"></u-image>
</view>
<view class="info">
<view class="name"> {{ item.name }} </view>
<view class="select-sku-wrap"> {{ item.skuName }} </view>
<view class="price-wrap" style="padding-top: 0;">
<view class="price">
<text class="i"></text>
<text class="num">{{ item.salePrice }}</text>
</view>
<view class="operation-wrap">
<view class="btn" v-if="item.number" >
<u-icon name="minus-circle-fill" size="50"></u-icon>
<view class="btnClick" @click="cartListadd(item,index,'-')"></view>
<view class="shop-item-content">
<view class="cover">
<u-image :src="item.coverImg" width="120" height="120"></u-image>
</view>
<view class="info">
<view class="name"> {{ item.name }} </view>
<view class="select-sku-wrap"> {{ item.skuName }} </view>
<view class="price-wrap" style="padding-top: 0;">
<view class="price">
<text class="i"></text>
<text class="num">{{ item.salePrice }}</text>
</view>
<text class="num" v-if="item.number">{{ item.number }}</text>
<view class="btn">
<u-icon name="plus-circle-fill" :color="item.isVip == 1 ? '#CECECE' : '#E9AB7A'" size="50"></u-icon>
<view class="btnClick" @click="cartListadd(item,index,'+')"></view>
<view class="operation-wrap">
<view class="btn" v-if="item.number" >
<u-icon name="minus-circle-fill" size="50"></u-icon>
<view class="btnClick" @click="cartListadd(item,index,'-')"></view>
</view>
<text class="num" v-if="item.number">{{ item.number }}</text>
<view class="btn">
<u-icon name="plus-circle-fill" :color="item.isVip == 1 ? '#CECECE' : '#E9AB7A'" size="50"></u-icon>
<view class="btnClick" @click="cartListadd(item,index,'+')"></view>
</view>
</view>
</view>
</view>
</view>
<view class="shop-item-remark">
<view class="label">备注</view>
<u--input
placeholder="商品备注(选填)"
border="none"
v-model="item.remark"
></u--input>
</view>
</view>
</view>
</scroll-view>
@@ -378,6 +390,7 @@
</view>
</u-popup>
<popupad :forceUpdate="forceUpdate" :showPosition="'make_order'"></popupad>
</view>
</template>
@@ -427,6 +440,7 @@
forceUpdate: false,
shopExtend: null,
shopId: null,
tableCode: null,
}
},
onPageScroll(e) {
@@ -456,10 +470,14 @@
}
},
onLoad(e) {
console.log(e)
if (e.q) {
this.tableCode = this.getQueryString(decodeURIComponent(e.q), 'code')
uni.cache.set('tableCode', this.tableCode)
}
if ( e.tableCode ) {
this.tableCode = e.tableCode
}
},
onUnload() {
if (this.socketTicket) {
@@ -581,6 +599,7 @@
this.shopId = res.data.storeInfo.id;
this.shopInfo = res.data;
this.productqueryProduct() //list 数据
this.getShopUserInfo() //list 数据
this.handlemessage() //监听websocket返回
this.getShopExtend();
} else {
@@ -590,7 +609,21 @@
}
},
/**
* 获取门店会员信息
*/
async getShopUserInfo() {
let res = await this.api.shopUserInfo({
"shopId": this.shopId,
"userId": uni.cache.get('userInfo').id,
})
if (res.code == 0) {
this.shopUserInfo = res.data;
uni.cache.set('shopUserInfo', res.data)
}
},
/**
* 图片加载
*/
@@ -1022,8 +1055,9 @@
})
return false
}
console.log(JSON.stringify(this.shopInfo.storeInfo))
uni.navigateTo({
url: `/pages/order_food/confirm_order?storeInfo=${JSON.stringify(this.shopInfo.storeInfo)}&cartList=${JSON.stringify(this.cartLists)}`
url: `/pagesOrder/confirm_order/index?storeInfo=${encodeURIComponent(JSON.stringify(this.shopInfo.storeInfo))}&cartLists=${JSON.stringify(this.cartLists)}&tableCode=${this.tableCode}`
});
},
@@ -1822,8 +1856,23 @@
.shop-item {
display: flex;
flex-direction: column;
padding-bottom: $paddingSize;
.shop-item-content{
display: flex;
}
.shop-item-remark{
display: flex;
align-items: center;
padding-right: 180rpx;
margin-top: 10rpx;
.label{
font-size: 28rpx;
color: #666;
margin-right: 20rpx;
}
}
.langcover {
position: relative;
}
@@ -1951,7 +2000,25 @@
}
}
.placedOrderTip{
width: 200rpx;
height: 60rpx;
display: flex;
align-items: center;
position: fixed;
justify-content: center;
right: 0;
top: 0;
bottom: 0;
margin: auto;
z-index: 99;
background-color: #fff;
font-weight: 400;
font-size: 24rpx;
color: #333333;
border-radius: 40rpx 0rpx 0rpx 40rpx;
box-shadow: 0rpx 6rpx 12rpx 2rpx rgba(0,0,0,0.16);
}
}
@@ -2250,5 +2317,6 @@
}
}
}
</style>

View File

@@ -125,31 +125,41 @@
<scroll-view scroll-y class="scroll-view">
<view class="list-wrap">
<view class="shop-item" v-for="(item,index) in cartLists.data" :key="item.id">
<view class="cover">
<u-image :src="item.coverImg" width="120" height="120"></u-image>
</view>
<view class="info">
<view class="name"> {{ item.name }} </view>
<view class="select-sku-wrap"> {{ item.skuName }} </view>
<view class="price-wrap" style="padding-top: 0;">
<view class="price">
<text class="i"></text>
<text class="num">{{ item.salePrice }}</text>
</view>
<view class="operation-wrap">
<view class="btn" v-if="item.number" >
<u-icon name="minus-circle-fill" color="#E9AB7A" size="50"></u-icon>
<view class="btnClick" @click="cartListadd(item,'-')"></view>
<view class="shop-item-content">
<view class="cover">
<u-image :src="item.coverImg" width="120" height="120"></u-image>
</view>
<view class="info">
<view class="name"> {{ item.name }} </view>
<view class="select-sku-wrap"> {{ item.skuName }} </view>
<view class="price-wrap" style="padding-top: 0;">
<view class="price">
<text class="i"></text>
<text class="num">{{ item.salePrice }}</text>
</view>
<text class="num" v-if="item.number">{{ item.number }}</text>
<view class="btn">
<u-icon name="plus-circle-fill" :color="item.isVip == 1 ? '#CECECE' : '#E9AB7A'" size="50"></u-icon>
<view class="btnClick" @click="cartListadd(item,'+')"></view>
<view class="operation-wrap">
<view class="btn" v-if="item.number" >
<u-icon name="minus-circle-fill" color="#E9AB7A" size="50"></u-icon>
<view class="btnClick" @click="cartListadd(item,'-')"></view>
</view>
<text class="num" v-if="item.number">{{ item.number }}</text>
<view class="btn">
<u-icon name="plus-circle-fill" :color="item.isVip == 1 ? '#CECECE' : '#E9AB7A'" size="50"></u-icon>
<view class="btnClick" @click="cartListadd(item,'+')"></view>
</view>
</view>
</view>
</view>
</view>
<view class="shop-item-remark">
<view class="label">备注</view>
<u--input
placeholder="商品备注(选填)"
border="none"
v-model="item.remark"
></u--input>
</view>
</view>
</view>
</scroll-view>
@@ -792,7 +802,7 @@
return false
}
uni.redirectTo({
url: `/pages/order_food/confirm_order?storeInfo=${JSON.stringify(this.shopInfo.storeInfo)}&cartList=${JSON.stringify(this.cartLists)}`
url: `/pagesOrder/confirm_order/index?storeInfo=${JSON.stringify(this.shopInfo.storeInfo)}&cartList=${JSON.stringify(this.cartLists)}`
});
},
@@ -1399,8 +1409,23 @@
.shop-item {
display: flex;
flex-direction: column;
padding-bottom: $paddingSize;
.shop-item-content{
display: flex;
}
.shop-item-remark{
display: flex;
align-items: center;
padding-right: 180rpx;
margin-top: 10rpx;
.label{
font-size: 28rpx;
color: #666;
margin-right: 20rpx;
}
}
.langcover {
position: relative;
}

View File

@@ -12,7 +12,8 @@
<tki-barcode ref="tkiBarcode" show :opations="tkiOptions"></tki-barcode>
</view>
<view class="ewm-wrap">
<uqrcode ref="uqrcode" canvas-id="qrcode" :value="createcardNo"></uqrcode>
<tki-qrcode ref="tkiQrcode" show :size="qrcodeSize"></tki-qrcode>
<!-- <uqrcode ref="uqrcode" canvas-id="qrcode" :value="createcardNo"></uqrcode> -->
</view>
<view class="name">
<text>使用门店{{shopInfo.shopName || '--'}}</text>
@@ -23,10 +24,13 @@
</template>
<script>
import tkiBarcode from '@/components/tki-barcode/tki-barcode.vue';
import tkiQrcode from '@/components/tki-qrcode/tki-qrcode.vue';
export default {
components: {
tkiBarcode
tkiBarcode,
tkiQrcode,
},
data() {
return {
@@ -35,12 +39,15 @@
fontSize: 28,
textMargin: 14
},
createcardNo: '',
qrcodeSize: 400,
createcardNo: '4637700074809642',
shopInfo: null
};
},
onLoad(e) {
this.shopInfo = JSON.parse(e.shopInfo)
},
mounted() {
this.logincreateCardNo();
},
methods: {
@@ -48,9 +55,12 @@
let res = await this.api.logincreateCardNo({
"shopId": this.shopInfo.shopId
})
console.log(res)
if (res.code == 0) {
this.createcardNo = res.data
this.createcardNo = res.data;
console.log(this.$refs.tkiBarcode)
this.$refs.tkiBarcode.setval(this.createcardNo) //操作属性
this.$refs.tkiQrcode.setval(this.createcardNo) //操作属性
}
}
}

View File

@@ -7,10 +7,10 @@
<view class="list_item_left">头像</view>
<view class="list_item_right flex-center">
<!-- #ifdef MP-WEIXIN -->
<button class="list_item_right_head" type="default" open-type="chooseAvatar" @chooseavatar="uploadImg">
<button class="list_item_right_head" type="default" open-type="chooseAvatar" @chooseavatar="onChooseAvatar">
<!-- #endif -->
<!-- #ifdef MP-ALIPAY -->
<button class="list_item_right_head" type="default" open-type="chooseAvatar" onChooseAvatar="uploadImg">
<button class="list_item_right_head" type="default" open-type="chooseAvatar" @chooseAvatar="onChooseAvatar">
<!-- #endif -->
<image class="list_item_right_head" :src="userHeadImg" mode="aspectFill"></image>
</button>
@@ -26,7 +26,12 @@
<view class="list_item">
<view class="list_item_left">账号</view>
<view class="list_item_right ">
<button v-if="!mobile" open-type="getPhoneNumber" @getphonenumber="getPhone">
<!-- #ifdef MP-WEIXIN -->
<button class="phone" v-if="!mobile" open-type="getPhoneNumber" @getphonenumber="getPhone">
<!-- #endif -->
<!-- #ifdef MP-ALIPAY -->
<button class="phone" v-if="!mobile" open-type="getAuthorize" scope='phoneNumber' @getAuthorize="getPhone" @error="getPhoneError">
<!-- #endif -->
<view class="flex-colum-end">
<view class="text">请授权手机号</view>
</view>
@@ -178,8 +183,8 @@
*/
getPhone(d) {
console.log(d)
// #ifdef MP-WEIXIN
if (d.detail.iv) {
// #ifdef MP-WEIXIN
uni.login({
provider: 'weixin',
success: async (data) => {
@@ -194,27 +199,36 @@
this.mobile = res.data;
}
});
// #endif
// #ifdef MP-ALIPAY
// 支付宝小程序环境
my.getAuthCode({
scopes: 'auth_user',
success: async (data) => {
console.log(data)
let res = await this.api.userwxlogins({
code: data.code,
encryptedData: d.detail.encryptedData,
iv: d.detail.iv,
})
this.phonetitle = res.data.substr(0, 3) + "****" + res.data.substr(7)
this.mobile = res.data;
}
});
// #endif
}
// #endif
// #ifdef MP-ALIPAY
// 支付宝小程序环境
my.getAuthCode({
scopes: 'auth_user',
success: (res) => {
console.log(res)
my.getPhoneNumber({
success: async (data) => {
console.log(data)
let res = await this.api.userwxlogins({
code: res.authCode,
encryptedData: d.response,
iv: d.detail.iv,
})
this.phonetitle = res.data.substr(0, 3) + "****" + res.data.substr(7)
this.mobile = res.data;
}
});
}
});
// #endif
},
getPhoneError (e) {
console.log(e)
},
/**
@@ -244,12 +258,11 @@
* 上传头像
* @param {Object} e
*/
uploadImg(e) {
console.log(e)
onChooseAvatar(e) {
const { avatarUrl } = e.detail
// this.userHeadImg = avatarUrl
uni.uploadFile({
url: 'https://wxcashiertest.sxczgkj.cn/cashierService/common/upload',
url: uni.conf.baseUrl + '/common/upload',
// url: uni.conf.baseUrl + '/common/upload',
filePath: avatarUrl,
header: {
@@ -289,6 +302,7 @@
uni.navigateBack()
}
}
},
computed: {
HeighT() { //手机类型的尺寸
@@ -334,6 +348,13 @@
margin-right: 16rpx;
padding: 0;
}
.phone{
border: none;
background-color: transparent;
// #ifdef MP-ALIPAY
display: initial;
// #endif
}
.place{
font-size: 28rpx;
color: #999;

View File

@@ -86,22 +86,16 @@
},
onShow() {
this.init_fn()
this.loginwxuserInfo()
if (uni.cache.get('shopId') ) {
this.getShopInfo();
this.shopInfo = uni.cache.get('shopUserInfo')
this.getShopExtend();
} else{
}
},
methods: {
// 下面初始数据
init_fn() {
},
/**
* 获取背景图
*/
@@ -154,23 +148,6 @@
});
},
/**
* 获取店铺信息
*/
async getShopInfo() {
let res = await this.api.shopUserInfo({
"shopId": uni.cache.get('shopId'),
"userId": uni.cache.get('userInfo').id,
})
if (res.code == 0) {
this.shopInfo = res.data
}
if ( res.data.isVip == 0 ) {
this.memberOpen = true;
return;
}
},
/**
* 查看二维码
*/