优惠券相关修改更新
This commit is contained in:
@@ -8,13 +8,16 @@
|
||||
<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 -->
|
||||
<button class="reg-head-img" type="default" open-type="chooseAvatar" @chooseavatar="onChooseAvatar">
|
||||
<image class="reg-head-img" :src="userHeadImg || 'https://czg-qr-order.oss-cn-beijing.aliyuncs.com/menber/head_default.png'" mode="aspectFill"></image>
|
||||
</button>
|
||||
<!-- #endif -->
|
||||
<!-- #ifdef MP-ALIPAY -->
|
||||
<button class="reg-head-img" @click="onChooseAvatar">
|
||||
<image class="reg-head-img" :src="userHeadImg || 'https://czg-qr-order.oss-cn-beijing.aliyuncs.com/menber/head_default.png'" mode="aspectFill"></image>
|
||||
</button>
|
||||
<!-- #endif -->
|
||||
|
||||
</view>
|
||||
</view>
|
||||
<view class="reg-cell">
|
||||
@@ -41,7 +44,7 @@
|
||||
</view>
|
||||
<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"/>
|
||||
<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 -->
|
||||
@@ -49,7 +52,7 @@
|
||||
<button class="getPhone" open-type="getAuthorize" scope='phoneNumber' @getAuthorize="getPhone" @error="getPhoneError">
|
||||
<!-- #endif -->
|
||||
|
||||
<view class="text">{{'获取微信手机号'}}</view>
|
||||
<view class="text">{{'获取手机号'}}</view>
|
||||
</button>
|
||||
</view>
|
||||
<view class="agreement">
|
||||
@@ -154,11 +157,10 @@
|
||||
* 上传头像
|
||||
* @param {Object} e
|
||||
*/
|
||||
uploadImg(e) {
|
||||
const {
|
||||
avatarUrl
|
||||
} = e.detail
|
||||
// this.userHeadImg = avatarUrl
|
||||
onChooseAvatar(e) {
|
||||
let _this = this;
|
||||
//#ifdef MP-WEIXIN
|
||||
let avatarUrl = e.detail.avatarUrl
|
||||
uni.uploadFile({
|
||||
url: uni.conf.baseUrl + '/common/upload',
|
||||
// url: uni.conf.baseUrl + '/common/upload',
|
||||
@@ -167,7 +169,9 @@
|
||||
environment: 'app',
|
||||
type: 'android',
|
||||
version: '1.7.3',
|
||||
'content-type': 'multipart/form-data'
|
||||
},
|
||||
fileType:'image',
|
||||
name: "file",
|
||||
formData: {
|
||||
file: avatarUrl,
|
||||
@@ -180,6 +184,49 @@
|
||||
console.log(res)
|
||||
}
|
||||
});
|
||||
// #endif
|
||||
//#ifdef MP-ALIPAY
|
||||
uni.chooseImage({
|
||||
count: 1, // 默认9,设置图片的数量
|
||||
sizeType: ['original', 'compressed'], // 可以指定是原图还是压缩图,默认二者都有
|
||||
sourceType: ['album', 'camera'], // 可以指定来源是相册还是相机,默认二者都有
|
||||
success: function (res) {
|
||||
// 成功选择图片后
|
||||
let avatarUrl = res.tempFilePaths[0]; // 获取文件路径
|
||||
|
||||
my.uploadFile({
|
||||
url: uni.conf.baseUrl + '/common/upload',
|
||||
// url: uni.conf.baseUrl + '/common/upload',
|
||||
filePath: avatarUrl,
|
||||
header: {
|
||||
environment: 'app',
|
||||
type: 'android',
|
||||
version: '1.7.3',
|
||||
'content-type': 'multipart/form-data'
|
||||
},
|
||||
fileType:'image',
|
||||
name: "file",
|
||||
formData: {
|
||||
file: avatarUrl,
|
||||
},
|
||||
success: (uploadFileRes) => {
|
||||
let { data } = JSON.parse(uploadFileRes.data)
|
||||
_this.userHeadImg = data
|
||||
},
|
||||
fail: (res) => {
|
||||
console.log(res)
|
||||
}
|
||||
});
|
||||
},
|
||||
fail: (res) => {
|
||||
console.log(res)
|
||||
}
|
||||
});
|
||||
|
||||
// #endif
|
||||
|
||||
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
|
||||
@@ -372,8 +372,8 @@
|
||||
title: '加载中',
|
||||
mask: true
|
||||
})
|
||||
// #ifdef MP-WEIXIN
|
||||
uni.requestPayment({
|
||||
// #ifdef MP-WEIXIN
|
||||
provider: 'wxpay', //支付类型-固定值
|
||||
partnerid: res.data.appId, // 微信支付商户号
|
||||
timeStamp: res.data.timeStamp, // 时间戳(单位:秒)
|
||||
@@ -381,12 +381,18 @@
|
||||
package: res.data.package, // 固定值
|
||||
signType: res.data.signType, //固定值
|
||||
paySign: res.data.paySign, //签名
|
||||
// #endif
|
||||
// #ifdef MP-ALIPAY
|
||||
provider: 'alipay', //支付类型-固定值
|
||||
orderInfo: res.data.tradeNo, // 微信支付商户号
|
||||
// #endif
|
||||
success: (res) => {
|
||||
uni.showToast({
|
||||
title: "支付成功"
|
||||
})
|
||||
uni.hideLoading()
|
||||
let pages = getCurrentPages()
|
||||
// #ifdef MP-WEIXIN
|
||||
uni.requestSubscribeMessage({
|
||||
tmplIds:["AV-KybUHaK3KtFVLqpy6PHccHBS7XeX__mOM4RbufnQ"],
|
||||
complete() {
|
||||
@@ -406,6 +412,22 @@
|
||||
|
||||
},
|
||||
})
|
||||
// #endif
|
||||
// #ifdef MP-ALIPAY
|
||||
if ( _this.type && _this.type == "topUpActivity") {
|
||||
uni.pro.navigateBack()
|
||||
} else {
|
||||
if ( pages.length > 1) {
|
||||
_this.shopInfo()
|
||||
} else {
|
||||
setTimeout(res => {
|
||||
uni.switchTab({
|
||||
url: '/pages/index/index'
|
||||
})
|
||||
}, 500)
|
||||
}
|
||||
}
|
||||
// #endif
|
||||
|
||||
|
||||
|
||||
@@ -415,7 +437,6 @@
|
||||
}
|
||||
});
|
||||
uni.hideLoading()
|
||||
// #endif
|
||||
}
|
||||
},
|
||||
|
||||
|
||||
@@ -28,10 +28,10 @@
|
||||
<text>{{shopUserInfo.amount || '0.00'}}</text><text>储值</text>
|
||||
</view>
|
||||
<view class="card_bom_item">
|
||||
<text>0</text><text>积分</text>
|
||||
<text>{{shopUserInfo.accountPoints || '0'}}</text><text>积分</text>
|
||||
</view>
|
||||
<view class="card_bom_item" @click="itemClick(3)">
|
||||
<text>0</text><text>优惠券</text>
|
||||
<text>{{shopUserInfo.couponNum || '0'}}</text><text>优惠券</text>
|
||||
</view>
|
||||
<view class="card_bom_item">
|
||||
<text>0</text><text>权益卡</text>
|
||||
@@ -49,7 +49,7 @@
|
||||
<view class="card_bottom_title">感谢你 2 天陪伴</view>
|
||||
<view class="flex-start">
|
||||
<view class="card_bottom_text">您今天的幸运词:<text class="luckyWord">林波微步</text></view>
|
||||
<image class="card_bottom_icon" src="https://czg-qr-order.oss-cn-beijing.aliyuncs.com/menber/member_icon2.png" mode="aspectFill"></image>
|
||||
<!-- <image class="card_bottom_icon" src="https://czg-qr-order.oss-cn-beijing.aliyuncs.com/menber/member_icon2.png" mode="aspectFill"></image> -->
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
<text class="top_box_one_text">当前账号</text>
|
||||
<input type="number" v-model="mobile" placeholder="请输入手机号" maxlength="11" disabled="disabled" />
|
||||
<button v-if="!mobile" class="getPhone" open-type="getPhoneNumber" @getphonenumber="getPhone">
|
||||
<view class="text">获取微信手机号</view>
|
||||
<view class="text">获取手机号</view>
|
||||
</button>
|
||||
|
||||
</view>
|
||||
|
||||
@@ -96,22 +96,16 @@
|
||||
tableCode:{
|
||||
immediate: true,
|
||||
handler (newVal) {
|
||||
console.log(newVal)
|
||||
console.log("tableCode1==",this.tableCode)
|
||||
}
|
||||
},
|
||||
shopId:{
|
||||
immediate: true,
|
||||
handler (newVal) {
|
||||
console.log(newVal)
|
||||
console.log("shopId1==",this.shopId)
|
||||
}
|
||||
},
|
||||
|
||||
},
|
||||
mounted() {
|
||||
console.log("tableCode3==",this.tableCode)
|
||||
console.log("shopId3==",this.shopId)
|
||||
},
|
||||
methods: {
|
||||
|
||||
@@ -128,8 +122,6 @@
|
||||
* @param {Object} a
|
||||
*/
|
||||
async cartListadd(item, index, c) {
|
||||
console.log(this.shopId)
|
||||
console.log(this.tableCode)
|
||||
try {
|
||||
if ( c == "+" && item.isVip == 1){
|
||||
return;
|
||||
|
||||
@@ -55,17 +55,11 @@
|
||||
|
||||
},
|
||||
mounted() {
|
||||
console.log("tableCode==",this.tableCode)
|
||||
console.log("shopId==",this.shopId)
|
||||
},
|
||||
watch:{
|
||||
tableCode(newVal, oldValue) {
|
||||
console.log(newVal)
|
||||
console.log("tableCode2==",this.tableCode)
|
||||
},
|
||||
shopId(newVal, oldValue) {
|
||||
console.log(newVal)
|
||||
console.log("shopId2==",this.tableCode)
|
||||
},
|
||||
},
|
||||
methods: {
|
||||
|
||||
@@ -991,7 +991,6 @@
|
||||
})
|
||||
this.salePrice = res.data.salePrice // 价格
|
||||
let data = null;
|
||||
console.log(a)
|
||||
if (a == 1) { //1添加购物车 2是websocket返回这个商品的价格(应为不同的多规格商品返回不同的价格)
|
||||
let params = {
|
||||
"skuId": res.data.id,
|
||||
|
||||
@@ -35,7 +35,7 @@
|
||||
'containertopboxitemleft_tows': status != 1,
|
||||
'containertopboxitemleft_nameVip': item.type == 2,
|
||||
}">
|
||||
{{ item.type == 2 ? item.detail : '优惠券(元)'}}
|
||||
{{ item.type == 2 ? item.name : '优惠券(元)'}}
|
||||
</view>
|
||||
</view>
|
||||
|
||||
@@ -84,19 +84,27 @@
|
||||
{
|
||||
name: '已使用',
|
||||
type: '2'
|
||||
},
|
||||
{
|
||||
name: '已过期',
|
||||
type: '-1'
|
||||
}
|
||||
],
|
||||
tabIndex: 1,
|
||||
list: [],
|
||||
status: 1,
|
||||
type: "",
|
||||
payAmount: 0,
|
||||
shoppingCart: [],
|
||||
productList: [],
|
||||
|
||||
};
|
||||
},
|
||||
onLoad(options) {
|
||||
if (options.type) {
|
||||
this.type = options.type;
|
||||
}
|
||||
if (options.type) { this.type = options.type }
|
||||
if (options.payAmount) { this.payAmount = options.payAmount }
|
||||
if (options.shoppingCart) { this.shoppingCart = JSON.parse(decodeURIComponent(options.shoppingCart)) }
|
||||
if (options.productList) { this.productList = JSON.parse(decodeURIComponent(options.productList)) }
|
||||
this.getCouponList()
|
||||
},
|
||||
|
||||
@@ -117,13 +125,26 @@
|
||||
*/
|
||||
async getCouponList() {
|
||||
try {
|
||||
let res = await this.api.conponList({
|
||||
let params = {
|
||||
userId: uni.cache.get('userInfo').id,
|
||||
shopId: uni.cache.get('shopId'),
|
||||
status: this.status
|
||||
})
|
||||
}
|
||||
if ( this.type == 'confirm_order_coupon' || this.type == 'confirm_order_product' ) {
|
||||
params.orderId = -1;
|
||||
}
|
||||
let res = await this.api.conponList(params)
|
||||
if (res.code == 0) {
|
||||
this.list = res.data;
|
||||
console.log(res)
|
||||
let list = [];
|
||||
if ( this.type == 'confirm_order_coupon') {
|
||||
list = res.data.filter(v => v.type == 1);
|
||||
}else if ( this.type == 'confirm_order_product') {
|
||||
list = res.data.filter(v => v.type == 2);
|
||||
} else {
|
||||
list = res.data;
|
||||
}
|
||||
this.list = list;
|
||||
}
|
||||
} catch (e) {
|
||||
//TODO handle the exception
|
||||
@@ -135,9 +156,73 @@
|
||||
*/
|
||||
navigatorGo ( item ) {
|
||||
uni.cache.set('shopId',item.shopId)
|
||||
if ( this.type == 'confirm_order') {
|
||||
uni.$emit('couponItem', JSON.stringify(item))
|
||||
uni.navigateBack();
|
||||
if ( this.type == 'confirm_order_coupon' || this.type == 'confirm_order_product') {
|
||||
if ( item.type == 1 ) {
|
||||
if( this.payAmount < item.fullAmount) {
|
||||
uni.showToast({
|
||||
title: "当前订单金额不足使用金额",
|
||||
icon: "none",
|
||||
})
|
||||
return;
|
||||
}
|
||||
uni.$emit('couponItem', JSON.stringify(item))
|
||||
uni.navigateBack();
|
||||
} else {
|
||||
let productNum = 0;//商品购物车数量
|
||||
let productTicketNum = 0;//商品券使用数量
|
||||
let product = this.shoppingCart.filter(v => v.productId == item.proId);
|
||||
let productTicket = this.productList.filter(v => v.productId == item.proId);
|
||||
if ( product.length <= 0 ) {
|
||||
uni.showToast({
|
||||
title: "购物车没有"+item.name,
|
||||
icon: "none",
|
||||
})
|
||||
return;
|
||||
}
|
||||
if (this.productList.filter(v => v.userCouponId == item.id).length > 0) {
|
||||
uni.showToast({
|
||||
title: `当前优惠券已选择`,
|
||||
icon: "none",
|
||||
})
|
||||
return;
|
||||
}
|
||||
// 计算当前商品购物车数量
|
||||
product.forEach(item => {
|
||||
productNum += item.number;
|
||||
})
|
||||
// 计算当前商品券使用数量
|
||||
productTicket.forEach(item => {
|
||||
productTicketNum += item.num;
|
||||
})
|
||||
if ( (productNum - productTicketNum) == 0 ) {
|
||||
uni.showToast({
|
||||
title: `当前商品已经全部抵扣`,
|
||||
icon: "none",
|
||||
})
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
|
||||
// let productNum = 0;
|
||||
// product.map(item => {
|
||||
// productNum += item.number
|
||||
// })
|
||||
// if ( productNum < item.num) {
|
||||
// uni.showToast({
|
||||
// title: `购物车${item.name}数量不足`,
|
||||
// icon: "none",
|
||||
// })
|
||||
// return;
|
||||
// }
|
||||
// if (product[0].number item.num) {
|
||||
|
||||
// }
|
||||
uni.$emit('couponItem', JSON.stringify(item))
|
||||
uni.navigateBack();
|
||||
}
|
||||
|
||||
|
||||
} else {
|
||||
uni.pro.navigateTo('/pages/order_food/order_food', {
|
||||
shopId: item.shopId
|
||||
@@ -163,7 +248,7 @@
|
||||
margin-top: 32rpx;
|
||||
|
||||
.towcontentlistxitembox {
|
||||
width: 50%;
|
||||
width: 33.33%;
|
||||
font-family: PingFang SC, PingFang SC;
|
||||
font-weight: 500;
|
||||
font-size: 28rpx;
|
||||
|
||||
@@ -8,12 +8,15 @@
|
||||
<view class="list_item_right flex-center">
|
||||
<!-- #ifdef MP-WEIXIN -->
|
||||
<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" @chooseAvatar="onChooseAvatar">
|
||||
<!-- #endif -->
|
||||
<image class="list_item_right_head" :src="userHeadImg" mode="aspectFill"></image>
|
||||
</button>
|
||||
<!-- #endif -->
|
||||
<!-- #ifdef MP-ALIPAY -->
|
||||
<button class="list_item_right_head" @click="onChooseAvatar">
|
||||
<image class="list_item_right_head" :src="userHeadImg" mode="aspectFill"></image>
|
||||
</button>
|
||||
<!-- #endif -->
|
||||
|
||||
<u-icon name="arrow-right" color="#999999" size="16"></u-icon>
|
||||
</view>
|
||||
</view>
|
||||
@@ -257,8 +260,9 @@
|
||||
* @param {Object} e
|
||||
*/
|
||||
onChooseAvatar(e) {
|
||||
const { avatarUrl } = e.detail
|
||||
// this.userHeadImg = avatarUrl
|
||||
let _this = this;
|
||||
//#ifdef MP-WEIXIN
|
||||
let avatarUrl = e.detail.avatarUrl
|
||||
uni.uploadFile({
|
||||
url: uni.conf.baseUrl + '/common/upload',
|
||||
// url: uni.conf.baseUrl + '/common/upload',
|
||||
@@ -267,22 +271,63 @@
|
||||
environment: 'app',
|
||||
type: 'android',
|
||||
version: '1.7.3',
|
||||
'content-type': 'multipart/form-data'
|
||||
},
|
||||
fileType:'image',
|
||||
name: "file",
|
||||
formData: {
|
||||
file: avatarUrl,
|
||||
},
|
||||
success: (uploadFileRes) => {
|
||||
console.log(uploadFileRes)
|
||||
let {
|
||||
data
|
||||
} = JSON.parse(uploadFileRes.data)
|
||||
let { data } = JSON.parse(uploadFileRes.data)
|
||||
this.userHeadImg = data
|
||||
},
|
||||
fail: (res) => {
|
||||
console.log(res)
|
||||
}
|
||||
});
|
||||
// #endif
|
||||
//#ifdef MP-ALIPAY
|
||||
uni.chooseImage({
|
||||
count: 1, // 默认9,设置图片的数量
|
||||
sizeType: ['original', 'compressed'], // 可以指定是原图还是压缩图,默认二者都有
|
||||
sourceType: ['album', 'camera'], // 可以指定来源是相册还是相机,默认二者都有
|
||||
success: function (res) {
|
||||
// 成功选择图片后
|
||||
let avatarUrl = res.tempFilePaths[0]; // 获取文件路径
|
||||
|
||||
my.uploadFile({
|
||||
url: uni.conf.baseUrl + '/common/upload',
|
||||
// url: uni.conf.baseUrl + '/common/upload',
|
||||
filePath: avatarUrl,
|
||||
header: {
|
||||
environment: 'app',
|
||||
type: 'android',
|
||||
version: '1.7.3',
|
||||
'content-type': 'multipart/form-data'
|
||||
},
|
||||
fileType:'image',
|
||||
name: "file",
|
||||
formData: {
|
||||
file: avatarUrl,
|
||||
},
|
||||
success: (uploadFileRes) => {
|
||||
let { data } = JSON.parse(uploadFileRes.data)
|
||||
_this.userHeadImg = data
|
||||
},
|
||||
fail: (res) => {
|
||||
console.log(res)
|
||||
}
|
||||
});
|
||||
},
|
||||
fail: (res) => {
|
||||
console.log(res)
|
||||
}
|
||||
});
|
||||
|
||||
// #endif
|
||||
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user