23 Commits

Author SHA1 Message Date
GaoHao
e17d5ffcaa 优惠券相关更新 2024-11-25 17:11:42 +08:00
GaoHao
18aecb9f6c 2.0.0修改更新 2024-11-25 17:08:21 +08:00
GaoHao
740a3201e4 2.0.0相关修改更新 2024-11-25 16:06:59 +08:00
GaoHao
28950f0ad1 优惠券相关更新 2024-11-23 10:05:04 +08:00
GaoHao
ecb615e9c8 支付完成返回订单列表更新 2024-11-21 18:23:35 +08:00
GaoHao
09aee024e0 霸王餐提交字段修改 2024-11-21 17:59:17 +08:00
GaoHao
20350ea247 先下单后付款了积分调整 2024-11-21 17:00:47 +08:00
GaoHao
88478b2768 优惠券使用相关更新 2024-11-21 16:39:41 +08:00
GaoHao
151562d5e6 优惠券相关更新 2024-11-21 16:27:32 +08:00
GaoHao
76a80729c8 2.0.0更新 2024-11-21 09:52:40 +08:00
GaoHao
f7a2f588ef 商品券相关优化更新 2024-11-21 09:46:04 +08:00
GaoHao
8c5e03d6c4 商品兑换券更新 2024-11-19 16:58:37 +08:00
GaoHao
d2dbfd5163 商品券处理 2024-11-19 13:52:56 +08:00
GaoHao
69151ca3f4 先下单后支付优惠券相关调试 2024-11-18 16:41:32 +08:00
GaoHao
fb4f8820a4 充值界面优化 2024-11-18 15:11:35 +08:00
GaoHao
89943e7f10 更新2.0.0 2024-11-18 15:00:46 +08:00
GaoHao
04f0fef615 Merge branch 'gaohao' of https://e.coding.net/g-cphe0354/xiaochengxusaomadiancan/cashier_weapp into dev 2024-11-18 15:00:32 +08:00
GaoHao
c679b60cb7 优惠券相关修改更新 2024-11-18 14:18:10 +08:00
GaoHao
2808dec925 积分显示更新 2024-11-12 11:06:34 +08:00
GaoHao
4cf6352494 更新打包 2024-11-11 18:00:12 +08:00
GaoHao
2caee2bd1a 会员价,优惠券,打包费相关更新 2024-11-11 17:22:28 +08:00
GaoHao
7167c2604f 分享优惠券更新 2024-11-08 17:32:35 +08:00
GaoHao
7b81e2ffb0 积分抵扣、霸王餐、优惠券分享新增 2024-11-07 15:02:44 +08:00
36 changed files with 3931 additions and 1116 deletions

View File

@@ -37,7 +37,6 @@
},
onShow: function() {
// 获取导航栏信息
wx.getSystemInfo({
success: res => {
this.globalData.systemInfo = res;
@@ -150,7 +149,7 @@
}
page {
background-color: #F9F9F9;
background-color: #F6F6F6!important;
}
text {

View File

@@ -71,7 +71,7 @@ export default {
paymemeberIn(data) { //充值
return uni.api.post("/pay/memeberIn", data);
},
orderorderList(data) { //订单列表
return uni.api.get("/order/orderList", data);
@@ -85,6 +85,9 @@ export default {
creatOrder(data) { //创建订单
return uni.api.post("/order/creatOrder", data);
},
useCoupon(data) { //订单选择优惠券
return uni.api.post("/order/useCoupon", data);
},
// 团购订单列表
@@ -152,9 +155,12 @@ export default {
locationdistrict(data) { //获取行政区域(区,街道)
return uni.api.get("/location/district", data);
},
queryMemberAccount(data) { //获取行政区域(区,街道)
queryMemberAccount(data) { //获取余额明细
return uni.api.get("/pay/queryMemberAccount", data);
},
queryMemberPointsLog(data) { //获取余额明细
return uni.api.get("/api/points/member-points-log/page", data);
},
ordermineCoupons(data) { //我的优惠券
return uni.api.get("/order/mineCoupons", data, false);
},
@@ -285,5 +291,107 @@ export default {
cancelTakeNumber(data) {
return uni.api.post("/callTable/cancel", data, false);
},
/**
* 积分-基本设置-获取店铺设置
* @param {Object} param
*/
shopSettingInfo(shopId) {
return uni.api.get(`/api/points/basic-setting/${shopId}`);
},
/**
* 积分-兑换商品列表
* @param {Object} param
*/
pointsGoodsList(param) {
return uni.api.get("/api/points/goods-setting/page", param);
},
/**
* 积分-生成订单
* @param {Object} data
*/
pointsCreateOrder(data) {
return uni.api.post("/api/points/exchange-record/create", data);
},
/**
* 积分-支付订单
* @param {Object} data
*/
pointsPayOrder(data) {
return uni.api.post("/api/points/exchange-record/pay", data);
},
/**
* 积分-取消订单
* @param {Object} data
*/
pointsCancelOrder(data) {
return uni.api.post("/api/points/exchange-record/cancel", data);
},
/**
* 积分-001-会员积分账户信息
* @param {Object} param
*/
memberPointsInfo(memberId) {
return uni.api.get(`/api/points/member-points/${memberId}`, );
},
/**
* 积分-明细列表
* @param {Object} param
*/
memberPointsLogList(param) {
return uni.api.get("/api/points/member-points-log/page", param);
},
/**
* 积分-兑换记录-列表
* @param {Object} param
*/
exchangeRecordList(param) {
return uni.api.get("/api/points/exchange-record/page", param);
},
/**
* 积分-获取订单可用积分及抵扣金额
* @param {Object} param
*/
calcUsablePoints(param) {
return uni.api.get("/api/points/member-points/calc-usable-points", param);
},
/**
* 分享-获取邀请页数据
* @param {Object} param
*/
getByShopId(param) {
return uni.api.get("/tbShopShare/getByShopId", param);
},
/**
* 分享-邀请记录
* @param {Object} param
*/
shareRecord(param) {
return uni.api.get("/tbShopShare/record", param);
},
/**
* 分享-被邀请人进入页面时使用
* @param {Object} param
*/
shareHeOpen(param) {
return uni.api.post("/tbShopShare/open", param);
},
/**
* 分享-被邀请人领取优惠券时使用
* @param {Object} param
*/
shareReceive(param) {
return uni.api.post("/tbShopShare/receive", param);
},
}

View File

@@ -12,14 +12,15 @@
radius='10'
@change="e => current = e.current"
@click="swiperClick"
bgColor="transparent" height='720'
bgColor="transparent" height="920"
>
<view slot="indicator" class="indicator">
<!-- <view slot="indicator" class="indicator"> -->
<!-- <view class="indicator__dot" v-for="(item, index) in carousel" :key="index"
:class="[index === current && 'indicator__dot--active']"
:style="[index === current && {'width':16+'px'}]">
</view> -->
</view>
<!-- </view> -->
</u-swiper>
</view>
@@ -75,8 +76,9 @@
swiperClick (e) {
let item = this.popupadList[e];
if ( item.linkPath ) {
uni.navigateTo({
url: `${item.linkPath}`
uni.pro.navigateTo(item.linkPath, {
shopId: uni.cache.get('shopId'),
is_type: "me",
})
}
},
@@ -207,7 +209,8 @@
justify-content: center;
align-items: center;
.swiperBox{
width: 80%;
width: 85%;
margin-top: 50rpx;
margin-bottom: 50rpx;
}
.swiper__wrapper__item__wrapper__image{

View File

@@ -8,8 +8,10 @@ const proxyApi = "/api"
// const proxyApiwws = 'ws://192.168.1.15:9888/netty' // 测试
// const proxyApi = 'https://wxcashiertest.sxczgkj.cn/cashierService' // 测试
// const proxyApiwws = 'wss://wxcashiertest.sxczgkj.cn/netty' // 测试
const proxyApi = 'https://pre-cashier.sxczgkj.cn/cashierService' // 预发布
const proxyApiwws = 'wss://pre-cashier.sxczgkj.cn/netty' // 预发布
// const proxyApi = 'https://pre-cashier.sxczgkj.cn/cashierService' // 预发布
// const proxyApiwws = 'wss://pre-cashier.sxczgkj.cn/netty' // 预发布
const proxyApi = 'https://cashier.sxczgkj.cn/cashierService' // 线上
const proxyApiwws = 'wss://cashier.sxczgkj.cn/netty' // 线上
// #endif
// #ifdef H5

View File

@@ -260,6 +260,7 @@ const getUserInfo = function (successCallback, failCallback) {
},
fail: (err) => {}
});
}
});
@@ -269,23 +270,23 @@ const getUserInfo = function (successCallback, failCallback) {
// #ifdef MP-ALIPAY
return new Promise((resolve, reject) => {
my.getAuthCode({
scopes: 'auth_user',
success: (data) => {
scopes: 'auth_base',
success: async (data) => {
console.log(data)
// 支付宝小程序环境
my.getAuthUserInfo({
success: async (infoRes) => {
// my.getAuthUserInfo({
// success: async (infoRes) => {
let res = await Api.userwxlogin({
code: data.authCode, //临时登录凭证
rawData: JSON.stringify(infoRes),
// rawData: JSON.stringify(infoRes),
source: 'alipay'
})
if (res.code == 0) {
resolve(res)
}
},
fail: (err) => {}
});
// },
// fail: (err) => {}
// });
}
});
})

View File

@@ -125,7 +125,6 @@ async function request(options) {
uni.cache.set('storage:offset-time', offset, -1)
return await request(options)
} else {
console.log(options)
uni.showToast({
title: res.message || res.msg || res.error,
icon: "none",

View File

@@ -373,6 +373,63 @@
}
}
]
},
{
"root": "pagesPoints",
"pages": [
{
"path": "index/index",
"style": {
"navigationBarTitleText": "积分商城",
"navigationBarBackgroundColor": "#E9B183"
}
},
{
"path": "goodsDetail/index",
"style": {
"navigationBarTitleText": "商品详情"
}
},
{
"path": "exchangeRecord/index",
"style": {
"navigationBarTitleText": "兑换记录"
}
},
{
"path": "exchangeRecordDetail/index",
"style": {
"navigationBarTitleText": "订单详情"
}
},
{
"path": "IntegralDetail/index",
"style": {
"navigationBarTitleText": "积分明细"
}
},
{
"path": "confirm_order/index",
"style": {
"navigationBarTitleText": "确认订单",
"navigationBarBackgroundColor": "#E9B183"
}
}
]
},
{
"root": "pagesInviteFriends",
"pages": [
{
"path": "index/index",
"style": {
"navigationBarTitleText": "邀请好友",
"navigationStyle": "custom"
}
}
]
}
],
"globalStyle": {

View File

@@ -4,11 +4,11 @@
<view class="bild">
<view class="bildLeft">
<text>我的余额</text>
<view>{{info.amount}}</view>
<view>{{info.amount||0}}</view>
</view>
<view class="bildRight">
<text>我的积分</text>
<view>{{info.levelConsume}}</view>
<view>{{info.accountPoints||0}}</view>
</view>
</view>
<view class="navTop">
@@ -22,18 +22,20 @@
</view>
</view>
<view class="listStyle " v-for="(item,i) in list" :key="i">
<image class="head_img" :src="item.head_img?item.head_img:'https://czg-qr-order.oss-cn-beijing.aliyuncs.com/menber/head_default.png'" style="width: 76rpx;height: 76rpx;float: left;" mode=""></image>
<!-- <image class="head_img" :src="item.head_img?item.head_img:'https://czg-qr-order.oss-cn-beijing.aliyuncs.com/menber/head_default.png'" style="width: 76rpx;height: 76rpx;float: left;" mode=""></image> -->
<view class="flex-start">
<view class="listStyle_left">
<view class="listrigth">
<view>{{item.biz_name}}</view>
<view :class="[item.type == '+'?'colorStyle':'']">{{item.type}}{{item.amount}}
<view>{{active == 1 ? item.biz_name : item.content}}</view>
<view :class="{colorStyle: (active==1&&item.type == '+') || (active==2&&item.floatType=='add')}">
{{ active == 1 ? item.type : (item.floatType == 'add'?'+':'')}}
{{active == 1 ? item.amount : item.floatPoints}}
</view>
</view>
</view>
<view class="listrigth2">
<view>{{$u.timeFormat(item.create_time, 'yyyy-mm-dd hh:MM:ss')}}</view>
<view>余额:{{item.balance}}</view>
<view>{{$u.timeFormat(active == 1 ? item.create_time : item.createTime, 'yyyy-mm-dd hh:MM:ss')}}</view>
<view v-if="active == 1">余额:{{item.balance}}</view>
</view>
</view>
@@ -53,13 +55,15 @@
pageSize: 10,
memberId: null
},
info: null
info: null,
shopId: null
}
},
onLoad(e) {
console.log(JSON.parse(e.shopUserInfo))
this.info = JSON.parse(e.shopUserInfo)
this.form.memberId = this.info.id;
this.shopId = this.info.shopId;
this.getlist()
},
onReachBottom() {
@@ -73,20 +77,29 @@
},
async getlist() {
if (this.active == 1) {
let res = await this.api.queryMemberAccount(this.form)
let res = await this.api.queryMemberAccount({
...this.form
})
if (res.code == 0 && res.data.list.length > 0) {
console.log(this.list.length)
this.list = this.list.concat(res.data.list)
this.form.page++
console.log(this.list)
}
} else {
this.list = []
let res = await this.api.queryMemberPointsLog({
shopId: this.shopId,
...this.form
})
if (res.code == 0 && res.data.list.length > 0) {
this.list = this.list.concat(res.data.list)
this.form.page++
}
}
},
clickEvent(i) {
this.active = i;
this.form.page = 1;
this.list = []
this.getlist()
}
}
@@ -165,7 +178,7 @@
.listrigth {
.colorStyle {
// color: #FF7127;
color: #FF7127;
}
>view {

View File

@@ -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
},
/**

View File

@@ -1,723 +0,0 @@
<template>
<view class="content">
<view class="location" @click="openLocation">
<image class="location_icon" src="https://czg-qr-order.oss-cn-beijing.aliyuncs.com/menber/location.png" mode="aspectFill"></image>
<view>{{ shopUserInfo.shopName }}</view>
<u-icon name="arrow-right" color="#575B66" size="28"></u-icon>
</view>
<view class="card_info flex-colum">
<view class="title">账户余额()</view>
<view class="card_info_con flex-between">
<view class="balance">{{shopUserInfo.amount || '0.00'}}</view>
<view class="card_info_con_right flex-end">
<view class ="card_info_con_right_item flex-colum" @click="handleClick(item)" v-for="(item,index) in cardManageList" :key="index">
<image class="card_info_con_right_item_icon" :src="item.icon" mode="aspectFill"></image>
<text class="card_info_con_right_item_text">{{item.name}}</text>
</view>
</view>
</view>
</view>
<view class="customAmount" v-if="shopUserInfo.isUser == 1">
<view class="customAmount_left">
<text class="customAmount_left_tip"></text>
<u-input
type="number"
v-model="amount"
inputAlign="left"
:placeholder="`充${amount}送${giftAmount}`"
:customStyle="{border: '0'}"
@input="amountChange"
></u-input>
</view>
<text class="customAmount_right">自定义金额</text>
</view>
<view class="rechargeList">
<view class="rechargeList_f" @click="clickinput(item,index)" v-for="(item,index) in listdata" :key="index">
<view class="rechargeList_item flex-colum " :class="index === inputshow?'active':''">
<view class="rechargeList_item_title">充值</view>
<view class="flex-colum-start">
<view class="rechargeList_item_amount"><text>{{item.amount}}</text></view>
<view class="rechargeList_item_gift" v-show="index === inputshow">
<image class="rechargeList_item_gift_bg" src="https://czg-qr-order.oss-cn-beijing.aliyuncs.com/menber/gift_icon.png" mode="aspectFill"></image>
<view class="rechargeList_item_gift_text">
<text>{{inputshow}}</text>
<text>{{ item.giftAmount }}</text>
</view>
</view>
<view class="rechargeList_item_handsel" v-show="index !== inputshow">赠送{{item.giftAmount}}</view>
</view>
</view>
</view>
</view>
<view class="gift" v-if="giftList && giftList.length > 0">
<view class="gift_title">您将获得</view>
<view class="gift_list">
<view class="gift_list_item" v-for="(item,index) in giftList" :key="index">
<text class="icon"></text>
<text class="text"> {{ item }} </text>
</view>
</view>
</view>
<view class="explain">
<view class="explain-top flex-between">
<text class="explain-top_title">适用门店</text>
<text class="shopName">{{ shopUserInfo.shopName }}</text>
</view>
<view class="explain_content">
<text class="explain_content_title">充值说明</text>
<text class="explain_content_text">1.充值金额1家门店可用</text>
<text class="explain_content_text">2.储值完成后不支持自助退款可联系商家处理</text>
<text class="explain_content_text">3.钱包余额不支持转赠不可提现长期有效</text>
</view>
</view>
<view class="rechargeBox">
<view class="agreement" @click="isProtocol = !isProtocol">
<u-checkbox-group >
<u-checkbox :checked="isProtocol" shape="circle" activeColor="#E3AD7F" @change="radioChange" size="35" iconSize="20">
</u-checkbox>
</u-checkbox-group>
<text>已同意</text>
<text class="agreement_text" @click.stop="viewProtocol">用户隐私协议</text>
<!-- <text class="agreement_text" @click="viewProtocol">用户储值协议</text> -->
<!-- <text class="agreement_text" @click="viewProtocol">用户授权协议</text> -->
</view>
<view class="recharge" @tap="$u.debounce(userbalancerechangesub, 500)">立即充值</view>
</view>
<registermember :show="memberOpen" :shopId="shopId" @getRegisterMember="getRegisterMember"></registermember>
</view>
</template>
<script>
import registermember from './components/registermember.vue'
export default {
components: {
registermember
},
data() {
return {
inputshow: 0,
memberOpen: false,
isProtocol: false,
listdata: [],
amount: 0,
giftAmount: 0,
userInfo: {},
shopUserInfo: null,
shopId: '',
giftList: [],
cardManageList: [
{name: "明细", url: "member/billDetails",icon: "https://czg-qr-order.oss-cn-beijing.aliyuncs.com/menber/detail.png"},
{name: "管理", url: "member/storedManage",icon: "https://czg-qr-order.oss-cn-beijing.aliyuncs.com/menber/manage.png"}
],
type: "",
}
},
async onLoad(options) {
// if ( e.type == 'list' || e.type == 'index') {
// this.shopId = e.shopId;
// this.init();
// }
uni.cache.set('forceUpdate',1)
// #ifdef MP-WEIXIN
if (options.q) {
this.shopId = this.getQueryString(decodeURIComponent(options.q), 'shopId')
uni.cache.set('shopId',this.shopId)
this.tokenShow = false;
}
// #endif
// #ifdef MP-ALIPAY
if (getApp().globalData.shopId) { this.shopId = getApp().globalData.shopId }
uni.cache.set('shopId',this.shopId)
// #endif
if (options.shopId) {
this.shopId = options.shopId
uni.cache.set('shopId',this.shopId)
}
if (options.type) {
this.type = options.type
}
if ( options.amount ) { this.amount = options.amount; }
this.shopInfo();
this.paygetActive()
},
methods: {
/**
* 初始化
*/
async shopInfo() {
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.remove('memberOpen',this.memberOpen)
if ( this.shopUserInfo.isVip == 0 ) {
this.memberOpen = true;
uni.cache.set('memberOpen',this.memberOpen)
}
} else {
let pages = getCurrentPages()
if ( pages.length > 1) {
uni.navigateBack()
} else {
setTimeout(res => {
uni.exitMiniProgram({
success: function() {
console.log('退出小程序成功');
},
fail: function(err) {
console.log('退出小程序失败', err);
}
})
}, 500)
}
}
this.$forceUpdate();
console.log(this.memberOpen)
},
/**
* 获取充值金额列表
*/
async paygetActive() {
let res = await this.api.paygetActive({
shopId: this.shopId,
page: 1,
pageSize: 99
})
try {
this.listdata = res.data.list;
this.giftList = this.listdata[0].gives;
this.giftAmount = this.listdata[0].giftAmount
if ( this.type == 'topUpActivity') {
this.amountChange()
} else {
this.amount = this.listdata[0].amount;
}
} catch (e) {
//TODO handle the exception
}
},
/**
* 监听金额修改
*/
amountChange () {
let item = this.listdata.filter(item=>this.amount==item.amount)
if ( item.length > 0 ) {
this.listdata.forEach((v,e)=>{
if ( this.amount == v.amount) {
this.inputshow = e;
this.clickinput(v,e)
}
})
} else {
this.inputshow = '';
this.giftList = [];
this.giftAmount = '';
}
},
/**
* 进入明细\管理
* @param {Object} e
*/
handleClick (item) {
uni.navigateTo({
url: `/pages/${item.url}?shopUserInfo=${JSON.stringify(this.shopUserInfo)}`
})
},
/**
* 查看协议
*/
viewProtocol (){
wx.openPrivacyContract({
success: () => {}, // 打开成功
fail: () => {}, // 打开失败
complete: () => {}
})
},
/**
* 是否同意协议
* @param {Object} n
*/
radioChange(n) {
this.isProtocol = n;
},
/**
* 注册会员卡
* @param {Object} e
*/
getRegisterMember (e) {
this.memberOpen = e;
this.shopInfo();
this.paygetActive()
},
/**
* 拉起地图
*/
openLocation () {
console.log('123');
uni.openLocation({
latitude: Number(this.shopUserInfo.lat), // 目的地的纬度,浮点数,范围为-90~90
longitude: Number(this.shopUserInfo.lng), // 目的地的经度,浮点数,范围为-180~180
scale: 18, // 缩放比例范围5~18
name: this.shopUserInfo.shopName, // 位置名
address: this.shopUserInfo.address, // 地址的详细说明
success() {
console.log('导航启动成功');
},
fail(error) {
console.log('导航启动失败', error);
if ( error.errMsg == "openLocation:fail invalid_coordinate") {
uni.showToast({
title: "门店经纬度无效",
icon: 'none'
});
}
}
});
},
/**
* 解析地址传参
* @param {Object} url
* @param {Object} name
*/
getQueryString(url, name) { //解码
var reg = new RegExp('(^|&|/?)' + name + '=([^&|/?]*)(&|/?|$)', 'i')
var r = url.substr(1).match(reg)
if (r != null) {
return r[2]
}
return null;
},
/**
* 充值金额切换
* @param {Object} a
* @param {Object} b
*/
clickinput(a, b) {
this.inputshow = b;
this.giftList = a.gives;
this.amount = a.amount;
this.giftAmount = a.giftAmount;
},
/**
* 充值
*/
async userbalancerechangesub() {
let _this = this;
if (!this.isProtocol) {
uni.showToast({
title: '请勾选协议',
icon: 'none'
});
return false;
}
if (this.amount == null || this.amount == '') {
uni.showToast({
title: '金额不能为空',
icon: 'none'
});
return false;
}
if (this.amount <= 0) {
uni.showToast({
title: '金额必须大于0',
icon: 'none'
});
return false;
}
let res = await this.api.paymemeberIn({
shopId: this.shopId, // 判断显示哪家的作品,
amount: this.amount // 判断显示哪家的作品,
})
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: "支付成功"
})
uni.hideLoading()
let pages = getCurrentPages()
uni.requestSubscribeMessage({
tmplIds:["AV-KybUHaK3KtFVLqpy6PHccHBS7XeX__mOM4RbufnQ"],
complete() {
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)
}
}
},
})
},
fail: (res) => {
uni.hideLoading()
}
});
uni.hideLoading()
// #endif
}
},
}
}
</script>
<style lang="scss">
page {
background: #F9F9F9;
}
.content {
padding: 16rpx 20rpx 245rpx 20rpx;
.location{
display: flex;
align-items: center;
background-color: #fff;
padding: 16rpx 28rpx 18rpx 28rpx;
margin-bottom: 32rpx;
border-radius: 12rpx;
font-weight: 400;
font-size: 28rpx;
color: #333333;
.location_icon{
width: 20rpx;
height: 26rpx;
margin-right: 20rpx;
}
}
.card_info{
width: 100%;
height: 182rpx;
background: linear-gradient( 132deg, #D6B68D 0%, #E6D6BC 100%);
border-radius: 12rpx;
padding: 32rpx 28rpx;
align-items: initial;
margin-bottom: 26rpx;
.title{
font-weight: 500;
font-size: 32rpx;
color: #333333;
}
.card_info_con{
align-items: flex-end;
.balance{
font-weight: 400;
font-size: 48rpx;
color: #333333;
}
.card_info_con_right{
.card_info_con_right_item{
margin-left: 64rpx;
.card_info_con_right_item_icon{
width: 40rpx;
height: 36rpx;
margin-bottom: 5rpx;
}
.card_info_con_right_item_text{
font-weight: 400;
font-size: 24rpx;
color: #333333;
}
}
}
}
}
.customAmount{
display: flex;
justify-content: space-between;
align-items: center;
margin-bottom: 32rpx;
padding: 14rpx 16rpx;
background-color: #fff;
border-radius: 8rpx;
.customAmount_left{
width: 100%;
display: flex;
align-items: center;
.customAmount_left_tip{
font-weight: 400;
font-size: 28rpx;
color: #333333;
}
input{
width: 100%;
font-weight: 500;
font-size: 24rpx;
color: #333;
padding-left: 16rpx;
}
}
.customAmount_right{
font-weight: 500;
font-size: 28rpx;
color: #666666;
flex-shrink: 0;
}
}
.rechargeList{
width: 100%;
display: flex;
flex-wrap: wrap;
.rechargeList_f{
width: 33.333%;
margin-bottom: 30rpx;
padding-right: 20rpx;
padding-left: 0;
.rechargeList_item{
border-radius: 0rpx 48rpx 0rpx 0rpx;
border: 4rpx solid #E5E5E5;
align-items: initial;
padding: 26rpx 22rpx;
justify-content: space-between;
position: relative;
.rechargeList_item_title{
margin-bottom: 20rpx;
}
.rechargeList_item_title,.rechargeList_item_handsel{
font-weight: 400;
font-size: 20rpx;
color: #999999;
}
.rechargeList_item_amount{
font-weight: bold;
font-size: 28rpx;
color: #666666;
text{
font-size: 44rpx;
font-weight: bold;
color: #666666;
}
}
.rechargeList_item_handsel{
}
.rechargeList_item_gift{
width: 92.52rpx;
height: 88.74rpx;
position: absolute;
top: 12rpx;
right: 12rpx;
.rechargeList_item_gift_bg{
width: 92.52rpx;
height: 88.74rpx;
position: absolute;
}
.rechargeList_item_gift_text{
width: 92.52rpx;
height: 88.74rpx;
position: absolute;
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
text:nth-child(1){
font-weight: bold;
font-size: 20rpx;
color: #fff;
}
text:nth-child(2){
font-weight: 400;
font-size: 24rpx;
color: #fff;
}
}
}
}
.rechargeList_item.active{
border: 4rpx solid #DCC19E;
background: linear-gradient( 133deg, #F9F6ED 0%, #FFFFFF 100%);
.rechargeList_item_title{
color: #F7664E;
margin-bottom: 47rpx;
}
.rechargeList_item_amount{
font-weight: bold;
font-size: 28rpx;
color: #FB604A;
text{
font-size: 44rpx;
font-weight: bold;
color: #FB604A;
}
}
}
}
.rechargeList_f:nth-child(3n-1){
padding-right: 10rpx;
padding-left: 10rpx;
}
.rechargeList_f:nth-child(3n){
padding-right: 0;
padding-left: 20rpx;
}
}
.gift{
display: flex;
flex-direction: column;
padding: 0 22rpx;
margin-bottom: 48rpx;
.gift_title{
font-weight: bold;
font-size: 32rpx;
color: #333333;
margin-bottom: 16rpx;
}
.gift_list{
display: flex;
flex-direction: column;
.gift_list_item{
display: flex;
align-items: center;
.icon{
width: 24rpx;
height: 24rpx;
border-radius: 50%;
background-color: #F7853D;
margin-right: 8rpx;
flex-shrink: 0;
}
.text{
font-weight: 400;
font-size: 28rpx;
color: #333333;
}
}
}
}
.explain{
background-color: #fff;
border-radius: 12rpx;
display: flex;
flex-direction: column;
padding: 22rpx 24rpx;
margin-bottom: 30rpx;
.explain-top{
// align-items: center;
margin-bottom: 18rpx;
.explain-top_title{
font-weight: bold;
font-size: 32rpx;
color: #333333;
}
.shopName{
font-weight: 400;
font-size: 24rpx;
color: #333333;
}
}
.explain_content{
display: flex;
flex-direction: column;
.explain_content_title{
font-weight: bold;
font-size: 32rpx;
color: #333333;
margin-bottom: 20rpx;
}
.explain_content_text{
font-weight: 400;
font-size: 24rpx;
color: #666666;
margin-bottom: 14rpx;
}
}
}
.rechargeBox{
width: 100%;
padding: 0 28rpx 84rpx 28rpx;
background-color: #fff;
position: fixed;
left: 0;
bottom: 0;
.agreement{
display: flex;
align-items: center;
justify-content: center;
padding-top: 16rpx;
padding-bottom: 20rpx;
text{
font-size: 24rpx;
}
.agreement_text{
color: #E3AD7F;
}
}
.recharge {
width: 100%;
height: 90rpx;
line-height: 90rpx;
text-align: center;
font-weight: bold;
font-size: 36rpx;
color: #FFFFFF;
border-radius: 12rpx;
background: #E3AD7F;
}
}
}
</style>

View File

@@ -23,30 +23,32 @@
<view class="customAmount" v-if="shopUserInfo.isUser == 1">
<view class="customAmount_left">
<text class="customAmount_left_tip"></text>
<u-input
<input
type="number"
v-model="amount"
inputAlign="left"
:placeholder="`充${minNum}送${handselNum}`"
:placeholder="`充${amount}送${giftAmount}`"
:customStyle="{border: '0'}"
></u-input>
controlled="true"
@input="amountChange"
></input>
</view>
<text class="customAmount_right">自定义金额</text>
</view>
<view class="rechargeList">
<view class="rechargeList_f" @click="clickinput(item,index)" v-for="(item,index) in listdata" :key="index">
<view class="rechargeList_item flex-colum " :class="index == inputshow?'active':''">
<view class="rechargeList_item flex-colum " :class="index === inputshow?'active':''">
<view class="rechargeList_item_title">充值</view>
<view class="flex-colum-start">
<view class="rechargeList_item_amount"><text>{{item.minNum}}</text></view>
<view class="rechargeList_item_gift" v-show="index == inputshow">
<view class="rechargeList_item_amount"><text>{{item.amount}}</text></view>
<view class="rechargeList_item_gift" v-show="index === inputshow">
<image class="rechargeList_item_gift_bg" src="https://czg-qr-order.oss-cn-beijing.aliyuncs.com/menber/gift_icon.png" mode="aspectFill"></image>
<view class="rechargeList_item_gift_text">
<text></text>
<text>{{ item.handselNum }}</text>
<text>{{ item.giftAmount }}</text>
</view>
</view>
<view class="rechargeList_item_handsel" v-show="index != inputshow">赠送{{item.handselNum}}</view>
<view class="rechargeList_item_handsel" v-show="index !== inputshow">赠送{{item.giftAmount}}</view>
</view>
</view>
@@ -108,8 +110,7 @@
isProtocol: false,
listdata: [],
amount: 0,
minNum: 0,
handselNum: 0,
giftAmount: 0,
userInfo: {},
shopUserInfo: null,
shopId: '',
@@ -118,33 +119,38 @@
{name: "明细", url: "member/billDetails",icon: "https://czg-qr-order.oss-cn-beijing.aliyuncs.com/menber/detail.png"},
{name: "管理", url: "member/storedManage",icon: "https://czg-qr-order.oss-cn-beijing.aliyuncs.com/menber/manage.png"}
],
type: "",
}
},
async onLoad(e) {
async onLoad(options) {
// if ( e.type == 'list' || e.type == 'index') {
// this.shopId = e.shopId;
// this.init();
// }
console.log(e)
uni.cache.set('forceUpdate',1)
if (e.q) {
this.shopId = this.getQueryString(decodeURIComponent(e.q), 'shopId')
// #ifdef MP-WEIXIN
if (options.q) {
this.shopId = this.getQueryString(decodeURIComponent(options.q), 'shopId')
uni.cache.set('shopId',this.shopId)
this.tokenShow = false;
// 等待登录结果返回
// if (!uni.cache.get('token')) {
// await this.$onLaunched;
// }
this.shopInfo();
this.paygetActive()
} else{
this.shopId = e.shopId;
uni.cache.set('shopId',this.shopId)
this.shopInfo();
this.paygetActive()
}
// #endif
// #ifdef MP-ALIPAY
if (getApp().globalData.shopId) { this.shopId = getApp().globalData.shopId }
uni.cache.set('shopId',this.shopId)
// #endif
if (options.shopId) {
this.shopId = options.shopId
uni.cache.set('shopId',this.shopId)
}
if (options.type) {
this.type = options.type
}
if ( options.amount ) { this.amount = options.amount; }
this.shopInfo();
this.paygetActive()
},
methods: {
/**
@@ -193,20 +199,43 @@
let res = await this.api.paygetActive({
shopId: this.shopId,
page: 1,
pageSize: 10
pageSize: 99
})
try {
this.listdata = res.data.list;
this.giftList = this.listdata[0].gives;
this.amount = this.listdata[0].minNum;
this.minNum = this.listdata[0].minNum;
this.handselNum = this.listdata[0].handselNum
this.giftAmount = this.listdata[0].giftAmount
if ( this.type == 'topUpActivity') {
this.amountChange()
} else {
this.amount = this.listdata[0].amount;
}
} catch (e) {
//TODO handle the exception
}
},
/**
* 监听金额修改
*/
amountChange () {
let item = this.listdata.filter(item=>this.amount==item.amount)
if ( item.length > 0 ) {
this.listdata.forEach((v,e)=>{
if ( this.amount == v.amount) {
this.inputshow = e;
this.clickinput(v,e)
}
})
} else {
this.inputshow = '';
this.giftList = [];
this.giftAmount = '';
}
},
/**
* 进入明细\管理
* @param {Object} e
@@ -295,12 +324,10 @@
* @param {Object} b
*/
clickinput(a, b) {
console.log(a, b)
this.inputshow = b;
this.giftList = a.gives;
this.amount = a.minNum;
this.minNum = a.minNum;
this.handselNum = a.handselNum;
this.amount = a.amount;
this.giftAmount = a.giftAmount;
},
/**
@@ -315,6 +342,7 @@
});
return false;
}
console.log(this.amount)
if (this.amount == null || this.amount == '') {
uni.showToast({
title: '金额不能为空',
@@ -331,15 +359,21 @@
}
let res = await this.api.paymemeberIn({
shopId: this.shopId, // 判断显示哪家的作品,
amount: this.amount // 判断显示哪家的作品,
amount: this.amount ,// 判断显示哪家的作品,
// #ifdef MP-WEIXIN
payType: 'wechatPay',
// #endif
// #ifdef MP-ALIPAY
payType: 'aliPay',
// #endif
})
if (res.code == 0) {
uni.showLoading({
title: '加载中',
mask: true
})
// #ifdef MP-WEIXIN
uni.requestPayment({
// #ifdef MP-WEIXIN
provider: 'wxpay', //支付类型-固定值
partnerid: res.data.appId, // 微信支付商户号
timeStamp: res.data.timeStamp, // 时间戳(单位:秒)
@@ -347,26 +381,67 @@
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) => {
// resultCode 9000
console.log(res)
console.log(2)
uni.hideLoading()
let pages = getCurrentPages()
// #ifdef MP-WEIXIN
uni.showToast({
title: "支付成功"
})
uni.hideLoading()
let pages = getCurrentPages()
uni.requestSubscribeMessage({
tmplIds:["AV-KybUHaK3KtFVLqpy6PHccHBS7XeX__mOM4RbufnQ"],
complete() {
if ( pages.length > 1) {
_this.shopInfo()
if ( _this.type && _this.type == "topUpActivity") {
uni.pro.navigateBack()
} else {
setTimeout(res => {
uni.switchTab({
url: '/pages/index/index'
})
}, 500)
if ( pages.length > 1) {
_this.shopInfo()
} else {
setTimeout(res => {
uni.switchTab({
url: '/pages/index/index'
})
}, 500)
}
}
},
})
// #endif
// #ifdef MP-ALIPAY
if ( res.resultCode == '9000') {
uni.showToast({
title: "支付成功"
})
} else {
uni.showToast({
title: "支付失败"
})
}
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
@@ -376,7 +451,6 @@
}
});
uni.hideLoading()
// #endif
}
},
@@ -453,7 +527,7 @@
justify-content: space-between;
align-items: center;
margin-bottom: 32rpx;
padding: 14rpx 16rpx;
padding: 22rpx 16rpx 22rpx 32rpx;
background-color: #fff;
border-radius: 8rpx;
.customAmount_left{

View File

@@ -108,12 +108,18 @@
shopId: item.shopId,
type: 'index',
})
} else if ( this.type && this.type == 'user_points') {
uni.pro.navigateTo('/pagesPoints/index/index', {
shopId: item.shopId,
type: 'member_list',
})
} else {
uni.pro.navigateTo('member/memberdetails', {
shopId: item.shopId
})
}
}
},

View File

@@ -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>
@@ -135,7 +135,9 @@
type: 'index',
})
} else if ( type == 3 ) {
uni.pro.navigateTo('user/coupon')
uni.pro.navigateTo('user/coupon', {
shopId: this.shopId,
})
}
},

View File

@@ -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>

View File

@@ -24,8 +24,13 @@
<view class="price-wrap" style="padding-top: 0;" >
<view class="price">
<text class="i"></text>
<text class="num">{{ item.salePrice }}</text>
<text class="num" v-if="shopUserInfo.isVip ==1 && item.memberPrice>0" style="margin-right: 10rpx;">{{ item.memberPrice }}</text>
<text class="i" v-if="shopUserInfo.isVip ==1 && item.memberPrice>0" :class="{lineThrough: shopUserInfo.isVip ==1 && item.memberPrice>0}"></text>
<text class="num" :class="{lineThrough: shopUserInfo.isVip ==1 && item.memberPrice>0}">{{ 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>
@@ -82,7 +87,7 @@
},
data() {
return {
shopUserInfo: uni.cache.get('shopUserInfo')
}
},
@@ -91,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: {
@@ -123,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;
@@ -297,6 +294,12 @@
}
.num {}
.lineThrough{
font-weight: normal;
text-decoration:line-through;
color: #999!important;
font-size: 24rpx!important;
}
}
.sku-wrap {

View File

@@ -11,7 +11,8 @@
</view>
<text class="i"></text>
<text class="num">{{cartLists.amount||'0.00'}}</text>
<text class="num" v-if="shopUserInfo.isVip == 1 && cartLists.memberAmount > 0">{{cartLists.memberAmount||'0.00'}}</text>
<text class="num" v-else >{{cartLists.amount||'0.00'}}</text>
</view>
<view class="btn" @tap="$u.debounce(orderdetail, 500)" >
<text class="t">去结算</text>
@@ -26,7 +27,7 @@
data() {
return {
shopUserInfo: uni.cache.get('shopUserInfo')
}
},
props:{
@@ -54,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: {

View File

@@ -52,16 +52,23 @@
<!-- <view class="panelfiveitemfour">
{{item.shortTitle?item.shortTitle:''}}
</view> -->
<view class="panelfiveitemfive">
<!-- <view class="panelfiveitemfive">
月售{{item.stockNumber}}
</view>
</view> -->
<view v-if="item.isPauseSale != 0 || item.isSale == 0 " class="flex-between" style="margin-top: 32rpx;margin-bottom: 48rpx;">
<view class="panelfiveitemsex flex-between">
<view class="panelfiveitemsex_oen"><text>¥</text><text>{{item.lowPrice}}</text><text>/{{item.unitSnap}}</text></view>
<view class="panelfiveitemsex_oen">
<text class="tips">¥</text>
<text class="price" v-if="isVip ==1 && item.lowMemberPrice>0" style="margin-right: 10rpx;">{{item.lowMemberPrice}}</text>
<text class="tips" v-if="isVip ==1 && item.lowMemberPrice>0" :class="{lineThrough: isVip ==1 && item.lowMemberPrice>0}">¥</text>
<text class="price" :class="{lineThrough: isVip ==1 && item.lowMemberPrice>0}">{{item.lowPrice}}</text>
<text class="unit" v-if="!(isVip ==1 && item.lowMemberPrice>0)">/{{item.unitSnap}}</text>
</view>
</view>
<view class="panelfiveitemNum" >
@@ -73,8 +80,17 @@
</view>
<view v-else class="flex-between" style="margin-top: 32rpx;margin-bottom: 48rpx;">
<view class="panelfiveitemsex flex-between">
<view class="panelfiveitemsex_oen"><text>¥</text><text>{{item.lowPrice}}</text><text>/{{item.unitSnap}}</text></view>
<view class="panelfiveitemsex_oen">
<text class="tips">¥</text>
<text class="price" v-if="isVip ==1 && item.lowMemberPrice>0" style="margin-right: 10rpx;">{{item.lowMemberPrice}}</text>
<text class="tips" v-if="isVip ==1 && item.lowMemberPrice>0" :class="{lineThrough: isVip ==1 && item.lowMemberPrice>0}">¥</text>
<text class="price" :class="{lineThrough: isVip ==1 && item.lowMemberPrice>0}">{{item.lowPrice}}</text>
<text class="unit" v-if="!(isVip ==1 && item.lowMemberPrice>0)">/{{item.unitSnap}}</text>
</view>
</view>
<view v-if="item.suit > 1">
<view class="panelfiveitemNum">
<view class="sku-wrap flex-center" @click.stop="clickspecifications(item,index,index1)">
@@ -146,13 +162,19 @@
</view>
<view class="goods_right" style="overflow: hidden;">
<view class="name">{{ item1.name }}</view>
<view class="lookBack" v-if="item.name=='热销'">本店回头客{{index1+1}}</view>
<view class="lookBack" v-if="item.name=='热销'">本店销量{{index1+1}}</view>
<view class="describe"> {{item1.shortTitle?item1.shortTitle:''}} </view>
<view class="monthlySale">月售{{item1.stockNumber}}</view>
<!-- <view class="monthlySale">月售{{item1.stockNumber}}</view> -->
<view v-if="item1.isPauseSale != 0 || item1.isSale == 0 " class="flex-between">
<view class="money"><text class="money_num">{{ item1.lowPrice }}</text>/{{item1.unitSnap}}</view>
<view class="money">
<view></view>
<text class="money_num" v-if="isVip ==1 && item1.lowMemberPrice>0" style="margin-right: 10rpx;">{{ item1.lowMemberPrice }}</text>
<view v-if="isVip ==1 && item1.lowMemberPrice>0" :class="{lineThrough: isVip ==1 && item1.lowMemberPrice>0}"></view>
<text class="money_num" :class="{lineThrough: isVip ==1 && item1.lowMemberPrice>0}">{{ item1.lowPrice }}</text>
<text v-if="!(isVip ==1 && item1.lowMemberPrice>0)">/{{item1.unitSnap}}</text>
</view>
<view class="flex-end" >
<view class="sku-wrap flex-center" style="background-color: #CECECE;">
<text class="t" v-if="item1.isSale == 0" >非可售时间</text>
@@ -161,7 +183,15 @@
</view>
</view>
<view v-else class="flex-between">
<view class="money"><text class="money_num">{{ item1.lowPrice }}</text>/{{item1.unitSnap}}</view>
<view class="money">
<view></view>
<text class="money_num" v-if="isVip ==1 && item1.lowMemberPrice>0" style="margin-right: 10rpx;">{{ item1.lowMemberPrice }}</text>
<view v-if="isVip ==1 && item1.lowMemberPrice>0" :class="{lineThrough: isVip ==1 && item1.lowMemberPrice>0}"></view>
<text class="money_num" :class="{lineThrough: isVip ==1 && item1.lowMemberPrice>0}">{{ item1.lowPrice }}</text>
<text v-if="!(isVip ==1 && item1.lowMemberPrice>0)">/{{item1.unitSnap}}</text>
</view>
<view v-if="item1.suit > 1">
<view class="flex-end" >
<view class="sku-wrap flex-center"
@@ -208,10 +238,10 @@
<!-- 购物车 -->
<shoppingCart v-if="tableCode&&shopId" ref="shoppingCart" :shopId="shopId" :tableCode="tableCode" :cartLists_count="cartLists_count" :cartLists="cartLists" :showCart="showCart" @addCart="addCart" @close="close"></shoppingCart>
<shoppingCart v-if="tableCode||shopId" ref="shoppingCart" :shopId="shopId" :tableCode="tableCode" :cartLists_count="cartLists_count" :cartLists="cartLists" :showCart="showCart" @addCart="addCart" @close="close"></shoppingCart>
<!-- 购物车结算 -->
<shoppingCartBilling v-if="tableCode&&shopId" ref="shoppingCartBilling" :cartListsdatashow="cartListsdatashow" :shopId="shopId" :tableCode="tableCode" :storeInfo="shopInfo.storeInfo" :cartLists_count="cartLists_count" :cartLists="cartLists" :showCart="showCart" @isOpen="isOpen"></shoppingCartBilling>
<shoppingCartBilling v-if="tableCode||shopId" ref="shoppingCartBilling" :cartListsdatashow="cartListsdatashow" :shopId="shopId" :tableCode="tableCode" :storeInfo="shopInfo.storeInfo" :cartLists_count="cartLists_count" :cartLists="cartLists" :showCart="showCart" @isOpen="isOpen"></shoppingCartBilling>
<view class="placedOrderTip" @click="placedOrder" v-if="tableCode&&shopInfo.shopTableInfo&&shopInfo.shopTableInfo.orderId&&shopInfo.storeInfo.registerType == 'restaurant'"><u-avatar :src="src" shape="circle"></u-avatar><view style="margin-left: 8rpx;">已下单菜品</view></view>
@@ -356,6 +386,8 @@
cartLists: {}, //购物车
cartLists_count: 0,
shopInfo: {}, //店铺信息
shopUserInfo: {},
isVip: null,
shopProductList: {}, //商品信息
specifications: {}, // 规格信息
querySpecList: [],
@@ -449,6 +481,7 @@
duration: 0
});
if ( this.shopId ) {
this.productqueryShop();
this.productqueryProduct() //list 数据
this.getShopUserInfo() //list 数据
this.handlemessage() //监听websocket返回
@@ -584,6 +617,7 @@
})
if (res.code == 0) {
this.shopUserInfo = res.data;
this.isVip = res.data.isVip;
uni.cache.set('shopUserInfo', res.data)
}
},
@@ -628,13 +662,7 @@
if (b == '单规格') { //没有规格为空
this.skuidname = []
}
if ( a == "+" && item.isVip == 1 && item.cartNumber >= item.limitNumber){
uni.showToast({
title: '当前商品已达到最大赠送数量',
icon: 'none'
})
return;
}
let cartNumber = a == '+' ? item.cartNumber + 1 : item.cartNumber - 1;
@@ -651,13 +679,7 @@
*/
shopAdd(item, index, index1, a, b) {
if (a == "+") {
if ( item.isVip == 1 && this.amountcartNumber >= item.limitNumber){
uni.showToast({
title: '当前商品已达到最大赠送数量',
icon: 'none'
})
return;
}
if (this.skuNumber < this.skuSuit && this.amountcartNumber < this.skuSuit) {
this.amountcartNumber = this.amountcartNumber + (this.skuSuit == 0 ? 1 : this.skuSuit);
} else {
@@ -683,13 +705,7 @@
return;
}
let num = 0;
if ( item.isVip == 1 && item.cartNumber >= item.limitNumber){
uni.showToast({
title: '当前商品已达到最大赠送数量',
icon: 'none'
})
return;
}
if (item.typeEnum == "normal") {
num = item.cartNumber + this.amountcartNumber;
} else {
@@ -741,7 +757,7 @@
setNumber() {
// 处理购物车相同id的情况下 数量相加
var summedArray = this.cartLists.data.reduce((acc, current) => {
const existing = acc.find(item => item.productId === current.productId && item.isVip === current.isVip);
const existing = acc.find(item => item.productId === current.productId);
if (existing) {
existing.number += current.number;
} else {
@@ -756,7 +772,7 @@
return item.products.filter(e => {
e.cartNumber = 0;
return summedArray.find(i => {
if (e.id == i.productId && e.isVip == i.isVip) {
if (e.id == i.productId) {
e.cartNumber = i.number
}
})
@@ -951,21 +967,21 @@
let res = await this.api.productqueryProductSku({
code: this.tableCode,
shopId: this.shopId,
productId: item.id, //商品id
isVip: item.isVip, //商品id
productId: item.id, //商品id
spec_tag: this.skuidname.join(","),
})
this.salePrice = res.data.salePrice // 价格
this.salePrice = this.isVip == 1 && res.data.memberPrice > 0 ? res.data.memberPrice : res.data.salePrice // 价格
let data = null;
console.log(a)
if (a == 1) { //1添加购物车 2是websocket返回这个商品的价格(应为不同的多规格商品返回不同的价格)
let params = {
"skuId": res.data.id,
"num": num, //数量
"type": c == '+' ? 1 : 0,
"productId": item.id, //商品id
"isVip": item.isVip,
"note": item.note,
"isVip": item.isVip,
"shopId": this.shopId,
"userId": uni.cache.get('userInfo').id,
}
@@ -1321,33 +1337,27 @@
.panelfiveitemsex {
.panelfiveitemsex_oen {
text:nth-child(1) {
.tips {
font-family: Source Han Sans CN, Source Han Sans CN;
font-weight: 400;
font-size: 24rpx;
color: #333333;
}
text:nth-child(2) {
.price {
font-family: Source Han Sans CN, Source Han Sans CN;
font-weight: bold;
font-size: 36rpx;
color: #333333;
}
text:nth-child(3) {
.unit {
font-family: Source Han Sans CN, Source Han Sans CN;
font-weight: 400;
font-size: 36rpx;
color: #333333;
}
text:nth-child(4) {
font-family: Source Han Sans CN, Source Han Sans CN;
font-weight: 400;
font-size: 24rpx;
color: #666666;
}
}
}
@@ -1519,7 +1529,7 @@
padding: 12rpx 28rpx;
border-radius: 8rpx;
font-size: 24upx;
margin-left: 56rpx;
margin-right: 56rpx;
background: #EFEFEF;
border: 2rpx solid #EFEFEF;
position: relative;
@@ -1862,6 +1872,7 @@
width: 100%;
display: flex;
flex-direction: column;
justify-content: space-around;
position: relative;
padding-top: 5rpx;
padding-right: 20rpx;
@@ -1900,7 +1911,8 @@
font-weight: bold;
font-size: 24rpx;
color: #333;
display: flex;
align-items: flex-end;
.money_num {
font-size: 28rpx;
color: #333;
@@ -1977,4 +1989,12 @@
}
}
.lineThrough{
font-weight: normal;
text-decoration:line-through;
color: #999!important;
font-size: 24rpx!important;
}
.money_num.lineThrough{
}
</style>

View File

@@ -31,13 +31,19 @@
<view class="goods_right">
<!-- <text class="suit" v-if="item1.suit > 1">{{item1.suit}}份起点</text> -->
<view class="name">{{ item1.name }}</view>
<view class="lookBack" v-if="item.name=='热销'">本店回头客{{index1+1}}</view>
<view class="lookBack" v-if="item.name=='热销'">本店销量{{index1+1}}</view>
<view class="describe"> {{item1.shortTitle?item1.shortTitle:''}} </view>
<view class="monthlySale">月售{{item1.stockNumber}}</view>
<!-- <view class="monthlySale">月售{{item1.stockNumber}}</view> -->
<view v-if="item1.isPauseSale != 0 " class="flex-between" >
<view class="money"><text class="money_num">{{ item1.lowPrice }}</text>/{{item1.unitSnap}}</view>
<view class="money">
<view></view>
<text class="money_num" v-if="isVip ==1 && item1.lowMemberPrice>0" style="margin-right: 10rpx;">{{ item1.lowMemberPrice }}</text>
<view v-if="isVip ==1 && item1.lowMemberPrice>0" :class="{lineThrough: isVip ==1 && item1.lowMemberPrice>0}"></view>
<text class="money_num" :class="{lineThrough: isVip ==1 && item1.lowMemberPrice>0}">{{ item1.lowPrice }}</text>
<text v-if="!(isVip ==1 && item1.lowMemberPrice>0)">/{{item1.unitSnap}}</text>
</view>
<view class="flex-end" >
<view class="sku-wrap flex-center" style="background-color: #CECECE;">
<text class="t" v-if="item1.isSale == 0" >非可售时间</text>
@@ -46,7 +52,13 @@
</view>
</view>
<view v-else class="flex-between">
<view class="money"><text class="money_num">{{ item1.lowPrice }}</text>/{{item1.unitSnap}}</view>
<view class="money">
<view></view>
<text class="money_num" v-if="isVip ==1 && item1.lowMemberPrice>0" style="margin-right: 10rpx;">{{ item1.lowMemberPrice }}</text>
<view v-if="isVip ==1 && item1.lowMemberPrice>0" :class="{lineThrough: isVip ==1 && item1.lowMemberPrice>0}"></view>
<text class="money_num" :class="{lineThrough: isVip ==1 && item1.lowMemberPrice>0}">{{ item1.lowPrice }}</text>
<text v-if="!(isVip ==1 && item1.lowMemberPrice>0)">/{{item1.unitSnap}}</text>
</view>
<view v-if="item1.suit > 1">
<view class="flex-end" >
<view class="sku-wrap flex-center"
@@ -875,6 +887,7 @@
width: 100%;
display: flex;
flex-direction: column;
justify-content: space-around;
position: relative;
padding-top: 5rpx;
padding-right: 20rpx;
@@ -1057,7 +1070,7 @@
padding: 12rpx 28rpx;
border-radius: 8rpx;
font-size: 24upx;
margin-left: 56rpx;
margin-right: 56rpx;
background: #EFEFEF;
border: 2rpx solid #EFEFEF;
position: relative;

View File

@@ -3,39 +3,39 @@
<view class="towcontent">
<view class="towcontentlistxitem flex-start">
<view class="towcontentlistxitembox flex-colum"
:class="tabIndex == index?'towcontentlistxitemboxopacity':''"
v-for="(item,index) in tabList" :key="index" @click="towcontentclick(index,item)">
:class="tabIndex == item.type?'towcontentlistxitemboxopacity':''"
v-for="(item,index) in tabList" :key="index" @click="towcontentclick(item)">
<text class="title">{{item.name}}</text>
<image v-if="tabIndex == index"
<image v-if="tabIndex == item.type"
src="https://czg-qr-order.oss-cn-beijing.aliyuncs.com/index/today/dg.png" mode="widthFix">
</image>
</view>
</view>
</view>
<view class="containertop">
<view class="containertop" :class="{select: type == 'confirm_order_coupon' || type == 'confirm_order_product' || type == 'orderInfo_coupon' || type == 'orderInfo_product'}">
<view class="containertopbox">
<view class="containertopboxitem flex-start" v-for="(item,index) in list" :key="index">
<view class="containertopboxitemleft flex-colum"
:class="{'containertopboxitemleft_vip': item.type == 2,'containertopboxitemlefts': item.status != 0,}" v-if="item.type == 2">
:class="{'containertopboxitemleft_vip': item.type == 2,'containertopboxitemlefts': status != 1,}" >
<view class="containertopboxitemleft_one"
:class="item.status == 0?'':'containertopboxitemleft_ones'">
:class="status == 1?'':'containertopboxitemleft_ones'">
<block v-if="item.type == 2">
<text>{{item.num || 0}}</text>
<text style="font-size: 28rpx;margin-left: 6rpx;"></text>
</block>
<block v-else >
<text style="font-size: 28rpx;margin-right: 6rpx;"></text>
<text>{{item.couponsAmount || 0}}</text>
<text>{{item.discountAmount || 0}}</text>
</block>
</view>
<view class="containertopboxitemleft_tow"
:class="{
'containertopboxitemleft_tows': item.status != 0,
'containertopboxitemleft_tows': status != 1,
'containertopboxitemleft_nameVip': item.type == 2,
}">
{{ item.type == 2 ? item.detail : '优惠券(元)'}}
{{ item.type == 2 ? item.name : '优惠券(元)'}}
</view>
</view>
@@ -48,16 +48,16 @@
<text>无门槛使用</text>
</view>
<view class="containertopboxitemright_tow">
<view> {{ item.type == 2 ? '会员商品券' : '通用红包券'}}</view>
<view> {{ item.type == 2 ? '会员商品券' : item.name}}</view>
<view
@click="navigatorGo(item)"
:class="item.status == 0?'containertopboxitemright_four containertopboxitemright_btn':'containertopboxitemright_fours containertopboxitemright_btn'">
{{item.status == 0 ? '去使用':'已使用'}}
:class="status == 1?'containertopboxitemright_four containertopboxitemright_btn':'containertopboxitemright_fours containertopboxitemright_btn'">
{{status == 1 ? '去使用':'已使用'}}
</view>
</view>
<!-- <view class="containertopboxitemright_there">
<view class="containertopboxitemright_there" v-if="item.type == 1 ">
有效期至{{$u.timeFormat(item.endTime, 'yyyy/mm/dd') || '0'}}
</view> -->
</view>
</view>
</view>
@@ -67,6 +67,9 @@
<u-loadmore :status="form.status" iconSize='24' fontSize='24' height='40' />
</view>
</view>
<view class="btnBox" v-if="type == 'confirm_order_coupon' || type == 'confirm_order_product' || type == 'orderInfo_coupon' || type == 'orderInfo_product'">
<view class="btn" @click="cancelCoupon" >暂不使用券</view>
</view>
</view>
</template>
@@ -74,10 +77,8 @@
export default {
data() {
return {
tabList: [{
name: '全部',
type: ''
},
tabList: [
{
name: '未使用',
type: '1'
@@ -85,28 +86,49 @@
{
name: '已使用',
type: '2'
},
{
name: '已过期',
type: '-1'
}
],
tabIndex: 0,
tabIndex: 1,
list: [],
status: "",
status: 1,
type: "",
payAmount: 0,
shopId: null,
orderId: null,
couopnInfo: null,
shoppingCart: [],
productList: [],
};
},
onLoad() {
onLoad(options) {
console.log(options)
if (options.type) { this.type = options.type }
if (options.payAmount) { this.payAmount = options.payAmount }
if (options.shopId) { this.shopId = options.shopId }
if (options.orderId) { this.orderId = options.orderId }
if (options.couopnInfo) { this.couopnInfo = JSON.parse(decodeURIComponent(options.couopnInfo)) }
if (options.shoppingCart) { this.shoppingCart = JSON.parse(decodeURIComponent(options.shoppingCart)) }
if (options.productList) { this.productList = JSON.parse(decodeURIComponent(options.productList)) }
},
onShow() {
this.list = [];
this.getCouponList()
},
methods: {
/**
* 切换类型
* @param {Object} index
* @param {Object} item
*/
towcontentclick(index, item) {
this.tabIndex = index;
towcontentclick(item) {
this.tabIndex = item.type;
this.status = item.type;
this.list = [];
this.getCouponList()
},
@@ -115,13 +137,28 @@
*/
async getCouponList() {
try {
let res = await this.api.getUserConpons({
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' || this.type == 'orderInfo_coupon' || this.type == 'orderInfo_product' ) {
params.orderId = -1;
}
if ( this.shopId ) {
params.shopId = this.shopId;
}
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' || this.type == 'orderInfo_coupon') {
list = res.data.filter(v => v.type == 1);
}else if ( this.type == 'confirm_order_product' || this.type == 'orderInfo_product') {
list = res.data.filter(v => v.type == 2);
} else {
list = res.data;
}
this.list = list;
}
} catch (e) {
//TODO handle the exception
@@ -132,11 +169,201 @@
* 去使用优惠券
*/
navigatorGo ( item ) {
if ( item.type == 2 ) {
uni.cache.set('shopId',item.shopId)
if ( this.type == 'confirm_order_coupon' || this.type == 'confirm_order_product' || this.type == 'orderInfo_coupon' || this.type == 'orderInfo_product' ) {
if ( item.type == 1 ) {
if( this.payAmount < item.fullAmount) {
uni.showToast({
title: "当前订单金额不足使用金额",
icon: "none",
})
return;
}
if( this.payAmount < item.discountAmount) {
uni.showToast({
title: "当前订单金额不足抵扣金额",
icon: "none",
})
return;
}
uni.$emit('couponItem', JSON.stringify(item))
let selectCouponData = uni.cache.get('selectCouponData') || [];
let couponList = selectCouponData.filter(v => v.type == 1);
if ( couponList.length > 0) {
couponList.map(items => {
if ( item.type == 1 ) {
for(var v in items){
items[v] = item[v]
}
}
})
} else {
selectCouponData.push(item)
}
uni.cache.set('selectCouponData',selectCouponData)
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 isNum = 0;
let isProductItem;
// 确认订单
if ( this.type == 'confirm_order_product' ) {
product.forEach(item => {
for (let i = 0; i < item.number; i++){
isNum++
if ( isNum == productTicketNum+1 ) {
isProductItem = item;
}
}
})
if ( this.payAmount < (isProductItem.memberPrice > 0 ? isProductItem.memberPrice : isProductItem.salePrice)) {
uni.showToast({
title: `当前金额不足商品抵扣`,
icon: "none",
})
return;
}
}
// 订单详情
if ( this.type == 'orderInfo_product' ) {
product.forEach(item => {
for (let i = 0; i < item.num; i++){
isNum++
if ( isNum == productTicketNum+1 ) {
isProductItem = item;
}
}
})
if ( this.payAmount < (isProductItem.memberPrice > 0 ? isProductItem.memberPrice : isProductItem.price)) {
uni.showToast({
title: `当前金额不足商品抵扣`,
icon: "none",
})
return;
}
}
if ( !isProductItem ) {
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))
let selectCouponData = uni.cache.get('selectCouponData') || [];
selectCouponData.push(item)
uni.cache.set('selectCouponData',selectCouponData)
uni.navigateBack();
}
} else {
uni.pro.navigateTo('/pages/order_food/order_food', {
shopId: item.shopId
})
}
},
/**
* 取消使用优惠券/商品券
*/
async cancelCoupon () {
let selectCouponData = uni.cache.get('selectCouponData')
if ( this.type == 'confirm_order_coupon' || this.type == 'orderInfo_coupon' ) {
let couponList = selectCouponData.filter(v => v.type == 1);
let productList = selectCouponData.filter(v => v.type == 2);
if ( couponList.length > 0 ) {
uni.cache.set('selectCouponData',productList)
if ( this.couopnInfo && this.orderId ) {
let params = {
shopId: this.shopId,
orderId: this.orderId,
}
if ( this.couopnInfo.userCouponInfos.filter(v => v.type == 2).length > 0 ) {
params.userCouponInfos = this.couopnInfo.userCouponInfos.filter(v => v.type == 2)
}
if ( this.couopnInfo.isPointsChecked && this.couopnInfo.calcUsablePointsData.pointsNum && this.couopnInfo.calcUsablePointsData.pointsNum > 0) {
params.pointsNum = this.couopnInfo.calcUsablePointsData.pointsNum;
}
let res = await this.api.useCoupon(params)
}
}
} else if ( this.type == 'confirm_order_product' || this.type == 'orderInfo_product' ) {
let couponList = selectCouponData.filter(v => v.type == 1);
let productList = selectCouponData.filter(v => v.type == 2);
if ( productList.length > 0 ) {
uni.cache.set('selectCouponData',couponList)
if ( this.couopnInfo && this.orderId ) {
let params = {
shopId: this.shopId,
orderId: this.orderId,
}
if ( this.couopnInfo.userCouponInfos.filter(v => v.type == 1).length > 0 ) {
params.userCouponInfos = this.couopnInfo.userCouponInfos.filter(v => v.type == 1)
}
if ( this.couopnInfo.isPointsChecked && this.couopnInfo.calcUsablePointsData.pointsNum && this.couopnInfo.calcUsablePointsData.pointsNum > 0) {
params.pointsNum = this.couopnInfo.calcUsablePointsData.pointsNum;
}
let res = await this.api.useCoupon(params)
}
}
}
uni.navigateBack();
},
}
};
@@ -151,12 +378,13 @@
.towcontent {
padding: 0 28rpx;
border-top: 16rpx solid #f7f7f7;
.towcontentlistxitem {
width: 100%;
margin-top: 32rpx;
.towcontentlistxitembox {
width: 33%;
width: 33.33%;
font-family: PingFang SC, PingFang SC;
font-weight: 500;
font-size: 28rpx;
@@ -170,8 +398,6 @@
}
.towcontentlistxitemboxopacity {
width: 33%;
font-family: PingFang SC, PingFang SC;
font-weight: bold;
text{
color: #E3AD7F;
@@ -208,13 +434,14 @@
position: relative;
border-radius: 18rpx;
box-shadow: 0rpx 6rpx 12rpx 2rpx rgba(0, 0, 0, 0.16);
overflow: hidden;
.containertopboxitemleft {
position: relative;
width: 182rpx;
height: 192rpx;
background: #E3AD7F;
border-radius: 18rpx 0rpx 0rpx 18rpx;
padding: 0 20rpx;
// ::before {
@@ -272,23 +499,22 @@
width: 40rpx;
height: 40rpx;
border-radius: 50%;
box-shadow: inset 0rpx -13rpx 7rpx -6rpx rgba(0, 0, 0, 0.1);
box-shadow: inset 0rpx 1rpx 9rpx 21rpx rgba(0, 0, 0, 0.04);
z-index: 999;
}
.containertopboxitemleft::before {
content: '';
position: absolute;
bottom: -20rpx;
left: 166rpx;
background: #fff;
display: inline-block;
width: 40rpx;
height: 40rpx;
border-radius: 50%;
box-shadow: inset 0rpx 0rpx 15rpx 1rpx rgba(0, 0, 0, 0.1);
z-index: 999;
}
.containertopboxitemleft::before {
content: '';
position: absolute;
bottom: -20rpx;
left: 166rpx;
background: #fff;
display: inline-block;
width: 40rpx;
height: 40rpx;
border-radius: 50%;
box-shadow: inset 0rpx 25rpx 15rpx -4rpx rgba(0, 0, 0, 0.1);
z-index: 999;
}
.containertopboxitemleft_vip{
background-color: #E1D4B2;
}
@@ -366,7 +592,29 @@
}
}
.select{
padding-bottom: 180rpx;
}
.btnBox{
width: 100%;
position: fixed;
bottom: 0;
left: 0;
z-index: 999;
background-color: #fff;
padding: 30rpx 30rpx 50rpx 30rpx;
.btn{
width: 100%;
height: 90rpx;
line-height: 90rpx;
text-align: center;
font-weight: bold;
font-size: 36rpx;
color: #FFFFFF;
border-radius: 12rpx;
background: #E3AD7F;
}
}
}
</style>

View File

@@ -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
},
/**

View File

@@ -57,7 +57,7 @@
teblist: [],
myAssetsList: [
{ name: "储值", type: "recharge", num: 0, icon: "https://czg-qr-order.oss-cn-beijing.aliyuncs.com/my/storedValue.png"},
// { name: "积分", type: "", num: 0, icon: "https://czg-qr-order.oss-cn-beijing.aliyuncs.com/my/points.png"},
{ name: "积分", type: "points", num: 0, icon: "https://czg-qr-order.oss-cn-beijing.aliyuncs.com/my/points.png"},
{ name: "优惠券", type: "my_coupon", num: 0, icon: "https://czg-qr-order.oss-cn-beijing.aliyuncs.com/my/coupon.png"},
// { name: "权益卡", type: "", num: 0, icon: "https://czg-qr-order.oss-cn-beijing.aliyuncs.com/my/equityCard.png"}
],
@@ -121,6 +121,9 @@
if (res.code == 0) {
uni.cache.set('userInfo', res.data);
this.userInfo = res.data;
this.myAssetsList[0].num = res.data.balanceAll || "";
this.myAssetsList[1].num = res.data.pointsAll || "";
this.myAssetsList[2].num = res.data.couponAll || "";
}
},
@@ -180,9 +183,7 @@
}
switch (item.type) {
case 'my_order':
uni.switchTab({
url: '/pages/order/order'
});
uni.pro.switchTab('order/order')
break
case 'my_member':
uni.pro.navigateTo('member/list')
@@ -200,7 +201,19 @@
}
break
case 'my_coupon': //内部页面
case 'points': //积分
if (uni.cache.get('shopId') && uni.cache.get('token')) {
uni.pro.navigateTo('/pagesPoints/index/index', {
shopId: uni.cache.get('shopId'),
type: 'user',
})
} else{
uni.pro.navigateTo('member/list', {
type: 'user_points'
})
}
break;
case 'my_coupon': //优惠券
uni.pro.navigateTo('user/coupon')
break;
case 'my_info': //内部页面

View File

@@ -0,0 +1,400 @@
<template>
<view class="container">
<view class="me" v-if="is_type == 'me'">
<image class="topImg" mode="widthFix" :src="InviteFriendsData.invitedImg"></image>
<view class="contentBox">
<view class="content">
<view class="title">{{InviteFriendsData.title}}</view>
<button class="btn" open-type="share" @click="onShareAppMessage">邀请好友</button>
<view class="label o">新用户获得</view>
<view class="card" v-for="(item,index) in InviteFriendsData.newCoupons">
<view class="left">
<view class="num"><text></text>{{item.discountAmount}}</view>
<view class="mnum">{{item.fullAmount}}可用</view>
</view>
<view class="right">
<view class="rtitle">{{item.couponName}}</view>
<view class="time">{{item.useDetail}}</view>
</view>
</view>
<view class="label t">每邀请{{InviteFriendsData.invitedNum||''}}个用户可获得</view>
<view class="card" v-for="(item,index) in InviteFriendsData.rewardCoupons">
<view class="left">
<view class="num"><text></text>{{item.discountAmount}}</view>
<view class="mnum">{{item.fullAmount}}可用</view>
</view>
<view class="right">
<view class="rtitle">{{item.couponName}}</view>
<view class="time">{{item.useDetail}}</view>
</view>
</view>
</view>
<view class="number">
<view class="tab">
<view class="tabItem"
@click="tabClick(item)"
:class="{active:tabAcitve == item.type}"
v-for="(item,index) in tabList" :key="index"
>{{item.label}}{{item.num||0}}</view>
</view>
<view class="tabContent">
<view class="tabContent_item" v-for="(item,index) in shareRecordData.list" :key="index">
<view class="top">
<view class="name">{{item.invitedName||("用户"+item.id)}}</view>
<view class="status" :style="{color: item.success ? '#333' : '#FF534B'}">{{
item.success ? '邀请成功' : '未邀请成功'
}}</view>
</view>
<view class="time">{{item.createTime}}</view>
</view>
</view>
</view>
</view>
</view>
<view class="he" v-else>
<image class="topImg" mode="widthFix" :src="InviteFriendsData.beInvitedImg"></image>
<view class="contentBox">
<view class="content">
<view class="title">{{userInfo.nickName}}</view>
<view class="label">[邀请你领取新人专享优惠券]</view>
<view class="card" v-for="(item,index) in shareOpenData.newCoupons">
<view class="left">
<view class="num"><text></text>{{item.discountAmount}}</view>
<view class="mnum">{{item.fullAmount}}可用</view>
</view>
<view class="right">
<view class="rtitle">{{item.couponName}}</view>
<view class="time">{{item.useDetail}}</view>
</view>
</view>
<view class="btn" v-if="shareOpenData.status == 1" @click="shareReceive">领券</view>
<view class="btn" v-else-if="shareOpenData.status == 0" style="background-color: #999;">已领完</view>
<view class="btn" v-else style="background-color: #999;">非新用户不可领取</view>
</view>
</view>
</view>
</view>
</template>
<script>
export default {
data() {
return {
show: false,
is_type: "",
tabList: [
{label: '已邀请', type: 1, num: 0},
{label: '无效' ,type: 2, num: 0}
],
tabAcitve: 1,
userInfo: uni.cache.get('userInfo'),
shopId: null,
shareId: null,
invitedId: null,
InviteFriendsData: null,
shareRecordData: null,
shareOpenData: null,
isSuccess: true,
share: {
title: "",
path: "",
imageUrl: ""
}
};
},
onLoad(options) {
console.log(options)
if ( options.shopId ) { this.shopId = options.shopId; }
if ( options.is_type ) { this.is_type = options.is_type; }
if ( options.shareId && options.invitedId != uni.cache.get('userInfo').id ) { this.shareId = options.shareId; }
if ( options.invitedId && options.invitedId != uni.cache.get('userInfo').id ) { this.invitedId = options.invitedId; }
if ( options.invitedId == uni.cache.get('userInfo').id ) {
this.is_type == 'me'
}
if ( this.is_type == 'he') {
this.shareHeOpen()
}
},
onShow() {
this.getByShopId();
},
methods: {
onShareAppMessage(res) {
if (res.from === 'button') {// 来自页面内分享按钮
console.log(res.target)
}
return this.share
},
async getByShopId() {
let params = {
shopId : this.shopId
}
let res = await this.api.getByShopId(params)
if ( res.code == 0 ) {
this.InviteFriendsData = res.data;
this.share.title = res.data.title
this.share.path = `/pagesInviteFriends/index/index?shopId=${this.shopId}&is_type=he&shareId=${this.InviteFriendsData.id}&invitedId=${uni.cache.get('userInfo').id}`
this.share.imageUrl = res.data.shareImg
this.shareRecord();
} else {
uni.showToast({
title: res.msg,
icon: "none",
})
setTimeout(()=>{
uni.navigateBack();
},2000)
}
},
/**
* 邀请记录
*/
async shareRecord() {
let params = {
shareId : this.InviteFriendsData.id,
invitedId : uni.cache.get('userInfo').id,
shopId : this.shopId,
success : this.tabAcitve == 1 ? true : false,
}
let res = await this.api.shareRecord(params)
if ( res.code == 0 ) {
this.shareRecordData = res.data.records;
this.tabList[0].num = res.data.isSuccess;
this.tabList[1].num = res.data.isFail;
}
},
/**
* 被邀请人进入页面调用接口
*/
async shareHeOpen() {
let params = {
shareId : this.shareId,
invitedId : this.invitedId,
beInvitedId : uni.cache.get('userInfo').id,
shopId : this.shopId,
}
let res = await this.api.shareHeOpen(params)
if ( res.code == 0 ) {
this.shareOpenData = res.data;
}
},
/**
* 领取优惠券
*/
async shareReceive() {
let params = {
shareId : this.shareId,
invitedId : this.invitedId,
beInvitedId : uni.cache.get('userInfo').id,
shopId : this.shopId,
}
let res = await this.api.shareReceive(params)
console.log(res)
if ( res.code == 0 ) {
uni.showToast({
title: "领取成功",
icon: "none",
})
setTimeout(()=>{
uni.pro.redirectTo('/pages/user/coupon', {
type: 1,
})
},1000)
}
},
tabClick(item) {
this.tabAcitve = item.type;
this.shareRecord();
},
}
};
</script>
<style scoped lang="scss">
.container{
.topImg{
width: 100%;
}
.contentBox{
padding: 0 20rpx;
}
.content{
background: #FFFFFF;
border-radius: 18rpx 18rpx 18rpx 18rpx;
position: relative;
padding: 0 24rpx 32rpx 24rpx;
.title{
font-weight: bold;
font-size: 32rpx;
color: #333333;
text-align: center;
height: 112rpx;
line-height: 112rpx;
}
.btn{
width: 100%;
height: 84rpx;
line-height: 84rpx;
text-align: center;
background: #E3AD7F;
border-radius: 12rpx 12rpx 12rpx 12rpx;
font-weight: bold;
font-size: 32rpx;
color: #FFFFFF;
margin: 0 auto;
}
.label{
font-weight: bold;
font-size: 32rpx;
color: #333333;
margin-bottom: 32rpx;
}
.label.o{
margin-top: 66rpx;
}
.label.t{
margin-top: 48rpx;
}
.card{
display: flex;
align-items: flex-start;
padding: 32rpx 32rpx;
background: #FCF9F4;
border-radius: 18rpx 18rpx 18rpx 18rpx;
border: 2rpx solid #333333;
margin-bottom: 32rpx;
.left{
border-right: 1rpx dashed #333;
padding-right: 34rpx;
margin-right: 46rpx;
flex-shrink: 0;
.num{
font-weight: 500;
font-size: 56rpx;
color: #333333;
margin-bottom: 30rpx;
text{
font-size: 32rpx;
}
}
.mnum{
font-weight: 400;
font-size: 24rpx;
color: #666666;
}
}
.right{
.rtitle{
font-weight: 500;
font-size: 28rpx;
color: #333333;
margin-bottom: 16rpx;
}
.time{
font-weight: 400;
font-size: 24rpx;
color: #999999;
}
}
}
}
.me{
.content{
margin-top: -112rpx;
}
.number{
background: #FFFFFF;
border-radius: 18rpx 18rpx 18rpx 18rpx;
padding: 32rpx 24rpx 32rpx 24rpx;
margin-top: 32rpx;
.tab{
background: #333333;
border-radius: 12rpx 12rpx 12rpx 12rpx;
padding: 8rpx 16rpx;
display: flex;
align-items: center;
.tabItem{
width: 100%;
height: 100%;
font-weight: 500;
font-size: 28rpx;
color: #FFFFFF;
text-align: center;
padding: 8rpx 0;
}
.tabItem.active{
color: #333333;
background: #FFFFFF;
border-radius: 8rpx 8rpx 8rpx 8rpx;
}
}
.tabContent{
display: flex;
flex-direction: column;
padding-top: 32rpx;
.tabContent_item{
margin-bottom: 32rpx;
.top{
display: flex;
align-items: center;
justify-content: space-between;
font-size: 28rpx;
color: #333333;
.name{
font-weight: bold;
}
.status{
}
}
.time{
font-weight: 400;
font-size: 24rpx;
color: #666666;
margin-top: 16rpx;
}
}
}
}
}
.he{
.content{
margin-top: -210rpx;
padding-top: 48rpx;
.title{
padding-left: 32rpx;
font-weight: 500;
font-size: 28rpx;
color: #666666;
text-align: left;
height: initial;
line-height: initial;
margin-bottom: 18rpx;
}
.label{
padding-left: 32rpx;
font-weight: bold;
font-size: 28rpx;
color: #333333;
}
}
.btn{
margin-top: 64rpx;
}
}
}
</style>

View File

@@ -33,6 +33,7 @@
</view>
</view>
</view>
<view class="status" v-if="listinfo.status == 'unpaid' || listinfo.status == 'paying'">未付款</view>
<view class="totalAmount">
<view class="label">小计</view>
@@ -52,6 +53,76 @@
<view>{{listinfo.orderInfo.seatAmount}}</view>
</view>
</view>
<block v-if="listinfo.status == 'unpaid' || listinfo.status == 'paying'">
<view v-for="(item,indexe) in favorable" :key="indexe" >
<view v-if="!rechargeFreeChecked" class="favorable" :class="{column:item.value.length>0&&item.type=='product'}" @click="goUrl(item)">
<view class="favorable_left">
<!-- <image class="icon" :src="item.url" mode="aspectFill"/> -->
<text class="name"> {{ item.name }} </text>
</view>
<view class="favorable_right" v-if="item.type=='coupon'">
<text class="favorable_right_text">{{item.value}}</text>
<u-icon name="arrow-right" color="#575B66" size="28" v-if="listinfo.status == 'unpaid' || listinfo.status == 'paying'"></u-icon>
</view>
<view class="favorable_right" :class="{column:item.value.length>0}" v-if="item.type=='product'">
<view :class="{column:item.value.length>0}">
<view class="favorable_right_text" v-for="(items,indexs) in item.value" :key="indexs">
<text>{{items.name}}</text>
<text>X{{items.num}}</text>
<text>-{{items.discountAmount || 0}}</text>
</view>
</view>
<u-icon name="arrow-right" color="#575B66" size="28" style="margin-top: 5rpx;"></u-icon>
</view>
<view class="favorable_right" v-if="item.type=='points'" @click.stop="pointsChange">
<text class="favorable_right_text" style="color: #666;margin-right: 16rpx;" v-if="calcUsablePointsData.usable">
使用 {{ calcUsablePointsData.pointsNum}} 积分抵扣{{calcUsablePointsData.pointsNum/calcUsablePointsData.equivalentPoints}}
</text>
<text class="favorable_right_text" style="color: #666;margin-right: 16rpx;color: #DE4D3A;" v-else>
{{calcUsablePointsData.unusableReason||''}}
</text>
<u-checkbox-group iconPlacement="right" @change="pointsChange">
<u-checkbox v-model="isPointsChecked" :disabled="freeCheck||!calcUsablePointsData.usable" :checked="isPointsChecked" activeColor="#E8AD7B" shape="circle" icon-size="36" size="36">
</u-checkbox>
</u-checkbox-group>
</view>
</view>
</view>
</block>
<block v-else>
<block v-for="(item,index) in listinfo.orderInfo.couponInfoList.fullReductionCoupon" :key="index">
<view class="cell-item" v-if="item.type == 1">
<view class="label">优惠券</view>
<view class="val">
<view></view>
<view style="font-size: 28rpx;">-</view>
<view>{{item.discountAmount}}</view>
</view>
</view>
</block>
<view class="cell-item column" v-if="listinfo.orderInfo.couponInfoList.productCoupon.length > 0">
<view class="label">商品券</view>
<view class="val column">
<view class="productCoupon" v-for="(item,index) in listinfo.orderInfo.couponInfoList.productCoupon" :key="index">
<view class="name">{{item.name}}</view>
<view class="num">X{{item.finalUseNum}}</view>
<view class="amount">-{{item.finalDiscountAmount}}</view>
</view>
</view>
</view>
<view class="cell-item" v-if="listinfo.orderInfo && listinfo.orderInfo.pointsDiscountAmount && listinfo.orderInfo.pointsDiscountAmount > 0">
<view class="label">积分抵扣</view>
<view class="val">
<view></view>
<view style="font-size: 28rpx;"></view>
<view>{{listinfo.orderInfo.pointsDiscountAmount.toFixed(2)}}</view>
</view>
</view>
</block>
<view class="total-wrap">
<view>总计</view>
<view class="price"> {{listinfo.payAmount}} </view>
@@ -81,11 +152,11 @@
</view>
<view class="row">
<text class="t">备注</text>
<text class="info">{{ listinfo.orderInfo.remark||""}}</text>
<text class="info">{{ listinfo.orderInfo.remark || ""}}</text>
</view>
<view class="row">
<text class="t">就餐人数</text>
<text class="info">{{ listinfo.orderInfo.seatCount}}</text>
<text class="info">{{ listinfo.orderInfo.seatCount || ""}}</text>
</view>
</view>
</view>
@@ -97,19 +168,371 @@
data() {
return {
favorable: [
{ name: "优惠券", type: "coupon",value: "", url: "https://czg-qr-order.oss-cn-beijing.aliyuncs.com/confirmOrder/coupon.png"},
{ name: "商品券", type: "product",value: [], url: "https://czg-qr-order.oss-cn-beijing.aliyuncs.com/confirmOrder/coupon.png"},
// { name: "团购优惠", type: "group",value: "", url: "https://czg-qr-order.oss-cn-beijing.aliyuncs.com/confirmOrder/groupOffer.png"},
{ name: "积分抵扣", type: "points",value: "", url: "https://czg-qr-order.oss-cn-beijing.aliyuncs.com/confirmOrder/points.png" }
],
calcUsablePointsData: null,
isShow: false,
payAmount: 0,
isPointsChecked: false,
userCouponInfos: [],
selectCouponData: [],
}
},
props:{
rechargeFreeChecked: {
type: Boolean
},
freeCheck: {
type: Boolean
},
listinfo:{
type: Object
}
},
amountVIP:{
type: Object
},
},
watch :{
listinfo:{
immediate: true,
handler (newVal) {
console.log(newVal)
this.$forceUpdate()
}
},
rechargeFreeChecked:{
immediate: true,
handler (newVal) {
console.log(this.isPointsChecked)
if ( newVal ) {
// let couponList = this.userCouponInfos.filter(v => v.type == 1);
// this.listinfo.payAmount = (couponList.length > 0 ? Number(this.listinfo.payAmount) + couponList[0].discountAmount : this.listinfo.payAmount)
// let productList = this.userCouponInfos.filter(v => v.type == 2);
// productList.map(item=> {
// this.listinfo.payAmount += item.productPayAmount
// })
this.isPointsChecked = false
this.$emit("setPayAmount",{
payAmount: this.listinfo.payAmount,
userCouponInfos: this.userCouponInfos,
freeCheck: this.freeCheck,
calcUsablePointsData: this.calcUsablePointsData,
isPointsChecked: this.isPointsChecked,
})
}
// this.userCouponInfos = []
}
},
},
mounted() {
this.payAmount = this.listinfo.payAmount;
uni.cache.set('selectCouponData',[])
this.isShow = true;
console.log(this.listinfo.orderInfo.couponInfoList)
if ( this.listinfo.orderInfo.couponInfoList ) {
if ( this.listinfo.orderInfo.couponInfoList.fullReductionCoupon.length > 0) {
let couponData = this.listinfo.orderInfo.couponInfoList.fullReductionCoupon[0]
this.favorable[0].value = '-¥'+couponData.discountAmount
this.payAmount = this.payAmount + couponData.discountAmount
this.userCouponInfos.push({
userCouponId: couponData.id,
type: couponData.type,
discountAmount: couponData.discountAmount,
num: couponData.num,
})
let selectCouponData = uni.cache.get('selectCouponData') || [];
selectCouponData.push(couponData)
uni.cache.set('selectCouponData',selectCouponData)
}
if ( this.listinfo.orderInfo.couponInfoList.productCoupon.length > 0) {
this.listinfo.orderInfo.couponInfoList.productCoupon.map(item=>{
this.userCouponInfos.push({
userCouponId: item.id,
type: item.type,
productId: item.proId,
discountAmount: item.finalDiscountAmount,
num: item.finalUseNum,
})
this.favorable[1].value.push({
userCouponId: item.id,
name: item.name,
type: item.type,
productId: item.proId,
discountAmount: item.finalDiscountAmount,
num: item.finalUseNum,
})
this.payAmount = this.payAmount + item.finalDiscountAmount
let selectCouponData = uni.cache.get('selectCouponData') || [];
selectCouponData.push(item)
uni.cache.set('selectCouponData',selectCouponData)
})
}
}
let calcUsablePointsData = {}
if ( this.listinfo.orderInfo.pointsDiscountAmount ) {
this.payAmount = this.payAmount + this.listinfo.orderInfo.pointsDiscountAmount
this.isPointsChecked = true;
calcUsablePointsData.pointsNum = this.listinfo.orderInfo.pointsDiscountAmount
}
this.$emit("setPayAmount",{
payAmount: this.listinfo.payAmount,
userCouponInfos: this.userCouponInfos,
freeCheck: this.freeCheck,
isPointsChecked: this.isPointsChecked,
calcUsablePointsData: calcUsablePointsData,
})
},
methods: {
childOnShow() {
console.log('isShow==',this.isShow)
if (!this.isShow ) {
this.getCalcUsablePoints()
return;
}
// uni.$on('couponItem',this.changeCoupon)
this.userCouponInfos = [];
this.favorable[0].value = ""
this.favorable[1].value = []
this.listinfo.payAmount = this.payAmount
this.selectCouponData = uni.cache.get('selectCouponData') || []
this.changeCoupon();
},
/**
* 监听优惠券/商品券选择
* @param {Object} data
*/
changeCoupon ( data ) {
// 优惠券数据
let couponList = this.selectCouponData.filter(v => v.type == 1);
// 商品券列表
let productList = this.selectCouponData.filter(v => v.type == 2);
// 优惠券处理
if ( couponList.length > 0 ) {
let couponData = couponList[0]
//不包含优惠券的金额
let currentPayAmount = (this.userCouponInfos.filter(v => v.type == 1).length > 0 ? Number(this.listinfo.payAmount) + couponData.discountAmount : this.listinfo.payAmount)
// 判断优惠金额不能大于支付金额
if ( couponData.discountAmount <= currentPayAmount) {
// if ( this.isPointsChecked && this.calcUsablePointsData) {
// this.listinfo.payAmount = (this.listinfo.payAmount-(this.calcUsablePointsData.pointsNum/this.calcUsablePointsData.equivalentPoints)).toFixed(2);
// } else {
// this.listinfo.payAmount = (Number(this.listinfo.payAmount)+(this.calcUsablePointsData.pointsNum/this.calcUsablePointsData.equivalentPoints)).toFixed(2);
// }
this.listinfo.payAmount = ( currentPayAmount - couponData.discountAmount).toFixed(2)
this.favorable[0].value = ('-¥'+couponData.discountAmount)
this.userCouponInfos.push({
userCouponId: couponData.id,
type: couponData.type,
discountAmount: couponData.discountAmount,
num: couponData.type == 1 ? 1 : couponData.num,
})
this.$emit("setPayAmount",{
payAmount: this.listinfo.payAmount,
userCouponInfos: this.userCouponInfos,
freeCheck: this.freeCheck,
calcUsablePointsData: this.calcUsablePointsData,
isPointsChecked: this.isPointsChecked,
})
} else {
uni.showToast({
title: "优惠券满减金额大于订单金额不可使用",
icon: "none",
})
}
}
// 商品券处理
if ( productList.length > 0 ) {
//商品券使用数量
let payAmount = this.listinfo.payAmount
productList.map((item,index)=>{
// 筛选选中商品券商品列表
let productDetails = this.listinfo.details.filter(v => v.productId == item.proId);
//金额从小到大排序
let minCouponList = productDetails.sort((a, b) => (a.memberPrice > 0 ? a.memberPrice : a.salePrice) - (b.memberPrice > 0 ? b.memberPrice : b.salePrice))
// 商品数量
let productAllNum = 0;
let productNum = 0
let productPayAmount = 0
minCouponList.map((v,indexs) => {
productNum = 0;
productPayAmount = 0;
let productDetailsNum = 0;
productDetails.map((v,indexs) => {
productDetailsNum += v.num;
})
for (let i = 0; i < v.num; i++){
if ( productAllNum < productDetailsNum && productNum < item.num && ((v.memberPrice > 0 ? v.memberPrice : v.price) <= (payAmount - productPayAmount) )) {
productNum++
productAllNum++
productPayAmount += v.memberPrice > 0 ? v.memberPrice : v.price
}
}
payAmount = payAmount - productPayAmount
})
if ( productNum > 0 ) {
this.userCouponInfos.push({
userCouponId: item.id,
type: item.type,
productId: item.proId,
discountAmount: productPayAmount,
num: productNum ,
})
this.favorable[1].value.push({
userCouponId: item.id,
name: item.name,
type: item.type,
productId: item.proId,
discountAmount: productPayAmount,
num: productNum,
})
}
})
}
this.setPayAmount()
},
setPayAmount ( cartLists ) {
let tableFee;
// this.storeInfo.registerType == 'munchies'
if ( this.userCouponInfos.length > 0 ) {
console.log(this.userCouponInfos)
this.userCouponInfos.forEach(item => {
if ( item.type == 2 ) {
if ( item.discountAmount && item.discountAmount > 0 ) {
this.listinfo.payAmount = (this.listinfo.payAmount - item.discountAmount).toFixed(2)
}
}
})
}
this.isPointsChecked = false;
this.getCalcUsablePoints()
this.$emit("setPayAmount",{
payAmount: this.listinfo.payAmount,
userCouponInfos: this.userCouponInfos,
freeCheck: this.freeCheck,
calcUsablePointsData: this.calcUsablePointsData,
isPointsChecked: this.isPointsChecked,
})
},
/**
* 积分状态监听
*/
pointsChange (){
if ( this.freeCheck || !this.calcUsablePointsData.usable) {
return;
}
this.isPointsChecked = !this.isPointsChecked
if ( this.isPointsChecked ) {
this.listinfo.payAmount = (this.listinfo.payAmount-(this.calcUsablePointsData.pointsNum/this.calcUsablePointsData.equivalentPoints)).toFixed(2);
} else {
this.listinfo.payAmount = (Number(this.listinfo.payAmount)+(this.calcUsablePointsData.pointsNum/this.calcUsablePointsData.equivalentPoints)).toFixed(2);
}
this.$emit("setPayAmount",{
payAmount: this.listinfo.payAmount,
userCouponInfos: this.userCouponInfos,
freeDisabled: this.freeDisabled,
freeCheck: this.freeCheck,
calcUsablePointsData: this.calcUsablePointsData,
isPointsChecked: this.isPointsChecked,
})
},
goUrl(item){
if ( this.listinfo.status == 'unpaid' || this.listinfo.status == 'paying') {
let couopnInfo;
switch (item.type){
case 'coupon':
let payAmount = this.listinfo.payAmount;
let couponList = this.userCouponInfos.filter(v => v.type == 1);
if ( couponList.length > 0 ) {
payAmount = payAmount + couponList.discountAmount;
}
couopnInfo = {
payAmount: this.listinfo.payAmount,
userCouponInfos: this.userCouponInfos,
freeDisabled: this.freeDisabled,
freeCheck: this.freeCheck,
calcUsablePointsData: this.calcUsablePointsData,
isPointsChecked: this.isPointsChecked,
}
uni.pro.navigateTo('/pages/user/coupon', {
type: "orderInfo_coupon",
shopId: this.listinfo.shopId,
orderId: this.listinfo.orderInfo.id,
couopnInfo: JSON.stringify(couopnInfo),
payAmount: payAmount,
shoppingCart: JSON.stringify(this.listinfo.details),
productList: JSON.stringify(couponList)
})
break;
case 'product':
let productList = this.userCouponInfos.filter(v => v.type == 2);
couopnInfo = {
payAmount: this.listinfo.payAmount,
userCouponInfos: this.userCouponInfos,
freeDisabled: this.freeDisabled,
freeCheck: this.freeCheck,
calcUsablePointsData: this.calcUsablePointsData,
isPointsChecked: this.isPointsChecked,
}
uni.pro.navigateTo('/pages/user/coupon', {
type: "orderInfo_product",
shopId: this.listinfo.shopId,
orderId: this.listinfo.orderInfo.id,
couopnInfo: JSON.stringify(couopnInfo),
payAmount: this.listinfo.payAmount,
shoppingCart: JSON.stringify(this.listinfo.details),
productList: JSON.stringify(productList)
})
break;
}
}
},
/**
* 获取积分相关信息
*/
async getCalcUsablePoints() {
let params = {
memberId: this.listinfo.orderInfo.memberId,
}
if ( this.listinfo.orderInfo.pointsDiscountAmount ) {
params.orderAmount = this.listinfo.payAmount + this.listinfo.orderInfo.pointsDiscountAmount
} else {
params.orderAmount = this.listinfo.payAmount
}
let res = await this.api.calcUsablePoints(params)
this.calcUsablePointsData = res.data;
if ( this.calcUsablePointsData.usable && params.orderAmount >= this.calcUsablePointsData.minPaymentAmount) {
this.calcUsablePointsData.pointsNum = this.calcUsablePointsData.accountPoints >= this.calcUsablePointsData.maxUsablePoints ? this.calcUsablePointsData.maxUsablePoints : this.calcUsablePointsData.accountPoints
}
},
/**
* 复制订单号
* @param {Object} e
@@ -338,8 +761,102 @@
color: #333333;
}
}
.val.column{
display: flex;
flex-direction: column;
.productCoupon{
display: flex;
align-items: flex-end;
margin: 0 0 10rpx 0;
.name{
font-weight: 400;
font-size: 26rpx;
color: #999;
margin: 0;
}
.num{
font-weight: 400;
font-size: 26rpx;
color: #999;
margin: 0 30rpx;
line-height: 20rpx;
}
.amount{
font-weight: bold;
font-size: 26rpx;
color: #333;
}
}
}
}
.favorable{
display: flex;
align-items: center;
justify-content: space-between;
padding: 0 30rpx;
box-sizing: border-box;
padding-bottom: 26rpx;
padding-top: 26rpx;
border-bottom: 2rpx solid #E5E5E5;
.favorable_left{
display: flex;
align-items: center;
.icon{
width: 40rpx;
height: 40rpx;
margin-right: 16rpx;
}
.name{
font-size: 28rpx;
font-weight: 400rpx;
color: #333;
}
}
.favorable_right{
display: flex;
align-items: center;
.favorable_right_text{
font-size: 24rpx;
color: #999;
font-weight: 400rpx;
}
}
.favorable_right{
.column{
display: flex;
flex-direction: column;
align-items: flex-end;
.favorable_right_text{
margin-bottom: 10rpx;
text:nth-child(1){
font-size: 26rpx;
color: #999;
}
text:nth-child(2){
font-size: 26rpx;
color: #999;
margin: 0 30rpx;
}
text:nth-child(3){
font-size: 26rpx;
color: #333;
}
}
}
}
.favorable_right.column{
align-items: flex-start;
}
}
.favorable.column{
align-items: flex-start;
}
.cell-item.column{
align-items: flex-start;
}
.total-wrap {
width: 100%;
display: flex;
@@ -386,6 +903,7 @@
font-weight: bold;
font-size: 28rpx;
color: #333333;
flex-shrink: 0;
}
.info {

View File

@@ -91,6 +91,34 @@
<view>{{listinfo.orderInfo.seatAmount}}</view>
</view>
</view>
<block v-if="listinfo.orderInfo&&listinfo.orderInfo.couponInfoList && listinfo.orderInfo.couponInfoList.fullReductionCoupon">
<view class="cell-item" v-for="(item,index) in listinfo.orderInfo.couponInfoList.fullReductionCoupon" :key="index">
<view class="label">优惠券</view>
<view class="val">
<view></view>
<view style="font-size: 28rpx;">-</view>
<view>{{item.discountAmount}}</view>
</view>
</view>
</block>
<view class="cell-item column" v-if="listinfo.orderInfo&&listinfo.orderInfo.couponInfoList && listinfo.orderInfo.couponInfoList.productCoupon">
<view class="label">商品券</view>
<view class="val column">
<view class="productCoupon" v-for="(item,index) in listinfo.orderInfo.couponInfoList.productCoupon" :key="index">
<view class="name">{{item.name}}</view>
<view class="num">X{{item.finalUseNum}}</view>
<view class="amount">-{{item.finalDiscountAmount}}</view>
</view>
</view>
</view>
<view class="cell-item" v-if="listinfo.orderInfo && listinfo.orderInfo.pointsDiscountAmount && listinfo.orderInfo.pointsDiscountAmount > 0">
<view class="label">积分抵扣</view>
<view class="val">
<view></view>
<view style="font-size: 28rpx;"></view>
<view>{{listinfo.orderInfo.pointsDiscountAmount.toFixed(2)}}</view>
</view>
</view>
<view class="total-wrap">
<view>合计</view>
<view class="price"> {{listinfo.payAmount}} </view>
@@ -112,7 +140,25 @@
<text class="t">下单时间</text>
<text class="info">{{$u.timeFormat(listinfo.time, 'yyyy-mm-dd hh:MM:ss')}}</text>
</view>
<view class="row">
<text class="t">下单门店</text>
<text class="info">{{listinfo.name}}</text>
</view>
<view class="row">
<text class="t">订单类型</text>
<text class="info" v-if="listinfo.sendType == 'post'">快递</text>
<text class="info" v-if="listinfo.sendType == 'takeaway'">外卖</text>
<text class="info" v-if="listinfo.sendType == 'takeself'">自提</text>
<text class="info" v-if="listinfo.sendType == 'table'">堂食</text>
</view>
<view class="row">
<text class="t">备注</text>
<text class="info">{{ listinfo.orderInfo.remark||""}}</text>
</view>
<view class="row">
<text class="t">就餐人数</text>
<text class="info">{{ listinfo.orderInfo.seatCount || ""}}</text>
</view>
</view>
</view>
@@ -281,6 +327,7 @@
}
.shop-info {
margin-top: 32rpx;
margin-bottom: 32rpx;
.item:nth-child(1) {
margin-top: 0;
}
@@ -341,7 +388,7 @@
display: flex;
align-items: center;
justify-content: space-between;
padding: 32rpx 0;
padding: 0 0 32rpx 0;
.label{
font-weight: bold;
font-size: 28rpx;
@@ -353,13 +400,13 @@
align-items: flex-end;
padding-bottom: 32rpx;
border-bottom: 2rpx dashed #e5e5e5;
view:nth-child(1){
>view:nth-child(1){
font-weight: 400;
font-size: 24rpx;
color: #999999;
margin-right: 42rpx;
}
view:nth-child(2){
>view:nth-child(2){
display: flex;
align-items: flex-end;
font-weight: bold;
@@ -367,6 +414,36 @@
color: #333333;
}
}
.val.column{
display: flex;
flex-direction: column;
.productCoupon{
display: flex;
align-items: flex-end;
margin: 0 0 10rpx 0;
.name{
font-weight: 400;
font-size: 26rpx;
color: #999;
margin: 0;
}
.num{
font-weight: 400;
font-size: 26rpx;
color: #999;
margin: 0 30rpx;
line-height: 20rpx;
}
.amount{
font-weight: bold;
font-size: 26rpx;
color: #333;
}
}
}
}
.cell-item.column{
align-items: flex-start;
}
.total-wrap {
width: 100%;

View File

@@ -18,7 +18,7 @@
</view>
</view>
</view>
<u-radio activeColor="#E8AD7B" icon-size="36" size="36" :name="item.type">
<u-radio activeColor="#E8AD7B" :disabled="(freeCheck&&index==0) || (index!=0&&payAmount<=0) || (rechargeFreeChecked&&index==0)" icon-size="36" size="36" :name="item.type">
</u-radio>
</view>
@@ -55,13 +55,79 @@
}
},
props:{
rechargeFreeChecked:{
type: Boolean
},
payAmount:{
type: Number
},
amountVIP:{
type: Object
},
freeCheck: {
type: Boolean
}
},
watch: {
// freeCheck(newVal,oldVal) {
// if ( newVal ) {
// // #ifdef MP-WEIXIN
// this.radiovalue = 2
// // #endif
// // #ifdef MP-ALIPAY
// this.radiovalue = 3
// // #endif
// let name = this.paymentMethodName[this.radiovalue-1].name;
// console.log({type:this.radiovalue ,name: name })
// this.$emit("groupChange",{type:this.radiovalue ,name: name })
// }
// }
payAmount:{
immediate: true,
handler (newVal) {
if ( newVal <= 0 ) {
this.radiovalue = 1
let name = this.paymentMethodName[this.radiovalue-1].name;
this.$emit("groupChange",{type:this.radiovalue ,name: name })
}
}
},
rechargeFreeChecked:{
immediate: true,
handler (newVal) {
if ( newVal ) {
// #ifdef MP-WEIXIN
this.radiovalue = 2
// #endif
// #ifdef MP-ALIPAY
this.radiovalue = 3
// #endif
let name = this.paymentMethodName[this.radiovalue-1].name;
this.$emit("groupChange",{type:this.radiovalue ,name: name })
}
}
},
freeCheck:{
immediate: true,
handler (newVal) {
if ( newVal ) {
// #ifdef MP-WEIXIN
this.radiovalue = 2
// #endif
// #ifdef MP-ALIPAY
this.radiovalue = 3
// #endif
let name = this.paymentMethodName[this.radiovalue-1].name;
this.$emit("groupChange",{type:this.radiovalue ,name: name })
}
}
},
},
mounted() {
console.log(this.amountVIP)
// console.log(this.amountVIP)
// this.getAount();
},
methods: {
/**
@@ -69,7 +135,12 @@
* @param {Object}
*/
groupChange(type) {
console.log(type)
if ( this.freeCheck && type == 1 ) {
return;
}
if ( this.payAmount<=0 && type != 1 ) {
return;
}
this.radiovalue = type;
let name = this.paymentMethodName[type-1].name;
this.$emit("groupChange",{type:type ,name: name })
@@ -92,7 +163,6 @@
.paymentMethod{
box-sizing: border-box;
margin-top: 30rpx;
padding: 0 20rpx 220rpx 20rpx;
border-radius: 18rpx;
.paymentMethod_content{
background-color: #fff;

View File

@@ -4,10 +4,10 @@
<view class="rechargeFree_bg" @click="changeFree">
<view class="left">
<view class="icon">优惠</view>
<view class="text">充值消费2倍50本单立享免单</view>
<view class="text">充值消费{{freeDingConfig.rechargeTimes}}订单满{{freeDingConfig.rechargeThreshold}}元可用本单立享免单</view>
</view>
<u-checkbox-group iconPlacement="right" >
<u-checkbox v-model="rechargeFreeChecked" :checked="rechargeFreeChecked" @change="changeFree" activeColor="#E8AD7B" shape="circle" icon-size="36" size="36">
<u-checkbox :disabled="freeDisabled" v-model="rechargeFreeChecked" :checked="rechargeFreeChecked" @change="changeFree" activeColor="#E8AD7B" shape="circle" icon-size="36" size="36">
</u-checkbox>
</u-checkbox-group>
</view>
@@ -18,15 +18,40 @@
export default {
data() {
return {
rechargeFreeChecked: false,
freeDisabled: false,
}
},
props:{
shopUserInfo:{
type: Object
},
freeDingConfig:{
type: Object
},
payAmount: {
type: Number
},
rechargeFreeChecked: {
type: Boolean
},
},
watch: {
payAmount (newVal) {
if ( this.freeDingConfig && this.payAmount < this.freeDingConfig.rechargeThreshold ) {
this.freeDisabled = true
} else {
this.freeDisabled = false
}
}
},
mounted() {
if ( this.freeDingConfig && this.payAmount < this.freeDingConfig.rechargeThreshold ) {
this.freeDisabled = true
} else {
this.freeDisabled = false
}
console.log(this.freeDisabled )
},
methods: {
@@ -34,7 +59,9 @@
* 监听是否免单
*/
changeFree ( e ) {
this.rechargeFreeChecked = !this.rechargeFreeChecked;
if ( this.freeDisabled ) {
return;
}
this.$emit("changeFree",this.rechargeFreeChecked)
}
}
@@ -44,7 +71,7 @@
<style lang="scss">
// 充值免单
.rechargeFree{
padding: 0 20rpx;
// padding: 0 20rpx;
margin-top: 32rpx;
.rechargeFree_bg{
display: flex;
@@ -69,6 +96,7 @@
margin-right: 12rpx;
}
.text{
width: 90%;
font-weight: 500;
font-size: 28rpx;
color: #333333;

View File

@@ -1,6 +1,6 @@
<template>
<!-- 充值活动 -->
<view class="topUp">
<view class="topUp" v-if="list.length > 0">
<view class="topUpActivity">
<view class="topUpActivity_title">充值更划算</view>
<view class="content">

View File

@@ -22,7 +22,7 @@
<image class="icon" src="https://czg-qr-order.oss-cn-beijing.aliyuncs.com/confirmOrder/table.png" mode="aspectFill"/>
<text class="title">桌台</text>
</view>
<view class="value" v-if="tableCode"> {{ shopTableInfo.name }} </view>
<view class="value" v-if="tableCode"> {{ shopTableInfo.name || '' }} </view>
<u-icon v-else @click="scan" name="scan" size="60"></u-icon>
</view>
<!-- 打包外带 -->
@@ -46,10 +46,13 @@
<view class="tabBox_t " v-if="storeInfo.registerType == 'restaurant'">
<view class="shopName">{{ listinfo.name }}</view>
<view class="tableName">
<view>桌号</view>
<view class="name">{{ shopTableInfo.name }} </view>
<view class="num" v-if="shopTableInfo&&shopTableInfo.seatNum">{{ shopTableInfo.seatNum }}</view>
<view class="tableName" style="display: flex;align-items: center;justify-content: space-between;">
<view style="display: flex;">
<view>桌号</view>
<view class="name" v-if="shopTableInfo.name">{{ shopTableInfo.name || '' }} </view>
<view class="num" v-if="shopTableInfo&&shopTableInfo.seatNum">{{ shopTableInfo.seatNum }}</view>
</view>
<u-icon v-if="!shopTableInfo.name" @click="scan" name="scan" size="60"></u-icon>
</view>
</view>
</view>
@@ -64,12 +67,20 @@
<view class="center" >
<text class="center_title"> {{item.name || item.productName || "" }} </text>
<text class="type"> {{ item.skuName || item.productSkuName || ""}} </text>
<text class="num" > X{{ item.totalNumber || item.num}} </text>
<text class="num" > X{{ item.totalNumber || ""}} </text>
</view>
</view>
<view class="price"> {{ item.totalAmount || item.priceAmount || 0}} </view>
<view class="price"> {{ item.memberPrice*item.totalNumber || item.salePrice*item.totalNumber || 0}} </view>
</view>
<view class="cell-item" v-if="shopTableInfo&&shopTableInfo.seatNum&&sendType=='table'">
<view class="cell-item" v-if="packFee && packFee > 0">
<view class="label">打包费</view>
<view class="val">
<view></view>
<view style="font-size: 28rpx;"></view>
<view>{{packFee.toFixed(2)}}</view>
</view>
</view>
<view class="cell-item" v-if="shopTableInfo&&shopTableInfo.seatNum&&sendType=='table'&&storeInfo.registerType == 'munchies'">
<view class="label">餐位费</view>
<view class="val">
<view>X{{shopTableInfo.seatNum}}</view>
@@ -77,20 +88,43 @@
<view>{{(shopTableInfo.seatNum*storeInfo.tableFee).toFixed(2)}}</view>
</view>
</view>
<view class="favorable" v-for="(item,index) in favorable" :key="index">
<view class="favorable_left">
<image class="icon" :src="item.url" mode="aspectFill"/>
<text class="name"> {{ item.name }} </text>
<view v-for="(item,index) in favorable" :key="index" v-if="storeInfo.registerType == 'munchies'&&!rechargeFreeChecked">
<view class="favorable" :class="{column:item.value.length>0&&item.type=='product'}" @click="goUrl(item)">
<view class="favorable_left">
<!-- <image class="icon" :src="item.url" mode="aspectFill"/> -->
<text class="name"> {{ item.name }} </text>
</view>
<view class="favorable_right" v-if="item.type=='coupon'">
<text class="favorable_right_text">{{item.value}}</text>
<u-icon name="arrow-right" color="#575B66" size="28"></u-icon>
</view>
<view class="favorable_right" :class="{column:item.value.length>0}" v-if="item.type=='product'">
<view :class="{column:item.value.length>0}">
<view class="favorable_right_text" v-for="(items,indexs) in item.value" :key="indexs">
<text>{{items.name}}</text>
<text>X{{items.num}}</text>
<text>-{{items.discountAmount || 0}}</text>
</view>
</view>
<u-icon name="arrow-right" color="#575B66" size="28" style="margin-top: 5rpx;"></u-icon>
</view>
<view class="favorable_right" v-if="item.type=='points'" @click.stop="pointsChange">
<text class="favorable_right_text" style="color: #666;margin-right: 16rpx;" v-if="calcUsablePointsData.usable">
使用 {{ calcUsablePointsData.pointsNum}} 积分抵扣{{calcUsablePointsData.pointsNum/calcUsablePointsData.equivalentPoints}}
</text>
<text class="favorable_right_text" style="color: #666;margin-right: 16rpx;color: #DE4D3A;" v-else>
{{calcUsablePointsData.unusableReason||''}}
</text>
<u-checkbox-group iconPlacement="right" @change="pointsChange">
<u-checkbox v-model="isPointsChecked" :disabled="freeCheck||!calcUsablePointsData.usable" :checked="isPointsChecked" activeColor="#E8AD7B" shape="circle" icon-size="36" size="36">
</u-checkbox>
</u-checkbox-group>
</view>
</view>
<view class="favorable_right" v-if="item.type == 'points'" @click="isPointsChecked = !isPointsChecked">
<text class="favorable_right_text" style="color: #666;margin-right: 16rpx;">使用29积分抵扣29.00</text>
<u-checkbox-group iconPlacement="right">
<u-checkbox v-model="isPointsChecked" :checked="isPointsChecked" activeColor="#E8AD7B" shape="circle" icon-size="36" size="36">
</u-checkbox>
</u-checkbox-group>
</view>
<view class="favorable_right" v-else ><text class="favorable_right_text">暂无可用优惠券</text> <u-icon name="arrow-right" color="#575B66" size="28"></u-icon></view>
</view>
<view class="totalPrice">
<text style="margin-bottom: 5rpx;">小计</text>
<text class="totalPriceNum"> {{listinfo.payAmount}} </text>
@@ -107,12 +141,16 @@
</view>
<!-- 充值免单 -->
<!-- <rechargeFree ref="rechargeFree" :shopUserInfo="amountVIP" @changeFree="changeFree"></rechargeFree> -->
<view style="padding: 0 20rpx;">
<rechargeFree v-if="freeDingConfig&&freeDingConfig.enable == 1&&storeInfo.registerType == 'munchies'" ref="rechargeFree" :rechargeFreeChecked="rechargeFreeChecked" :freeDisabled="freeDisabled" :payAmount="listinfo.payAmount" :freeDingConfig="freeDingConfig" :shopUserInfo="amountVIP" @changeFree="changeFree"></rechargeFree>
</view>
<!-- 充值活动 -->
<!-- <topUpActivity ref="topUpActivity" :shopUserInfo="amountVIP" ></topUpActivity> -->
<topUpActivity v-if="storeInfo.registerType == 'munchies'" ref="topUpActivity" :shopUserInfo="amountVIP" ></topUpActivity>
<!-- 支付方式 -->
<paymentMethod ref="paymentMethod" :amountVIP="amountVIP" v-if="storeInfo.registerType == 'munchies'" @groupChange="groupChange"></paymentMethod>
<view style="padding: 0 20rpx;">
<paymentMethod ref="paymentMethod" :freeCheck="freeCheck" :rechargeFreeChecked="rechargeFreeChecked" :payAmount="listinfo.payAmount" :amountVIP="amountVIP" v-if="storeInfo.registerType == 'munchies'" @groupChange="groupChange"></paymentMethod>
</view>
<view style="width: 100%;height: 200rpx;"> </view>
<view class="bottom">
<view class="bottom_left">
<text style="margin-bottom: 5rpx;">实付金额</text>
@@ -178,37 +216,47 @@
sendType: "table",
eatModel: [],
favorable: [
// { name: "优惠券", type: "coupon", url: "https://czg-qr-order.oss-cn-beijing.aliyuncs.com/confirmOrder/coupon.png"},
// { name: "团购优惠", type: "group", url: "https://czg-qr-order.oss-cn-beijing.aliyuncs.com/confirmOrder/groupOffer.png"},
// { name: "积分抵扣", type: "points", url: "https://czg-qr-order.oss-cn-beijing.aliyuncs.com/confirmOrder/points.png"},
{ name: "优惠券", type: "coupon",value: "", url: "https://czg-qr-order.oss-cn-beijing.aliyuncs.com/confirmOrder/coupon.png"},
{ name: "商品券", type: "product",value: [], url: "https://czg-qr-order.oss-cn-beijing.aliyuncs.com/confirmOrder/coupon.png"},
// { name: "团购优惠", type: "group",value: "", url: "https://czg-qr-order.oss-cn-beijing.aliyuncs.com/confirmOrder/groupOffer.png"},
{ name: "积分抵扣", type: "points",value: "", url: "https://czg-qr-order.oss-cn-beijing.aliyuncs.com/confirmOrder/points.png" }
],
isPointsChecked: false,
rechargeFreeChecked: false,
calcUsablePointsData: null,
order: {
phone: "",
},
userCouponInfos: [],
selectCouponData: [],
shopTableInfo: null,
freeDingConfig: null,
cartLists: [],
listinfo: {
details: [],
payAmount: 0,
name: "",
},
freeCheck: false,
freeDisabled: false,
totalPrice: 0, // 小计金额
totalAmount: 20, // 支付金额
remark: "", // 备注
radiovalue: 1, // 支付方式
ispws: false, // 输入支付密码
payPasswordShow: false,
amountVIP: null, // 会员信息
amountVIP: uni.cache.get('shopUserInfo'), // 会员信息
listinfoid: null,
paymentBtnText: "余额支付",
isSocket: false,
socketTicket: null,
orderAMeal: true,
shopId: null,
storeInfo: {},
tableCode: null,
packFee: null,
isShow: false,
rechargeFreeChecked: false,
}
},
computed: {
@@ -229,15 +277,16 @@
uni.$off('message')
}
},
onLoad(e) {
console.log(e)
this.storeInfo = JSON.parse(decodeURIComponent(e.storeInfo));
onLoad(options) {
if ( options.storeInfo ) {
this.storeInfo = JSON.parse(decodeURIComponent(options.storeInfo));
}
this.shopId = this.storeInfo.id;
this.cartLists = JSON.parse(options.cartLists);
this.listinfo.name = this.storeInfo.shopName;
this.listinfo.details = JSON.parse(e.cartLists).data;
this.listinfo.payAmount = JSON.parse(e.cartLists).amount;
if ( e.tableCode ) { this.tableCode = e.tableCode;}
this.listinfo.details = JSON.parse(options.cartLists).data;
this.listinfo.payAmount = this.cartLists.memberAmount && this.cartLists.memberAmount > 0 ? this.cartLists.memberAmount : this.cartLists.amount
if ( options.tableCode ) { this.tableCode = options.tableCode;}
if ( this.storeInfo.eatModel.indexOf("dine-in") != -1 ) {
this.eatModel = "dine-in";
this.is_type = 0;
@@ -246,7 +295,7 @@
this.is_type = 1;
}
this.getProductqueryShop();
this.getchoseEatModel();
uni.cache.set('selectCouponData',[])
},
onShow() {
if (this.listinfoid) {
@@ -255,23 +304,280 @@
} else {
this.handlemessage()
}
this.getAount()
this.is_typeList.map((item)=>{
console.log(this.storeInfo.eatModel.indexOf(item.val))
if ( this.storeInfo.eatModel.indexOf(item.val) != -1) {
item.show = true;
}
})
})
this.getAount()
this.getchoseEatModel('index',this.is_type)
},
methods: {
changeFree ( val ) {
console.log(val)
if ( val ) {
this.listinfo.payAmount = this.listinfo.payAmount*2
} else {
this.listinfo.payAmount = this.listinfo.payAmount/2
/**
* 监听优惠券/商品券选择
* @param {Object} data
*/
changeCoupon ( cartLists ) {
// 优惠券数据
let couponList = this.selectCouponData.filter(v => v.type == 1);
// 商品券列表
let productList = this.selectCouponData.filter(v => v.type == 2);
// 优惠券处理
if ( couponList.length > 0 ) {
let couponData = couponList[0]
//不包含优惠券的金额
let currentPayAmount = (this.userCouponInfos.filter(v => v.type == 1).length > 0 ? Number(this.listinfo.payAmount) + couponData.discountAmount : this.listinfo.payAmount)
console.log(this.listinfo.payAmount)
// 判断优惠金额不能大于支付金额
if ( couponData.discountAmount <= currentPayAmount) {
console.log(this.calcUsablePointsData)
// if ( this.isPointsChecked && this.calcUsablePointsData) {
// this.listinfo.payAmount = (Number(this.listinfo.payAmount)-(this.calcUsablePointsData.pointsNum/this.calcUsablePointsData.equivalentPoints)).toFixed(2);
// } else {
// this.listinfo.payAmount = (Number(this.listinfo.payAmount)+(this.calcUsablePointsData.pointsNum/this.calcUsablePointsData.equivalentPoints)).toFixed(2);
// }
console.log(this.listinfo.payAmount)
this.listinfo.payAmount = ( currentPayAmount - couponData.discountAmount).toFixed(2)
this.favorable[0].value = ('-¥'+couponData.discountAmount)
this.userCouponInfos.push({
userCouponId: couponData.id,
type: couponData.type,
discountAmount: couponData.discountAmount,
num: couponData.type == 1 ? 1 : couponData.num,
})
console.log(this.listinfo.payAmount)
} else {
uni.showToast({
title: "优惠券满减金额大于订单金额不可使用",
icon: "none",
})
}
}
console.log(2)
console.log(this.listinfo.payAmount)
// 商品券处理
if ( productList.length > 0 ) {
//商品券使用数量
let payAmount = this.listinfo.payAmount
productList.map((item,index)=>{
// 筛选选中商品券商品列表
let productDetails = this.listinfo.details.filter(v => v.productId == item.proId);
//金额从小到大排序
let minCouponList = productDetails.sort((a, b) => (a.memberPrice > 0 ? a.memberPrice : a.salePrice) - (b.memberPrice > 0 ? b.memberPrice : b.salePrice))
// 商品数量
let productAllNum = 0;
let productNum = 0;
let productPayAmount = 0;
minCouponList.map((v,indexs) => {
productNum = 0;
productPayAmount = 0;
let productDetailsNum = 0;
productDetails.map((v,indexs) => {
productDetailsNum += v.number;
})
for (let i = 0; i < v.number; i++){
if ( productAllNum < productDetailsNum && productNum < item.num && ((v.memberPrice > 0 ? v.memberPrice : v.salePrice) <= (payAmount - productPayAmount) )) {
productNum++
productAllNum++
productPayAmount += v.memberPrice > 0 ? v.memberPrice : v.salePrice
}
}
payAmount = payAmount - productPayAmount
})
if ( productNum > 0 ) {
this.userCouponInfos.push({
userCouponId: item.id,
type: item.type,
productId: item.proId,
discountAmount: productPayAmount,
num: productNum ,
})
this.favorable[1].value.push({
userCouponId: item.id,
name: item.name,
type: item.type,
productId: item.proId,
discountAmount: productPayAmount,
num: productNum,
})
}
})
if ( this.userCouponInfos.length > 0 ) {
console.log(this.userCouponInfos)
this.userCouponInfos.forEach(item => {
// if ( item.type == 1 ) {
// if ( item.discountAmount && item.discountAmount > 0 ) {
// this.listinfo.payAmount = ( this.listinfo.payAmount - item.discountAmount).toFixed(2)
// }
// }
if ( item.type == 2 ) {
if ( item.discountAmount && item.discountAmount > 0 ) {
this.listinfo.payAmount = (this.listinfo.payAmount - item.discountAmount).toFixed(2)
}
}
})
}
}
this.isPointsChecked = false;
this.getCalcUsablePoints()
},
setPayAmount ( cartLists ) {
let tableFee;
// this.storeInfo.registerType == 'munchies'
if ( this.is_type == 0 && this.storeInfo.registerType == 'munchies') {
tableFee = this.shopTableInfo?(this.shopTableInfo.seatNum*this.storeInfo.tableFee):0
} else{
tableFee = 0
}
if ( this.amountVIP.isVip == 1 && cartLists.memberAmount > 0 ) {
this.listinfo.payAmount = (cartLists.memberAmount+tableFee).toFixed(2)
} else {
this.listinfo.payAmount = (Number(cartLists.amount)+tableFee).toFixed(2)
}
console.log(1)
// if ( this.userCouponInfos.length > 0 ) {
// console.log(this.userCouponInfos)
// this.userCouponInfos.forEach(item => {
// if ( item.type == 1 ) {
// if ( item.discountAmount && item.discountAmount > 0 ) {
// this.listinfo.payAmount = ( this.listinfo.payAmount - item.discountAmount).toFixed(2)
// }
// }
// if ( item.type == 2 ) {
// if ( item.discountAmount && item.discountAmount > 0 ) {
// this.listinfo.payAmount = (this.listinfo.payAmount - item.discountAmount).toFixed(2)
// }
// }
// })
// }
this.userCouponInfos = [];
this.favorable[0].value = ""
this.favorable[1].value = []
this.rechargeFreeChecked = false;
this.freeDisabled = false;
this.selectCouponData = uni.cache.get('selectCouponData') || []
this.changeCoupon()
},
/**
* 免单状态监听
* @param {Object} val
*/
changeFree ( val ) {
// this.freeCheck = val;
this.rechargeFreeChecked = !val;
// let couponList = this.userCouponInfos.filter(v => v.type == 1);
let productList = this.userCouponInfos
if ( this.rechargeFreeChecked ) {
if ( this.isPointsChecked ) {
this.isPointsChecked = false;
this.listinfo.payAmount = (Number(this.listinfo.payAmount)+(this.calcUsablePointsData.pointsNum/this.calcUsablePointsData.equivalentPoints)).toFixed(2);
}
if ( productList .length > 0 ) {
productList.map(item=> {
console.log(Number(this.listinfo.payAmount))
console.log(item.discountAmount)
this.listinfo.payAmount = Number(this.listinfo.payAmount) + item.discountAmount
})
}
// if ( couponList.length > 0) {
// this.listinfo.payAmount = Number(this.listinfo.payAmount) + couponList[0].discountAmount
// }
this.listinfo.payAmount = (this.listinfo.payAmount*this.freeDingConfig.rechargeTimes).toFixed(2)
} else {
this.isPointsChecked = false;
this.listinfo.payAmount = (this.listinfo.payAmount/this.freeDingConfig.rechargeTimes).toFixed(2)
// if ( couponList.length > 0) {
// this.listinfo.payAmount = (couponList.length > 0 ? Number(this.listinfo.payAmount) - couponList[0].discountAmount : this.listinfo.payAmount)
// }
if ( productList .length > 0 ) {
productList.map(item=> {
this.listinfo.payAmount = Number(this.listinfo.payAmount) - item.discountAmount
})
}
}
},
/**
* 积分状态监听
*/
pointsChange (){
if ( this.freeCheck || !this.calcUsablePointsData.usable) {
return;
}
this.isPointsChecked = !this.isPointsChecked
if ( this.isPointsChecked ) {
this.freeDisabled = true
this.listinfo.payAmount = (this.listinfo.payAmount-(this.calcUsablePointsData.pointsNum/this.calcUsablePointsData.equivalentPoints)).toFixed(2);
} else {
this.freeDisabled = false
this.listinfo.payAmount = (Number(this.listinfo.payAmount)+(this.calcUsablePointsData.pointsNum/this.calcUsablePointsData.equivalentPoints)).toFixed(2);
}
},
goUrl(item){
switch (item.type){
case 'coupon':
let payAmount = this.listinfo.payAmount;
let couponList = this.userCouponInfos.filter(v => v.type == 1);
if ( couponList.length > 0 ) {
payAmount = payAmount + couponList.discountAmount;
}
uni.pro.navigateTo('/pages/user/coupon', {
type: "confirm_order_coupon",
shopId: this.shopId,
payAmount: payAmount,
shoppingCart: JSON.stringify(this.listinfo.details)
})
break;
case 'product':
let productList = this.userCouponInfos.filter(v => v.type == 2);
uni.pro.navigateTo('/pages/user/coupon', {
type: "confirm_order_product",
shopId: this.shopId,
payAmount: this.listinfo.payAmount,
shoppingCart: JSON.stringify(this.listinfo.details),
productList: JSON.stringify(productList)
})
break;
}
},
/**
* 获取积分相关信息
*/
async getCalcUsablePoints() {
let params = {
memberId: this.amountVIP.id,
orderAmount: this.listinfo.payAmount,
}
let res = await this.api.calcUsablePoints(params)
this.calcUsablePointsData = res.data;
if ( this.calcUsablePointsData && this.calcUsablePointsData.usable && this.listinfo.payAmount >= this.calcUsablePointsData.minPaymentAmount) {
this.calcUsablePointsData.pointsNum = this.calcUsablePointsData.accountPoints >= this.calcUsablePointsData.maxUsablePoints ? this.calcUsablePointsData.maxUsablePoints : this.calcUsablePointsData.accountPoints
}
if ( this.freeDingConfig && this.listinfo.payAmount < this.freeDingConfig.rechargeThreshold ) {
this.freeDisabled = true
}
},
/**
@@ -302,12 +608,22 @@
lat: uni.cache.get('getLocationstorage').lat ? uni.cache.get('getLocationstorage').lat :
'',
}
console.log(this.shopId)
if (this.tableCode) {params.code = this.tableCode}
if (this.shopId) {params.shopId = this.shopId}
let res = await this.api.productqueryShop(params)
if ( res.data.shopTableInfo && !res.data.shopTableInfo.choseCount&&this.orderAMeal) {
this.orderAMeal = false;
uni.pro.navigateTo('/pagesOrder/orderAMeal/index', {
tableCode: this.tableCode,
shopId: res.data.storeInfo.id,
type: 'confirm'
})
return;
}
this.freeDingConfig = res.data.freeDingConfig;
this.shopTableInfo = res.data.shopTableInfo;
this.storeInfo = res.data.storeInfo;
this.getchoseEatModel('index',this.is_type)
},
/**
@@ -361,8 +677,7 @@
this.isSocket = true;
this.listinfoid = msg.data.id
this.listinfo.details = msg.data.detailList;
this.listinfo.payAmount = msg.data.amount;
this.setPayAmount(msg.data)
uni.$off('getMessage')
this.orderorderInfo(1)
}
@@ -374,7 +689,7 @@
this.orderorderInfo()
} else {
this.listinfo.details = msg.data;
this.listinfo.payAmount = msg.amount;
this.setPayAmount(msg)
}
}
@@ -392,7 +707,7 @@
this.orderorderInfo()
} else {
this.listinfo.details = msg.data;
this.listinfo.payAmount = msg.amount;
this.setPayAmount(msg)
}
this.isSocket = true;
break;
@@ -407,26 +722,57 @@
* @param {Object} val
*/
tabClick ( index, item ) {
this.is_type = index;
this.sendType = item.type
this.eatModel = [];
this.eatModel.push(item.val);
this.getchoseEatModel();
this.userCouponInfos = [];
this.favorable[0].value = ""
this.favorable[1].value = []
this.rechargeFreeChecked = false;
this.freeDisabled = false;
this.selectCouponData = [];
uni.cache.set('selectCouponData',[])
this.getchoseEatModel('tabClick', index, item);
},
/**
* 获取堂食/外带菜品数据
*/
async getchoseEatModel () {
async getchoseEatModel ( type , index, item) {
let params = {
shopId: uni.cache.get('shopId'),
type: this.is_type,
type: index,
}
if ( this.eatModel == "dine-in" && this.tableCode ) { params.tableId = this.tableCode; }
if ( index == 0 && this.tableCode ) { params.tableId = this.tableCode; }
if ( this.shopTableInfo && this.shopTableInfo.seatNum ) { params.num = this.shopTableInfo.seatNum; }
let res = await this.api.choseEatModel(params)
if ( type == 'tabClick') {
if ( index == 1 ) {
if ( res.data.info.length > 0) {
this.is_type = index;
this.sendType = item.type
this.eatModel = [];
this.eatModel.push(item.val);
} else {
uni.showToast({
title: "没有可打包商品",
icon: "none",
})
return;
}
} else {
this.is_type = index;
this.sendType = item.type
this.eatModel = [];
this.eatModel.push(item.val);
}
}
this.listinfo = res.data;
this.listinfo.details = res.data.info;
this.listinfo.payAmount = res.data.amount;
this.listinfo.name = this.storeInfo.shopName;
this.listinfo.payAmount = res.data.memberAmount && res.data.memberAmount > 0 ? res.data.memberAmount : res.data.amount
this.packFee = res.data.packFee;
this.setPayAmount(this.listinfo)
},
/**
@@ -532,15 +878,21 @@
})
return;
}
let res = await this.api.creatOrder({
let params = {
"tableId": this.tableCode , //桌台码
"shopId": uni.cache.get('shopId'),
"userId": uni.cache.get('userInfo').id,
"sendType": this.sendType,
"remark": this.remark,
})
console.log(res)
}
if ( this.isPointsChecked && this.calcUsablePointsData.pointsNum && this.calcUsablePointsData.pointsNum > 0) {
params.pointsNum = this.calcUsablePointsData.pointsNum;
}
if ( this.userCouponInfos ) {
params.userCouponInfos = this.userCouponInfos
}
let res = await this.api.creatOrder(params)
this.listinfoid = res.data.id;
if ( this.storeInfo.registerType == 'restaurant') {
uni.redirectTo({
@@ -598,17 +950,36 @@
* 微信/支付宝支付
*/
async showpopupclickdds() {
let res;
if ( !this.rechargeFreeChecked ) {
res = await this.api.orderPay({
orderId: this.listinfoid,
// #ifdef MP-WEIXIN
payType: 'wechatPay',
// #endif
// #ifdef MP-ALIPAY
payType: 'aliPay',
// #endif
// payType: this.radiovalue == 2 ? 'wechatPay' : 'aliPay'
}) //判断是否支付成功
} else {
res = await this.api.paymemeberIn({
shopId: uni.cache.get('shopId'),
amount: this.listinfo.payAmount,
orderId: this.listinfoid,
// #ifdef MP-WEIXIN
payType: 'wechatPay',
// #endif
// #ifdef MP-ALIPAY
payType: 'aliPay',
// #endif
// payType: this.radiovalue == 2 ? 'wechatPay' : 'aliPay'
}) //判断是否支付成功
}
let res = await this.api.orderPay({
orderId: this.listinfoid,
// #ifdef MP-WEIXIN
payType: 'wechatPay',
// #endif
// #ifdef MP-ALIPAY
payType: 'aliPay',
// #endif
// payType: this.radiovalue == 2 ? 'wechatPay' : 'aliPay'
}) //判断是否支付成功
if (res.code == 0) {
// 微信支付还是余额支付
@@ -1098,7 +1469,9 @@
justify-content: space-between;
padding: 0 30rpx;
box-sizing: border-box;
margin-bottom: 32rpx;
padding-bottom: 26rpx;
padding-top: 26rpx;
border-bottom: 2rpx solid #E5E5E5;
.favorable_left{
display: flex;
align-items: center;
@@ -1123,6 +1496,36 @@
}
}
.favorable_right{
>.column{
display: flex;
flex-direction: column;
align-items: flex-end;
.favorable_right_text{
margin-bottom: 10rpx;
text:nth-child(1){
font-size: 26rpx;
color: #999;
}
text:nth-child(2){
font-size: 26rpx;
color: #999;
margin: 0 30rpx;
}
text:nth-child(3){
font-size: 26rpx;
color: #333;
}
}
}
}
.favorable_right.column{
align-items: flex-start;
}
}
.favorable.column{
align-items: flex-start;
}
.cell-item{
display: flex;
@@ -1151,11 +1554,13 @@
color: #333333;
}
}
}
.totalPrice{
padding: 32rpx 30rpx;
box-sizing: border-box;
border-top: 2rpx solid #E5E5E5;
// border-top: 2rpx solid #E5E5E5;
display: flex;
justify-content: flex-end;
align-items: flex-end;

View File

@@ -36,11 +36,13 @@
numIndex: 0,
otherNum: '其他',
dinersNum: 1,
type: ""
};
},
onLoad(options) {
this.tableCode = options.tableCode;
this.shopId = options.shopId;
if ( options.type ) { this.type = options.type}
},
onShow() {
},
@@ -90,10 +92,15 @@
shopId: this.shopId,
}) //判断是否支付成功
if ( res.code == 0) {
uni.pro.redirectTo('order_food/order_food', {
// uni.pro.navigateTo('order_food/order_food', {
tableCode: this.tableCode,
})
if( this.type == 'confirm') {
uni.pro,navigateBack()
} else {
uni.pro.redirectTo('order_food/order_food', {
// uni.pro.navigateTo('order_food/order_food', {
tableCode: this.tableCode,
})
}
}
}

View File

@@ -27,13 +27,31 @@
</view>
<!-- 先下单后支付 -->
<orderInfoAfter ref="orderInfoAfter" :listinfo="listinfo" v-if="listinfo.useType == 'dine-in-after'"></orderInfoAfter>
<orderInfoAfter ref="orderInfoAfterRef" :amountVIP="amountVIP" :rechargeFreeChecked="rechargeFreeChecked" :freeCheck="freeCheck" :listinfo="listinfo" @setPayAmount="setPayAmount" v-if="listinfo.useType == 'dine-in-after'"></orderInfoAfter>
<!-- 先支付后下单 -->
<orderInfoBefore ref="orderInfoBefore" :listinfo="listinfo" v-else></orderInfoBefore>
<!-- 积分兑换订单详情 -->
<!-- <orderInfoPoints ref="orderInfoPoints" :listinfo="listinfo" ></orderInfoPoints> -->
<!-- 充值免单 -->
<block v-if="listinfo.useType == 'dine-in-after'">
<rechargeFree
:rechargeFreeChecked="rechargeFreeChecked"
v-if="listinfo.freeDingConfig&&listinfo.freeDingConfig.enable == 1&&(listinfo.status == 'unpaid' || listinfo.status == 'paying')"
ref="rechargeFree"
:freeDisabled="freeDisabled"
:payAmount="listinfo.payAmount"
:freeDingConfig="listinfo.freeDingConfig" :shopUserInfo="amountVIP" @changeFree="changeFree"></rechargeFree>
</block>
<block v-else>
<rechargeFree
:rechargeFreeChecked="rechargeFreeChecked"
v-if="listinfo.freeDingConfig&&listinfo.freeDingConfig.enable == 1&&(!listinfo.orderInfo.couponInfoList&&listinfo.orderInfo.pointsDiscountAmount<=0)&&(listinfo.status == 'unpaid' || listinfo.status == 'paying')"
ref="rechargeFree"
:freeDisabled="freeDisabled"
:payAmount="listinfo.payAmount"
:freeDingConfig="listinfo.freeDingConfig" :shopUserInfo="amountVIP" @changeFree="changeFree"></rechargeFree>
</block>
<paymentMethod ref="paymentMethod" v-if="amountVIP&&listinfo.status == 'unpaid' || listinfo.status == 'paying'" :amountVIP="amountVIP" @groupChange="groupChange"></paymentMethod>
<paymentMethod ref="paymentMethod" :rechargeFreeChecked="rechargeFreeChecked" v-if="amountVIP&&listinfo.status == 'unpaid' || listinfo.status == 'paying'" :freeCheck="freeCheck" :payAmount="listinfo.payAmount" :amountVIP="amountVIP" @groupChange="groupChange"></paymentMethod>
<view class="fixedview">
<view class="flex-between" v-if="listinfo.status == 'unpaid' || listinfo.status == 'paying'">
@@ -48,11 +66,11 @@
</view>
</view>
</view>
<u-popup :show="ispws" :round="20" mode="bottom" @close="ispws = false" height="500" :safeAreaInsetBottom="false">
<view style="width: 100%;height: 200rpx;"> </view>
<u-popup :show="ispws" :round="20" mode="bottom" @close="payClose" height="500" :safeAreaInsetBottom="false">
<view class="pay-info-wrap">
<view class="info-wrap flex-between">
<view class="close" @click="ispws = false">
<view class="close" @click="payClose">
<u-icon name="close" color="#999999" size="40"></u-icon>
</view>
<text class="title">请输入支付密码</text>
@@ -71,14 +89,14 @@
import payPasswordtwo from '@/components/payPasswordtwo.vue'
import orderInfoAfter from '../components/orderInfoAfter.vue'
import orderInfoBefore from '../components/orderInfoBefore.vue'
import orderInfoPoints from '../components/orderInfoPoints.vue'
import rechargeFree from '../components/rechargeFree.vue'
import paymentMethod from '../components/paymentMethod.vue'
export default {
components: {
payPasswordtwo,
orderInfoAfter,
orderInfoBefore,
orderInfoPoints,
rechargeFree,
paymentMethod,
},
data() {
@@ -92,15 +110,37 @@
listinfoid: null,
status: [],
amountVIP: null,
srcimge: 'https://czg-qr-order.oss-cn-beijing.aliyuncs.com/wx.jpg'
couopnInfo: null,
freeDisabled: false,
freeCheck: false,
rechargeFreeChecked: false,
srcimge: 'https://czg-qr-order.oss-cn-beijing.aliyuncs.com/wx.jpg',
};
},
onLoad(e) {
console.log(e)
this.orderId = e.orderId
this.orderorderInfo()
},
mounted() {
if ( this.listinfo.useType == "dine-in-after") {
console.log(this.$refs.orderInfoAfterRef)
this.$nextTick(()=>{
this.$refs.orderInfoAfterRef.childOnShow();
})
}
},
onShow() {
this.orderorderInfo()
console.log("this.listinfo==",this.listinfo)
if ( this.listinfo.useType == "dine-in-after") {
console.log(this.$refs.orderInfoAfterRef)
this.$nextTick(()=>{
this.$refs.orderInfoAfterRef.childOnShow();
})
}
if ( this.listinfo ) {
this.getAount();
}
},
onUnload() {
this.ispws = false
@@ -115,6 +155,65 @@
console.log(e)
},
methods: {
setPayAmount(data) {
console.log(data)
this.listinfo.payAmount = data.payAmount
this.couopnInfo = data;
this.freeDisabled = data.freeDisabled
this.freeCheck = data.freeCheck
if ( this.listinfo.freeDingConfig && this.listinfo.payAmount < this.listinfo.freeDingConfig.rechargeThreshold ) {
this.freeDisabled = true
} else {
this.freeDisabled = false
}
},
/**
* 免单状态监听
* @param {Object} val
*/
changeFree ( val ) {
// this.freeCheck = val;
this.rechargeFreeChecked = !val
if ( this.rechargeFreeChecked ) {
if ( this.couopnInfo) {
if ( this.couopnInfo.isPointsChecked ) {
this.listinfo.payAmount = (Number(this.listinfo.payAmount)+(this.couopnInfo.calcUsablePointsData.pointsNum/this.couopnInfo.calcUsablePointsData.equivalentPoints)).toFixed(2);
}
let couponList = this.couopnInfo.userCouponInfos.filter(v => v.type == 1);
if ( couponList.length > 0) {
this.listinfo.payAmount = (couponList.length > 0 ? Number(this.listinfo.payAmount) + couponList[0].discountAmount : this.listinfo.payAmount)
}
let productList = this.couopnInfo.userCouponInfos.filter(v => v.type == 2);
if ( productList .length > 0 ) {
productList.map(item=> {
this.listinfo.payAmount = Number(this.listinfo.payAmount) + item.discountAmount
})
}
}
this.listinfo.payAmount = (this.listinfo.payAmount*this.listinfo.freeDingConfig.rechargeTimes).toFixed(2)
} else {
this.listinfo.payAmount = (this.listinfo.payAmount/this.listinfo.freeDingConfig.rechargeTimes).toFixed(2)
if ( this.couopnInfo) {
this.couopnInfo.isPointsChecked = false;
let couponList = this.couopnInfo.userCouponInfos.filter(v => v.type == 1);
if ( couponList.length > 0) {
this.listinfo.payAmount = (couponList.length > 0 ? Number(this.listinfo.payAmount) - couponList[0].discountAmount : this.listinfo.payAmount)
}
let productList = this.couopnInfo.userCouponInfos.filter(v => v.type == 2);
if ( productList .length > 0 ) {
productList.map(item=> {
this.listinfo.payAmount = Number(this.listinfo.payAmount) - item.discountAmount
})
}
}
}
},
saveImage (url) {
uni.saveImage({
url: url,
@@ -131,7 +230,7 @@
*/
async getAount() {
let res = await this.api.shopUserInfo({
"shopId": this.shopId,
"shopId": this.listinfo.shopId,
"userId": uni.cache.get('userInfo').id,
})
if (res.code == 0) {
@@ -153,13 +252,29 @@
})
if (res.code == 0) {
this.listinfo = res.data;
if ( this.listinfo.orderInfo.couponInfoList ) {
this.listinfo.orderInfo.couponInfoList = JSON.parse(this.listinfo.orderInfo.couponInfoList)
}
this.listinfoid = res.data.orderId;
this.shopId = res.data.shopId;
if (this.listinfo.useType == " ") {
//堂食先付费
}
if ( this.listinfo.freeDingConfig && this.listinfo.payAmount < this.listinfo.freeDingConfig.rechargeThreshold ) {
this.freeDisabled = true
}
console.log(this.listinfo)
if ( this.listinfo.useType == "dine-in-after") {
console.log(this.$refs.orderInfoAfterRef)
this.$nextTick(()=>{
this.$refs.orderInfoAfterRef.childOnShow();
})
}
this.getAount();
}
},
/**
@@ -167,18 +282,14 @@
*/
goRecharge() {
uni.pro.navigateTo('/pages/member/index', {
shopId: this.shopId
shopId: this.listinfo.shopId
})
},
/**
* 去支付
*/
goToPay(){
async goToPay(){
if ( (this.radiovalue == 2 || this.radiovalue == 3) && this.listinfo.payAmount <= 0 ) {
uni.showToast({
title: "支付金额必须大于0",
@@ -186,6 +297,18 @@
})
return;
}
if ( this.couopnInfo ) {
let params = {
shopId: this.listinfo.shopId,
orderId: this.listinfo.orderId,
userCouponInfos: this.couopnInfo.userCouponInfos,
}
if ( this.couopnInfo.isPointsChecked && this.couopnInfo.calcUsablePointsData.pointsNum && this.couopnInfo.calcUsablePointsData.pointsNum > 0) {
params.pointsNum = this.couopnInfo.calcUsablePointsData.pointsNum;
}
let res = await this.api.useCoupon(params)
}
if (this.radiovalue == 2 || this.radiovalue == 3) {
this.wechatPay() //微信支付
} else {
@@ -210,13 +333,29 @@
}
},
/**
* 取消支付
*/
payClose () {
this.ispws = false;
console.log(2)
uni.showToast({
icon: 'none',
title: '取消支付'
})
setTimeout(res => {
uni.switchTab({
url: '/pages/order/order'
});
}, 500)
},
/**
* 余额支付
* @param {Object} pwd
*/
async accountPayevent(pwd) {
this.ispws = false;
console.log(pwd)
let res = await this.api.accountPay({
orderId: this.listinfoid,
memberId: this.amountVIP.id,
@@ -230,7 +369,6 @@
if (res.data == 1) {
uni.showToast({ title: "支付成功",icon:'none'})
let _this = this
uni.requestSubscribeMessage({
tmplIds:["z0fUG7-jhSfYCrw6poOvSRzh4_hgnPkm_5C7E5s5bCQ","AV-KybUHaK3KtFVLqpy6PHccHBS7XeX__mOM4RbufnQ"],
complete() {
@@ -239,7 +377,6 @@
});
},
})
} else if (res.data == 2) {
uni.showToast({ title: "余额不足",icon:'none'})
setTimeout(() => {
@@ -270,15 +407,34 @@
* 微信支付
*/
async wechatPay() {
let res = await this.api.orderPay({
orderId: this.orderId,
// #ifdef MP-WEIXIN
payType: 'wechatPay',
// #endif
// #ifdef MP-ALIPAY
payType: 'aliPay',
// #endif
}) //判断是否支付成功
let res;
console.log(this.rechargeFreeChecked)
if ( !this.rechargeFreeChecked ) {
res = await this.api.orderPay({
orderId: this.orderId,
// #ifdef MP-WEIXIN
payType: 'wechatPay',
// #endif
// #ifdef MP-ALIPAY
payType: 'aliPay',
// #endif
// payType: this.radiovalue == 2 ? 'wechatPay' : 'aliPay'
}) //判断是否支付成功
} else {
console.log(this.listinfo.payAmount)
res = await this.api.paymemeberIn({
shopId: this.listinfo.shopId,
amount: this.listinfo.payAmount,
orderId: this.orderId,
// #ifdef MP-WEIXIN
payType: 'wechatPay',
// #endif
// #ifdef MP-ALIPAY
payType: 'aliPay',
// #endif
// payType: this.radiovalue == 2 ? 'wechatPay' : 'aliPay'
}) //判断是否支付成功
}
if (res.code == 0) {
uni.showLoading({
title: '加载中',
@@ -308,7 +464,7 @@
tmplIds: ['z0fUG7-jhSfYCrw6poOvSRzh4_hgnPkm_5C7E5s5bCQ'],
complete() {
this.paymodfiyOrderInfo()
_this.paymodfiyOrderInfo()
setTimeout(res => {
uni.hideLoading()
uni.switchTab({

View File

@@ -0,0 +1,132 @@
<template>
<view class="container">
<view class="list">
<view class="listItem " v-for="(item,index) in list" :key="index">
<view class="top">
<view class="title">{{item.content}}</view>
<view class="num" :class="{colorStyle: item.floatType=='add'}">{{item.floatType == 'add' ? '+' : ''}}{{item.floatPoints}}</view>
</view>
<view class="time">{{item.createTime}}</view>
</view>
</view>
<image
v-if="list.length <= 0 "
style="width: 402rpx;height: 442rpx;margin:240rpx auto 32rpx;" src="https://czg-qr-order.oss-cn-beijing.aliyuncs.com/nomore.png"
mode="aspectFill"
/>
<u-loadmore :status="status" fontSize="28" color="#999" iconSize="28" style="margin-top: 32rpx;"/>
</view>
</template>
<script>
export default {
data() {
return {
query: {
page: 1,
size: 10,
},
list: [],
shopId: null,
shopUserInfo: uni.cache.get('shopUserInfo'),
status: "nomore" // loadmore nomore loading
};
},
onLoad(options) {
if ( options.shopId ) {
this.shopId = options.shopId;
}
},
onShow() {
this.getMemberPointsLogList()
},
onReachBottom() {
this.getMemberPointsLogList()
},
methods: {
/**
* 获取积分明细列表
*/
async getMemberPointsLogList() {
let res = await this.api.memberPointsLogList({
shopId: this.shopId,
memberId: this.shopUserInfo.id,
...this.query
})
if ( res.code == 0) {
if (res.data.pages < this.query.page) {
this.status = 'nomore'
if (this.query.page == 1 && res.data.list.length == 0) {
this.list = []
this.is_end = true
}
return false;
} else {
this.status = 'loading';
if (this.query.page == 1) {
this.list = res.data.list
} else {
this.list = [...this.list, ...res.data.list];
}
this.query.page = ++this.query.page;
if (this.query.page > res.data.pages) {
this.status = 'nomore';
} else {
this.status = 'loading';
}
}
}
}
}
};
</script>
<style scoped lang="scss">
.container{
padding: 16rpx 0;
}
.list{
background: #FFFFFF;
border-radius: 0rpx 0rpx 0rpx 0rpx;
.listItem{
display: flex;
flex-direction: column;
padding: 32rpx 20rpx;
border-bottom: 1rpx solid #E5E5E5;
.top{
display: flex;
justify-content: space-between;
align-items: center;
font-weight: bold;
color: #333333;
.title{
font-size: 28rpx;
}
.num{
font-size: 32rpx;
}
.colorStyle {
color: #FF7127;
}
}
.time{
font-weight: normal;
font-size: 28rpx;
color: #999999;
margin-top: 16rpx;
}
}
.listItem:last-child{
border-bottom: none;
}
}
</style>

View File

@@ -0,0 +1,349 @@
<template>
<view class="container">
<view class="head_bg"></view>
<view class="shopInfo" v-if="goodsData.goodsCategory == 'physical'">
<view class="type">自取门店</view>
<view class="info">
<view class="shopName">{{shopUserInfo.shopName}}</view>
<view class="shopTel">{{shopUserInfo.telephone}}</view>
</view>
<view class="address">
<view style="width: 70%;">{{shopUserInfo.address}}</view>
<u-icon name="arrow-right" color="#595959" size="28"></u-icon>
</view>
</view>
<view class="orderInfo">
<view class="goods">
<image class="icon" :src="goodsData.goodsImageUrl" mode="aspectFill" />
<view class="info">
<view class="title">{{goodsData.goodsName}}</view>
<view class="numAll">
<view class="points">{{goodsData.requiredPoints}}积分</view>
<view class="num">X1</view>
</view>
</view>
</view>
<view class="cell">
<view class="label">使用积分</view>
<view class="value">{{goodsData.requiredPoints}}积分</view>
</view>
<view class="cell">
<view class="label"></view>
<view class="value">合计{{goodsData.extraPrice}}</view>
</view>
</view>
<view class="bom">
<view class="exchangeBtn" @click="pointsCreateOrder">确认兑换</view>
</view>
</view>
</template>
<script>
export default {
data() {
return {
query: {
page: 1,
size: 10,
},
shopId: null,
goodsData: null,
orderInfo: null,
shopUserInfo: uni.cache.get('shopUserInfo'),
};
},
onLoad(options) {
if ( options.shopId ) {
this.shopId = options.shopId;
}
if ( options.goodsData ) {
this.goodsData = JSON.parse(options.goodsData);
}
},
onShow() {
this.getExchangeRecordList();
},
onReachBottom() {
this.getExchangeRecordList()
},
methods: {
/**
* 获取兑换记录
*/
async getExchangeRecordList() {
let res = await this.api.exchangeRecordList({
shopId: this.shopId,
memberId: this.shopUserInfo.id,
...this.query
})
if ( res.code == 0) {
if (res.data.pages < this.query.page) {
this.status = 'nomore'
if (this.query.page == 1 && res.data.list.length == 0) {
this.list = []
this.is_end = true
}
return false;
} else {
this.status = 'loading';
if (this.query.page == 1) {
this.list = res.data.list
} else {
this.list = [...this.list, ...res.data.list];
}
this.query.page = ++this.query.page;
if (this.query.page > res.data.pages) {
this.status = 'nomore';
} else {
this.status = 'loading';
}
}
}
},
/**
* 确认兑换
*/
confirmExchange () {
if ( this.goodsData.extraPrice > 0 ) {
} else {
this.pointsCreateOrder()
}
},
/**
* 微信/支付宝支付
*/
async pointsPayOrder(orderInfo) {
let payType;
if ( this.goodsData.extraPrice > 0 ) {
// #ifdef MP-WEIXIN
payType = 'WECHAT';
// #endif
// #ifdef MP-ALIPAY
payType = 'ALIPAY';
// #endif
} else {
payType = 'POINTS'
}
let res = await this.api.pointsPayOrder({
id: orderInfo.id,
payType: payType,
openId: uni.cache.get('miniAppOpenId'),
}) //判断是否支付成功
if (res.code == 0) {
this.orderInfo = res.data;
let payInfo = JSON.parse(res.data.payInfo);
if ( payType == 'POINTS') {
uni.navigateTo({
url: `/pagesPoints/exchangeRecordDetail/index?shopId=${this.shopId}&orderInfo=${JSON.stringify(this.orderInfo)}`,
})
return;
}
// 微信支付还是余额支付
uni.requestPayment({
// #ifdef MP-WEIXIN
provider: 'wxpay', //支付类型-固定值
partnerid: payInfo.appId, // 微信支付商户号
timeStamp: payInfo.timeStamp, // 时间戳(单位:秒)
nonceStr: payInfo.nonceStr, // 随机字符串
package: payInfo.package, // 固定值
signType: payInfo.signType, //固定值
paySign: payInfo.paySign, //签名
// #endif
// #ifdef MP-ALIPAY
provider: 'alipay', //支付类型-固定值
orderInfo: res.data.tradeNo, // 微信支付商户号
// #endif
success: (res) => {
let _this = this
uni.showToast({
title: "支付成功"
})
uni.navigateTo({
url: `/pagesPoints/exchangeRecordDetail/index?shopId=${this.shopId}&orderInfo=${JSON.stringify(this.orderInfo)}`,
})
},
fail: async (err) => {
console.log(err)
let res = await this.api.pointsCancelOrder({
id: orderInfo.id,
}) //判断是否支付成功
uni.hideLoading()
}
});
}
},
/**
* 支付完成后请求
*/
async paymodfiyOrderInfo() {
let res = await this.api.paymodfiyOrderInfo({
orderId: this.listinfoid,
})
},
/**
* 生成兑换兑换
*/
async pointsCreateOrder () {
if (this.orderInfo) {
this.pointsPayOrder(this.orderInfo);
return;
}
let res = await this.api.pointsCreateOrder({
shopId: this.shopId,
pointsGoodsId: this.goodsData.id,
pickupMethod: "self",
memberId: this.shopUserInfo.id,
avatarUrl: this.shopUserInfo.headImg,
memberName: this.shopUserInfo.name,
mobile: this.shopUserInfo.telephone,
})
if (res.code == 0) {
this.orderInfo = res.data;
this.pointsPayOrder(res.data);
}
},
}
};
</script>
<style scoped lang="scss">
.container{
padding: 32rpx 20rpx;
.head_bg{
height: 256rpx;
background: linear-gradient(180deg, #E9B183 0%, #F5F5F500 100%);
position: absolute;
left: 0;
right: 0;
top: 0;
margin: auto;
}
.orderInfo,.shopInfo{
display: flex;
flex-direction: column;
background-color: #fff;
border-radius: 18rpx;
position: relative;
z-index: 2;
}
.shopInfo{
padding: 32rpx 24rpx 32rpx 24rpx;
font-weight: 400;
font-size: 24rpx;
color: #666666;
margin-bottom: 32rpx;
.type{
font-weight: bold;
font-size: 32rpx;
color: #333333;
}
.info{
display: flex;
align-items: center;
margin-top: 24rpx;
margin-bottom: 16rpx;
.shopName{
margin-right: 10rpx;
}
}
.address{
display: flex;
align-items: flex-start;
justify-content: space-between;
}
}
.orderInfo{
padding: 32rpx 24rpx 8rpx 24rpx;
.goods{
display: flex;
margin-bottom: 16rpx;
.icon{
width: 128rpx;
height: 128rpx;
border-radius: 10rpx;
margin-right: 16rpx;
flex-shrink: 0;
}
.info{
width: 100%;
display: flex;
flex-direction: column;
.title{
font-weight: bold;
font-size: 28rpx;
color: #333333;
margin-top: 5rpx;
}
.numAll{
display: flex;
align-items: center;
justify-content: space-between;
font-weight: 500;
font-size: 24rpx;
margin-top: 32rpx;
.points{
color: #666;
}
.num{
color: #999;
}
}
}
}
.cell{
display: flex;
align-items: center;
justify-content: space-between;
border-top: 1rpx solid #E5E5E5;
padding: 24rpx 0;
.label{
font-weight: bold;
font-size: 28rpx;
color: #333333;
}
.value{
font-weight: bold;
font-size: 28rpx;
color: #333333;
}
}
}
.bom{
width: 100%;
position: fixed;
bottom: 0;
left: 0;
z-index: 9;
padding: 16rpx 28rpx 68rpx 28rpx;
display: flex;
justify-content: flex-end;
background-color: #fff;
.exchangeBtn{
width: 214rpx;
height: 64rpx;
line-height: 64rpx;
text-align: center;
background: #E8AD7B;
border-radius: 34rpx 34rpx 34rpx 34rpx;
font-weight: bold;
font-size: 32rpx;
color: #FFFFFF;
}
}
}
</style>

View File

@@ -0,0 +1,199 @@
<template>
<view class="container">
<view class="list">
<view class="listItem " v-for="(item,index) in list" :key="index">
<view class="head">
<view class="time">兑换时间{{item.createTime}}</view>
<!-- unpaid-待支付 waiting-待自取 done-已完成 cancel-已取消 -->
<view class="status">{{
item.status == 'unpaid' ? '待支付' :
item.status == 'waiting' ? '待自取' :
item.status == 'done' ? '已完成' :
item.status == 'cancel' ? '已取消' : ""
}}</view>
</view>
<view class="content">
<image class="thumbnail" :src="item.goodsImageUrl" mode="aspectFill" />
<view class="info">
<view class="title">{{item.pointsGoodsName}}</view>
<view class="numAll">
<view class="points">{{item.spendPoints}}积分</view>
<view class="num">X1</view>
</view>
</view>
</view>
<view class="bom">
<view class="detail" @click="goDetail(item)">查看详情</view>
</view>
</view>
</view>
<image
v-if="list.length <= 0 "
style="width: 402rpx;height: 442rpx;margin:240rpx auto 32rpx;" src="https://czg-qr-order.oss-cn-beijing.aliyuncs.com/nomore.png"
mode="aspectFill"
/>
<u-loadmore :status="status" fontSize="28" color="#999" iconSize="28" />
</view>
</template>
<script>
export default {
data() {
return {
query: {
page: 1,
size: 10,
},
list: [],
shopId: null,
shopUserInfo: uni.cache.get('shopUserInfo'),
status: "nomore" // loadmore nomore loading
};
},
onLoad(options) {
if ( options.shopId ) {
this.shopId = options.shopId;
}
},
onShow() {
this.getExchangeRecordList();
},
onReachBottom() {
this.getExchangeRecordList()
},
methods: {
/**
* 获取兑换记录
*/
async getExchangeRecordList() {
let res = await this.api.exchangeRecordList({
shopId: this.shopId,
memberId: this.shopUserInfo.id,
...this.query
})
if ( res.code == 0) {
if (res.data.pages < this.query.page) {
this.status = 'nomore'
if (this.query.page == 1 && res.data.list.length == 0) {
this.list = []
this.is_end = true
}
return false;
} else {
this.status = 'loading';
if (this.query.page == 1) {
this.list = res.data.list
} else {
this.list = [...this.list, ...res.data.list];
}
this.query.page = ++this.query.page;
if (this.query.page > res.data.pages) {
this.status = 'nomore';
} else {
this.status = 'loading';
}
}
}
},
/**
* 查看详情
*/
goDetail(item) {
uni.navigateTo({
url: `/pagesPoints/exchangeRecordDetail/index?shopId=${this.shopId}&orderInfo=${JSON.stringify(item)}`,
})
}
}
};
</script>
<style scoped lang="scss">
.container{
}
.list{
// background: #FFFFFF;
// border-radius: 0rpx 0rpx 0rpx 0rpx;
padding: 32rpx 20rpx;
.listItem{
display: flex;
flex-direction: column;
padding: 32rpx 24rpx;
border-bottom: 1rpx solid #E5E5E5;
margin-bottom: 32rpx;
.head{
display: flex;
align-items: center;
justify-content: space-between;
.time{
font-weight: 400;
font-size: 24rpx;
color: #666666;
}
.status{
font-weight: 500;
font-size: 28rpx;
color: #333333;
}
}
.content{
display: flex;
margin-top: 32rpx;
.thumbnail{
width: 128rpx;
height: 128rpx;
border-radius: 10rpx;
margin-right: 16rpx;
flex-shrink: 0;
}
.info{
width: 100%;
display: flex;
flex-direction: column;
.title{
font-weight: bold;
font-size: 28rpx;
color: #333333;
margin-top: 5rpx;
}
.numAll{
display: flex;
align-items: center;
justify-content: space-between;
font-weight: 500;
font-size: 24rpx;
margin-top: 32rpx;
.points{
color: #666;
}
.num{
color: #999;
}
}
}
}
.bom{
display: flex;
justify-content: flex-end;
margin-top: 32rpx;
.detail{
padding: 8rpx 16rpx;
background-color: #343030;
border-radius: 10rpx 10rpx 10rpx 10rpx;
font-weight: 400;
font-size: 24rpx;
color: #FFFFFF;
}
}
}
}
</style>

View File

@@ -1,5 +1,5 @@
<template>
<view>
<view class="container">
<view class="card_box">
<view class="card_head_box">
<view class="card_head_item" v-for="(item,index) in 8" :key="index"></view>
@@ -7,13 +7,15 @@
<view class="card">
<!-- 订单头部 -->
<view class="top">
<view class="title">
<image class="icon" src="https://czg-qr-order.oss-cn-beijing.aliyuncs.com/points/icon_order.png" mode="aspectFill" />
<view>自提凭证</view>
</view>
</view>
<view class="card_item">
<view class="card_item" v-if="orderInfo.status == 'waiting'">
<view>
<view class="code">提货码241578956432</view>
<view class="code">提货码{{orderInfo.couponCode}}</view>
<tki-qrcode ref="tkiQrcode" show :size="qrcodeSize"></tki-qrcode>
</view>
@@ -22,42 +24,59 @@
<view class="semicircle_right_icon"></view>
</view>
</view>
<view class="card_item status" v-else>
<view class="status_left">
<view class="status_title">
{{
orderInfo.status == 'unpaid' ? '待支付' :
orderInfo.status == 'waiting' ? '待自取' :
orderInfo.status == 'done' ? '已使用' :
orderInfo.status == 'cancel' ? '已取消' : ""
}}
</view>
<view class="status_code" v-if="orderInfo.status == 'done'">{{orderInfo.couponCode}}</view>
</view>
<view class="status_qrcode" >
<image class="qrcode" src="https://czg-qr-order.oss-cn-beijing.aliyuncs.com/points/qrcode.png" mode="aspectFill" />
<image class="status" src="https://czg-qr-order.oss-cn-beijing.aliyuncs.com/points/status.png" mode="aspectFill" />
</view>
</view>
<view class="total-wrap">
<view class="info">
<u-icon name="map" color="#666" size="28"></u-icon>
<view class="shopName">自取店{{ listinfo.name }}</view>
<u-icon name="phone" color="#666" size="28"></u-icon>
<view class="phone">15303589754</view>
<view class="shopName">自取店{{ shopUserInfo.shopName }}</view>
<!-- <u-icon name="phone" color="#666" size="28"></u-icon> -->
<view class="phone">{{shopUserInfo.telephone}}</view>
</view>
<view class="address">
<view class="lable">门店地址</view>
<view>门店地址门店地址门店地址门店地址门店地址门店地址门店地址门店地址</view>
<view>{{shopUserInfo.address}}</view>
</view>
</view>
</view>
</view>
<view class="product">
<view></view>
<image class="thumbnail" :src="orderInfo.goodsImageUrl" mode="aspectFill" />
<view class="product_info">
<view class="name">DIMO联名马克杯</view>
<view class="numBox"><view class="points">100积分</view><view class="num">X1</view></view>
<view class="name">{{orderInfo.pointsGoodsName}}</view>
<view class="numBox"><view class="points">{{orderInfo.spendPoints}}积分</view><view class="num">X1</view></view>
</view>
<!-- <view class="productInfo"></view> -->
</view>
<view class="orderInfo">
<view class="row">
<text class="t">支付方式</text>
<text class="info">{{listinfo.name}}</text>
<text class="info">{{orderInfo.payMethod}}</text>
</view>
<view class="row">
<text class="t">兑换时间</text>
<text class="info">{{$u.timeFormat(listinfo.time, 'yyyy-mm-dd hh:MM:ss')}}</text>
<text class="info">{{orderInfo.createTime}}</text>
</view>
<view class="row" @click="copyHandle(listinfo.orderNo)">
<view class="row" @click="copyHandle(orderInfo.orderNo)">
<text class="t">订单编号</text>
<text class="info">{{listinfo.orderNo}}点击复制</text>
<text class="info">{{orderInfo.orderNo}}</text>
</view>
</view>
</view>
@@ -71,12 +90,16 @@
data() {
return {
qrcodeSize: 200,
shopId: null,
orderInfo: null,
shopUserInfo: uni.cache.get('shopUserInfo'),
}
},
props:{
listinfo:{
type: Object
onLoad(options) {
console.log(JSON.parse(options.orderInfo))
if ( options.shopId ) {
this.shopId = options.shopId;
this.orderInfo = JSON.parse(options.orderInfo);
}
},
mounted() {
@@ -85,7 +108,7 @@
methods: {
setQrcode () {
this.$refs.tkiQrcode.setval('241578956432') //
this.$refs.tkiQrcode.setval(this.orderInfo.couponCode) //
},
/**
@@ -110,13 +133,14 @@
</script>
<style lang="scss">
.container{
padding: 32rpx 20rpx;
}
.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;
padding-bottom: 32rpx;
.card_head_box{
@@ -151,6 +175,13 @@
border-bottom: 2rpx dashed #E3E3E3;
padding-bottom: 36rpx;
padding-top: 50rpx;
display: flex;
align-items: center;
.icon{
width: 25.45rpx;
height: 28.53rpx;
margin-right: 16rpx;
}
}
.card_item{
display: flex;
@@ -196,6 +227,46 @@
}
}
}
.card_item.status{
display: flex;
flex-direction: row;
justify-content: space-between;
.status_left{
display: flex;
flex-direction: column;
justify-content: space-between;
.status_title{
font-weight: bold;
font-size: 32rpx;
color: #333333;
margin-bottom: 24rpx;
}
.status_code{
text-decoration:line-through;
font-weight: bold;
font-size: 32rpx;
color: #999999;
}
}
.status_qrcode{
width: 112rpx;
height: 112rpx;
position: relative;
.qrcode{
width: 112rpx;
height: 112rpx;
}
.status{
width: 54.82rpx;
height: 48rpx;
position: absolute;
bottom: 0;
right: 0;
}
}
}
@@ -215,8 +286,9 @@
font-size: 24rpx;
color: #333333;
.shopName{
margin-right: 48rpx;
margin-right: 5rpx;
margin-left: 16rpx;
}
.phone{
margin-left: 16rpx;
@@ -230,7 +302,7 @@
font-size: 24rpx;
color: #666666;
margin-top: 24rpx;
align-self: center;
align-self: flex-start;
.lable{
flex-shrink: 0;
}
@@ -243,15 +315,25 @@
padding: 32rpx 34rpx;
background-color: #FFFFFF;
margin-top: 32rpx;
border-radius: 18rpx;
display: flex;
.thumbnail{
width: 152rpx;
height: 152rpx;
border-radius: 10rpx;
margin-right: 16rpx;
flex-shrink: 0;
}
.product_info{
width: 100%;
display: flex;
flex-direction: column;
margin-left: 16rpx;
margin-top: 15rpx;
.name{
font-weight: bold;
font-size: 24rpx;
color: #333333;
margin-bottom: 24rpx;
margin-bottom: 32rpx;
}
.numBox{
display: flex;

View File

@@ -0,0 +1,118 @@
<template>
<view class="container">
<view class="top">
<image class="goodsImageUrl" :src="goodsData.goodsImageUrl" mode="aspectFill"/>
<view class="title">{{goodsData.goodsName}}</view>
<view class="pointsNum">{{goodsData.requiredPoints}}<view class="f"> 积分</view></view>
</view>
<view class="h"></view>
<view class="bom">
<view class="title">商品详情</view>
<view class="goodsDescription">{{goodsData.goodsDescription}}</view>
</view>
<view class="btn" @click="exchange">立即兑换</view>
</view>
</template>
<script>
export default {
data() {
return {
goodsData: null,
shopUserInfo: uni.cache.get('shopUserInfo'),
shopId: null,
};
},
onLoad(options) {
if ( options.shopId ) {
this.shopId = options.shopId;
this.goodsData = JSON.parse(options.goodsData);
}
},
onShow() {
},
methods: {
/**
* 立即兑换
*/
exchange () {
uni.navigateTo({
url: `/pagesPoints/confirm_order/index?shopId=${this.shopId}&goodsData=${JSON.stringify(this.goodsData)}`,
})
},
}
};
</script>
<style>
page {
background-color: #fff!important;
}
</style>
<style scoped lang="scss">
.top{
display: flex;
flex-direction: column;
background-color: #fff;
padding-bottom: 32rpx;
.goodsImageUrl{
width: 100%;
height: 530rpx;
}
.title{
font-weight: bold;
font-size: 32rpx;
color: #1A1A1A;
padding: 32rpx 20rpx;
}
.pointsNum{
font-weight: bold;
font-size: 32rpx;
color: #333333;
display: flex;
align-items: flex-end;
padding: 0 20rpx;
.f{
font-weight: normal;
font-size: 24rpx;
}
}
}
.h{
width: 100%;
height: 14rpx;
background-color: #f9f9f9;
}
.bom{
padding: 32rpx 20rpx;
background-color: #fff;
.title{
font-weight: bold;
font-size: 32rpx;
color: #1A1A1A;
}
.goodsDescription{
font-weight: 400;
font-size: 28rpx;
color: #1A1A1A;
margin-top: 32rpx;
}
}
.btn{
width: 556rpx;
height: 84rpx;
line-height: 84rpx;
text-align: center;
background: #E8AD7B;
border-radius: 49rpx 49rpx 49rpx 49rpx;
font-weight: bold;
font-size: 32rpx;
color: #FFFFFF;
position: fixed;
bottom: 68rpx;
left: 0;
right: 0;
margin: auto;
}
</style>

349
pagesPoints/index/index.vue Normal file
View File

@@ -0,0 +1,349 @@
<template>
<view class="container">
<view class="head_bg"></view>
<view class="info">
<view class="info_content">
<image class="img" src="https://czg-qr-order.oss-cn-beijing.aliyuncs.com/points/points_img1.png" mode="aspectFill"/>
<view class="tips">可用积分</view>
<view class="pnintsNum">{{pointsInfo.accountPoints}}</view>
<view class="bottom">
<view @click="tapClick(item)" v-for="(item,index) in tap" :key="index">
<image class="icon" :src="item.iconUrl" mode="aspectFill" />
<view>{{item.name}}</view>
</view>
</view>
</view>
</view>
<view class="list"
:class="{
column: shopSettingInfo.browseMode == 'list',
row: shopSettingInfo.browseMode == 'grid'
}"
>
<view class="listItem"
:class="{
row: shopSettingInfo.browseMode == 'list',
column: shopSettingInfo.browseMode == 'grid'
}"
v-for="(item,index) in list" :key="index"
@click="goDetail(item)"
>
<image class="img" :src="item.goodsImageUrl" mode="aspectFill"/>
<view class="itemInfo">
<view class="title">{{item.goodsName}}</view>
<view class="remainingNum" v-if="shopSettingInfo.browseMode == 'list'">剩余{{item.quantity}}</view>
<view class="bottom">
<view class="pointsNum">{{item.requiredPoints}}<view class="f">积分</view></view>
<view class="btn" @click.stop="exchange(item)" v-if="shopSettingInfo.browseMode == 'list'">立即兑换</view>
</view>
</view>
</view>
</view>
</view>
</template>
<script>
export default {
data() {
return {
tap: [
{name: '积分明细', pageUrl: "/pagesPoints/IntegralDetail/index", iconUrl: "https://czg-qr-order.oss-cn-beijing.aliyuncs.com/points/icon_detail.png"},
{name: '兑换记录', pageUrl: "/pagesPoints/exchangeRecord/index", iconUrl: "https://czg-qr-order.oss-cn-beijing.aliyuncs.com/points/icon_record.png"}
],
query: {
page: 1,
size: 10,
},
list: [],
shopSettingInfo: null,
pointsInfo: null,
shopUserInfo: null,
shopId: null,
};
},
onLoad(options) {
if ( options.shopId ) {
this.shopId = options.shopId;
}
},
onShow() {
this.getShopSettingInfo()
this.getShopInfo()
this.getointsGoodsList()
},
methods: {
/**
* 获取会员信息
*/
async getShopInfo() {
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',this.shopUserInfo)
this.getmemberPointsInfo(this.shopUserInfo.id)
}
},
/**
* 获取店铺设置
*/
async getShopSettingInfo() {
let res = await this.api.shopSettingInfo(this.shopId)
if (res.code == 0) {
this.shopSettingInfo = res.data;
}
},
/**
* 获取会员积分
*/
async getmemberPointsInfo (memberId) {
let res = await this.api.memberPointsInfo(memberId)
if (res.code == 0) {
this.pointsInfo = res.data;
}
},
/**
* 获取积分商品列表
*/
async getointsGoodsList() {
let res = await this.api.pointsGoodsList({
shopId: this.shopId,
...this.query
})
if ( res.code == 0) {
if (res.data.pages < this.query.page) {
this.status = 'nomore'
if (this.query.page == 1 && res.data.list.length == 0) {
this.list = []
// this.is_end = true
}
return false;
} else {
this.status = 'loading';
if (this.query.page == 1) {
this.list = res.data.list
} else {
this.list = [...this.list, ...res.data.list];
}
this.query.page = ++this.query.page;
if (this.query.page > res.data.pages) {
this.status = 'nomore';
} else {
this.status = 'loading';
}
}
}
},
/**
* 跳转详情
* @param {Object} item
*/
goDetail (item) {
uni.navigateTo({
url: `/pagesPoints/goodsDetail/index?shopId=${this.shopId}&goodsData=${JSON.stringify(item)}`,
})
},
/**
* 积分明细兑换记录跳转
*/
tapClick (item) {
uni.pro.navigateTo(item.pageUrl, {
shopId: this.shopId,
})
},
/**
* 立即兑换
*/
async exchange (item) {
uni.navigateTo({
url: `/pagesPoints/confirm_order/index?shopId=${this.shopId}&goodsData=${JSON.stringify(item)}`,
})
}
}
};
</script>
<style scoped lang="scss">
page {
// background: #f6f6f6;
}
.head_bg{
height: 256rpx;
background: linear-gradient(180deg, #E9B183 0%, #F5F5F500 100%);
position: absolute;
left: 0;
right: 0;
top: 0;
margin: auto;
}
.info{
padding: 32rpx 20rpx;
position: relative;
z-index: 2;
.info_content{
background: #FFFFFF;
box-shadow: 0rpx 6rpx 8rpx 2rpx rgba(0,0,0,0.09);
border-radius: 24rpx 24rpx 24rpx 24rpx;
padding: 32rpx;
display: flex;
flex-direction: column;
position: relative;
.img{
width: 152rpx;
height: 186rpx;
position: absolute;
top: 0;
right: 0;
}
.tips{
font-weight: 500;
font-size: 24rpx;
color: #666666;
margin-bottom: 32rpx;
}
.pnintsNum{
font-weight: bold;
font-size: 60rpx;
color: #333333;
}
.bottom{
font-weight: 400;
font-size: 26rpx;
color: #333333;
display: flex;
align-items: center;
justify-content: space-around;
border-top: 1rpx solid #E5E5E5;
padding-top: 24rpx;
margin-top: 24rpx;
position: relative;
z-index: 9;
>view{
width: 50%;
display: flex;
align-items: center;
justify-content: center;
.icon{
width: 30rpx;
height: 30rpx;
margin-right: 4rpx;
}
}
>view:nth-child(1){
border-right: 1rpx solid #E5E5E5
}
}
}
}
.list{
padding: 0 20rpx 0 20rpx;
position: relative;
z-index: 2;
display: flex;
flex-wrap: wrap;
.listItem{
display: flex;
background: #FFFFFF;
border-radius: 18rpx 18rpx 18rpx 18rpx;
padding: 32rpx 16rpx;
margin-bottom: 32rpx;
.img{
flex-shrink: 0;
border-radius: 10rpx;
}
.itemInfo{
width: 100%;
display: flex;
flex-direction: column;
.title{
font-weight: bold;
font-size: 28rpx;
color: #333333;
margin-top: 10rpx;
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
}
.remainingNum{
font-weight: 400;
font-size: 24rpx;
color: #999999;
margin-top: 20rpx;
}
.bottom{
display: flex;
align-items: center;
justify-content: space-between;
margin-top: 20rpx;
}
.pointsNum{
font-weight: bold;
font-size: 32rpx;
color: #333333;
display: flex;
align-items: flex-end;
.f{
font-weight: normal;
font-size: 24rpx;
}
}
.btn{
width: 180rpx;
height: 56rpx;
line-height: 56rpx;
text-align: center;
background: #E8AD7B;
border-radius: 34rpx 34rpx 34rpx 34rpx;
font-weight: bold;
font-size: 28rpx;
color: #FFFFFF;
}
}
}
.listItem.row{
width: 100%;
.img{
width: 160rpx;
height: 160rpx;
margin-right: 16rpx;
}
}
.listItem.column{
width: 45%;
.img{
width: 100%;
height: 224rpx;
}
.title{
margin-top: 16rpx;
margin-bottom: 10rpx;
}
}
}
.row{
flex-direction: row;
justify-content: space-between;
}
.column{
flex-direction: column;
}
</style>