优惠卷和商品卷
This commit is contained in:
@@ -4,6 +4,46 @@
|
||||
<view class="card_head_box">
|
||||
<view class="card_head_item" v-for="(item,index) in 8" :key="index"></view>
|
||||
</view>
|
||||
|
||||
<!-- 先付款 -->
|
||||
<view class="tabBox">
|
||||
<view class="tab">
|
||||
<view v-for="(item,index) in tebtypeList" :key="index"
|
||||
:class="is_type==index?'tab_item'+(is_type+1)+' tab_item active ':'tab_item'"
|
||||
@click="tabClick(item,index)">
|
||||
<view></view>
|
||||
<image class="icon" :src="is_type==index?item.url_active:item.url" mode="aspectFill" />
|
||||
<text class="title" :class="{active:is_type==index}">{{item.title}}</text>
|
||||
</view>
|
||||
</view>
|
||||
<view class="table" v-if=" is_type == 0 ">
|
||||
<view class="table_left">
|
||||
<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="listinfo.tableName"> {{ listinfo.tableName || '' }} </view>
|
||||
</view>
|
||||
<!-- <view class="pack" v-else>
|
||||
<view class="top">
|
||||
<text class="title">{{ shopInfo.shopName }}</text>
|
||||
<text class="address">{{ shopInfo.address }}</text>
|
||||
</view>
|
||||
<view class="list">
|
||||
<view class="item">
|
||||
<view class="lable">取餐时间</view>
|
||||
<view class="text">立即取餐</view>
|
||||
</view>
|
||||
<view class="item">
|
||||
<view class="lable">预留电话</view>
|
||||
<view class="getPhone text"><u-input class="inputVal" v-model="order.phone"
|
||||
input-align="right" placeholder="请输入预留电话以便联系您"></u-input><text
|
||||
class="getBtn">获取手机号</text></view>
|
||||
</view>
|
||||
</view>
|
||||
</view> -->
|
||||
</view>
|
||||
<view class="card">
|
||||
<!-- 订单头部 -->
|
||||
<view class="card_item" v-for="(value, key) in listinfo.detailMap" :key="key">
|
||||
@@ -29,58 +69,84 @@
|
||||
</view>
|
||||
|
||||
<view class="price">
|
||||
<view class="priceAmount">¥{{item.priceAmount}}</view>
|
||||
<view class="priceAmount">
|
||||
¥{{orderVIP.isVip ==1 && ordershopUserInfo.isMemberPrice==1?item.memberPrice:item.price}}
|
||||
</view>
|
||||
<view class="num">x{{item.num}}</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<view class="status" v-if="listinfo.status == 'unpaid' || listinfo.status == 'paying'">未付款</view>
|
||||
<view class="totalAmount">
|
||||
<!--<view class="status" v-if="listinfo.status == 'unpaid' || listinfo.status == 'paying'">未付款</view>
|
||||
<view class="totalAmount">
|
||||
<view class="label">小计¥</view>
|
||||
<view class="price"> {{item.totalAmount}} </view>
|
||||
</view>
|
||||
</view> -->
|
||||
|
||||
<view class="semicircle_icon" v-if="index > 0">
|
||||
<view class="semicircle_left_icon"></view>
|
||||
<view class="semicircle_right_icon"></view>
|
||||
</view>
|
||||
</view>
|
||||
<view class="cell-item" v-if="listinfo.seatCount > 0">
|
||||
<view class="label">餐位费</view>
|
||||
|
||||
<view class="cell-item" v-if="is_type != 0">
|
||||
<view class="label">打包费</view>
|
||||
<view class="val">
|
||||
<view>X{{listinfo.seatCount}}</view>
|
||||
<view></view>
|
||||
<view style="font-size: 28rpx;">¥</view>
|
||||
<view>{{listinfo.seatAmount}}</view>
|
||||
<view>{{listinfo.packFee}}</view>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
|
||||
<!-- isTableFee == 0是不免除 -->
|
||||
<view class="cell-item"
|
||||
v-if="ordershopUserInfo.isTableFee == 0 && is_type == 0 && listinfo.Seatcharge != 0">
|
||||
<view class="label">餐位费</view>
|
||||
<view class="val">
|
||||
<view>X{{listinfo.Seatcharge}}</view>
|
||||
<view style="font-size: 28rpx;">¥</view>
|
||||
<view>{{listinfo.Seatcharge}}</view>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<!-- <view class="cell-item" v-else>
|
||||
<view class="label">免餐位费</view>
|
||||
<view class="val">
|
||||
<view></view>
|
||||
<view style="font-size: 28rpx;">¥</view>
|
||||
<view>{{listinfo.Seatcharge}}</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 v-for="(item,indexe) in favorablelist" :key="indexe">
|
||||
<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>
|
||||
<up-icon name="arrow-right" color="#575B66" size="16"
|
||||
v-if="listinfo.status == 'unpaid' || listinfo.status == 'paying'"></up-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 class="favorable_right" :class="{column:item.value}" v-if="item.type=='product'">
|
||||
<view :class="{column:item.value}">
|
||||
<view class="favorable_right_text" v-if="item.value.uniqueIds">
|
||||
<text>{{item.value.uniqueIds}}个</text>
|
||||
<text>-¥{{item.value.Productroll}}</text>
|
||||
</view>
|
||||
</view>
|
||||
<up-icon name="arrow-right" color="#575B66" size="16"
|
||||
style="margin-top: 5rpx;"></up-icon>
|
||||
</view>
|
||||
|
||||
<!-- 优惠卷 -->
|
||||
<view class="favorable_right" v-if="item.type=='coupon'">
|
||||
<text class="favorable_right_text">{{item.value.name}}</text>
|
||||
<up-icon name="arrow-right" color="#575B66" size="16"
|
||||
v-if="listinfo.status == 'unpaid' || listinfo.status == 'paying'"></up-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">
|
||||
@@ -95,16 +161,15 @@
|
||||
<up-checkbox-group iconPlacement="right" @change="pointsChange">
|
||||
<up-checkbox v-model="isPointsChecked"
|
||||
:disabled="freeCheck||!calcUsablePointsData.usable" :checked="isPointsChecked"
|
||||
activeColor="#E8AD7B" shape="circle" icon-size="36" size="36">
|
||||
activeColor="#E8AD7B" shape="circle" icon-size="18" size="18">
|
||||
</up-checkbox>
|
||||
</up-checkbox-group>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
</view>
|
||||
</block>
|
||||
<block v-else>
|
||||
<block v-for="(item,index) in listinfo.couponInfoList.fullReductionCoupon" :key="index">
|
||||
<block v-for="(item,index) in listinfo.couponInfoList" :key="index">
|
||||
<view class="cell-item" v-if="item.type == 1">
|
||||
<view class="label">优惠券</view>
|
||||
<view class="val">
|
||||
@@ -114,11 +179,10 @@
|
||||
</view>
|
||||
</view>
|
||||
</block>
|
||||
<view class="cell-item column" v-if="listinfo.couponInfoList.productCoupon.length > 0">
|
||||
<view class="cell-item column" v-if="listinfo.couponInfoList.length > 0">
|
||||
<view class="label">商品券</view>
|
||||
<view class="val column">
|
||||
<view class="productCoupon" v-for="(item,index) in listinfo.couponInfoList.productCoupon"
|
||||
:key="index">
|
||||
<view class="productCoupon" v-for="(item,index) in listinfo.couponInfoList" :key="index">
|
||||
<view class="name">{{item.name}}</view>
|
||||
<view class="num">X{{item.finalUseNum}}</view>
|
||||
<view class="amount">-¥{{item.finalDiscountAmount}}</view>
|
||||
@@ -138,7 +202,7 @@
|
||||
|
||||
<view class="total-wrap">
|
||||
<view>总计¥</view>
|
||||
<view class="price"> {{listinfo.payAmount}} </view>
|
||||
<view class="price"> {{listinfo.totalCost}} </view>
|
||||
</view>
|
||||
|
||||
</view>
|
||||
@@ -146,30 +210,30 @@
|
||||
<view class="orderInfo">
|
||||
<view class="row" @click="copyHandle(listinfo.orderNo)">
|
||||
<text class="t">订单编号:</text>
|
||||
<text class="info">{{listinfo.orderNo}}(点击复制)</text>
|
||||
<text class="info"
|
||||
style="overflow:hidden;text-overflow:ellipsis;white-space:nowrap;">{{listinfo.orderNo}}(点击复制)</text>
|
||||
</view>
|
||||
<view class="row">
|
||||
<text class="t">下单时间:</text>
|
||||
<text class="info">{{$u.timeFormat(listinfo.time, 'yyyy-mm-dd hh:MM:ss')}}</text>
|
||||
<text class="info">{{$u.timeFormat(listinfo.updateTime, 'yyyy-mm-dd hh:MM:ss')}}</text>
|
||||
</view>
|
||||
<view class="row">
|
||||
<!-- <view class="row">
|
||||
<text class="t">下单门店:</text>
|
||||
<text class="info">{{listinfo.name}}</text>
|
||||
</view> -->
|
||||
<view class="row" v-if="listinfo.dineMod">
|
||||
<text class="t">用餐模式:</text>
|
||||
<text class="info" v-if="listinfo.dineMod == 'dine-in'">堂食</text>
|
||||
<text class="info" v-if="listinfo.dineMod == 'take-out'">外带</text>
|
||||
<text class="info" v-if="listinfo.dineMod == 'take-away'">外卖</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">
|
||||
<view class="row" v-if="listinfo.remark">
|
||||
<text class="t">备注:</text>
|
||||
<text class="info">{{ listinfo.remark || ""}}</text>
|
||||
</view>
|
||||
<view class="row">
|
||||
<view class="row" v-if="listinfo.seatNum">
|
||||
<text class="t">就餐人数:</text>
|
||||
<text class="info">{{ listinfo.seatCount || ""}}</text>
|
||||
<text class="info">{{ listinfo.seatNum || ""}}</text>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
@@ -184,9 +248,13 @@
|
||||
computed,
|
||||
defineEmits,
|
||||
watch,
|
||||
watchEffect
|
||||
watchEffect,
|
||||
defineExpose
|
||||
} from 'vue'
|
||||
|
||||
// 定义自定义事件
|
||||
const emits = defineEmits(['customevent', 'istype']);
|
||||
|
||||
// teb 切换送餐和打包
|
||||
const tebtypeList = reactive([{
|
||||
title: "送餐到桌",
|
||||
@@ -206,17 +274,16 @@
|
||||
},
|
||||
])
|
||||
|
||||
const favorable = reactive([{
|
||||
name: "优惠券",
|
||||
type: "coupon",
|
||||
value: "",
|
||||
url: "https://czg-qr-order.oss-cn-beijing.aliyuncs.com/confirmOrder/coupon.png"
|
||||
},
|
||||
{
|
||||
const favorablelist = reactive([{
|
||||
name: "商品券",
|
||||
type: "product",
|
||||
value: [],
|
||||
url: "https://czg-qr-order.oss-cn-beijing.aliyuncs.com/confirmOrder/coupon.png"
|
||||
}, {
|
||||
name: "优惠券",
|
||||
type: "coupon",
|
||||
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"},
|
||||
{
|
||||
@@ -227,267 +294,90 @@
|
||||
}
|
||||
])
|
||||
|
||||
|
||||
const props = defineProps({
|
||||
rechargeFreeChecked: {
|
||||
type: Boolean
|
||||
},
|
||||
freeCheck: {
|
||||
type: Boolean
|
||||
},
|
||||
|
||||
listinfo: {
|
||||
type: Object
|
||||
|
||||
},
|
||||
amountVIP: {
|
||||
orderVIP: {
|
||||
type: Object
|
||||
},
|
||||
})
|
||||
|
||||
const data = reactive({
|
||||
calcUsablePointsData: null,
|
||||
isShow: false,
|
||||
payAmount: 0,
|
||||
isPointsChecked: false,
|
||||
userCouponInfos: [],
|
||||
selectCouponData: [],
|
||||
})
|
||||
|
||||
|
||||
const childOnShow = () => {
|
||||
console.log('isShow==', this.isShow)
|
||||
if (!this.isShow) {
|
||||
this.getCalcUsablePoints()
|
||||
return;
|
||||
ordershopUserInfo: {
|
||||
type: Object,
|
||||
default: {
|
||||
isTableFee: 0
|
||||
}
|
||||
}
|
||||
// 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();
|
||||
})
|
||||
|
||||
const calcUsablePointsData = reactive({
|
||||
usable: '',
|
||||
pointsNum: '',
|
||||
equivalentPoints: '',
|
||||
unusableReason: '',
|
||||
|
||||
})
|
||||
const isPointsChecked = ref(false)
|
||||
|
||||
const is_type = ref(0)
|
||||
// 监听送餐/打包切换
|
||||
const tabClick = (item, index) => {
|
||||
is_type.value = index
|
||||
emits("istype", is_type.value)
|
||||
// this.getchoseEatModel('tabClick', index, item);
|
||||
}
|
||||
|
||||
// 操作优惠卷
|
||||
const dataprocessing = (data) => {
|
||||
if (data.typeOrder == 1) {
|
||||
favorablelist[1].value = data.item
|
||||
} else {
|
||||
favorablelist[0].value = data
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
const childOnShow = () => {}
|
||||
|
||||
// * 监听优惠券/商品券选择
|
||||
const 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) {
|
||||
const changeCoupon = (data) => {}
|
||||
|
||||
// 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()
|
||||
}
|
||||
|
||||
const 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,
|
||||
})
|
||||
}
|
||||
const setPayAmount = (cartLists) => {}
|
||||
|
||||
// * 积分状态监听
|
||||
const 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,
|
||||
})
|
||||
}
|
||||
const pointsChange = () => {}
|
||||
|
||||
// 跳转
|
||||
const 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.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.id,
|
||||
couopnInfo: JSON.stringify(couopnInfo),
|
||||
payAmount: this.listinfo.payAmount,
|
||||
shoppingCart: JSON.stringify(this.listinfo.details),
|
||||
productList: JSON.stringify(productList)
|
||||
})
|
||||
break;
|
||||
}
|
||||
switch (item.type) {
|
||||
case 'coupon':
|
||||
uni.pro.navigateTo('/pages/order/coupon', {
|
||||
type: "confirm_order_coupon",
|
||||
shopId: uni.cache.get('orderVIP').shopId,
|
||||
shopUserId: props.orderVIP.id,
|
||||
payAmount: props.listinfo.totalCost,
|
||||
shoppingCart: JSON.stringify(props.listinfo.combinedArray)
|
||||
})
|
||||
break;
|
||||
case 'product':
|
||||
uni.pro.navigateTo('/pages/order/coupon', {
|
||||
type: "confirm_order_product",
|
||||
shopId: uni.cache.get('orderVIP').shopId,
|
||||
shopUserId: props.orderVIP.id,
|
||||
payAmount: props.listinfo.totalCost,
|
||||
shoppingCart: JSON.stringify(props.listinfo.combinedArray)
|
||||
})
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// * 获取积分相关信息
|
||||
const getCalcUsablePoints = async () => {
|
||||
let params = {
|
||||
memberId: this.listinfo.memberId,
|
||||
}
|
||||
if (this.listinfo.pointsDiscountAmount) {
|
||||
params.orderAmount = this.listinfo.payAmount + this.listinfo.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
|
||||
}
|
||||
}
|
||||
const getCalcUsablePoints = async () => {}
|
||||
|
||||
// * 复制订单号
|
||||
const copyHandle = (e) => {
|
||||
@@ -501,9 +391,14 @@
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
// 将方法暴露给父组件
|
||||
defineExpose({
|
||||
dataprocessing
|
||||
});
|
||||
</script>
|
||||
|
||||
<style lang="scss">
|
||||
<style lang="scss" scoped>
|
||||
.card_box {
|
||||
background-color: #fff;
|
||||
// box-shadow: 0rpx 8rpx 12rpx 2rpx rgba(87,86,86,0.35);
|
||||
@@ -514,6 +409,201 @@
|
||||
border-radius: 18rpx;
|
||||
padding-bottom: 32rpx;
|
||||
|
||||
.tabBox {
|
||||
width: 100%;
|
||||
margin-top: 52rpx;
|
||||
position: relative;
|
||||
z-index: 1;
|
||||
|
||||
.tab {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
border-radius: 22rpx 22rpx 0 0;
|
||||
// background-color: $uni-bg-color;
|
||||
|
||||
.tab_item {
|
||||
width: 50%;
|
||||
height: 90rpx;
|
||||
line-height: 90rpx;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
padding-left: 30rpx;
|
||||
box-sizing: border-box;
|
||||
background-color: #FEFBF8;
|
||||
border-radius: 22rpx 22rpx 0 0;
|
||||
position: relative;
|
||||
|
||||
.title {
|
||||
font-weight: 500;
|
||||
font-size: 28rpx;
|
||||
color: #999999;
|
||||
position: relative;
|
||||
z-index: 1;
|
||||
}
|
||||
|
||||
.title.active {
|
||||
color: #E8AD7B;
|
||||
}
|
||||
|
||||
.icon {
|
||||
width: 48rpx;
|
||||
height: 48rpx;
|
||||
margin-right: 16rpx;
|
||||
position: relative;
|
||||
z-index: 1;
|
||||
}
|
||||
}
|
||||
|
||||
.tab_item.active {
|
||||
background-color: #fff;
|
||||
}
|
||||
|
||||
// .tab_item.active:after {
|
||||
// content: "";
|
||||
// position: absolute;
|
||||
// top: 0;
|
||||
// left: -4px;
|
||||
// width: 40px;
|
||||
// height: 26px;
|
||||
// background: orange;
|
||||
// }
|
||||
.tab_item.active:before {
|
||||
content: "";
|
||||
position: absolute;
|
||||
top: -20rpx;
|
||||
left: 0;
|
||||
right: 0;
|
||||
bottom: 0;
|
||||
border-radius: 2px;
|
||||
background: #fff;
|
||||
transform: skewX(0deg);
|
||||
}
|
||||
|
||||
.tab_item1.active:before {
|
||||
border-radius: 22rpx 40rpx 0 0;
|
||||
}
|
||||
|
||||
.tab_item2.active:before {
|
||||
border-radius: 40rpx 22rpx 0 0;
|
||||
}
|
||||
}
|
||||
|
||||
.table {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
padding: 0 30rpx;
|
||||
box-sizing: border-box;
|
||||
height: 90rpx;
|
||||
background-color: $uni-bg-color;
|
||||
border-radius: 0 0 22rpx 22rpx;
|
||||
|
||||
.table_left {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
|
||||
.icon {
|
||||
width: 32.86rpx;
|
||||
height: 39.07rpx;
|
||||
margin-right: 24rpx;
|
||||
}
|
||||
|
||||
.title {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
color: #E8AD7B;
|
||||
}
|
||||
}
|
||||
|
||||
.value {
|
||||
font-weight: 500;
|
||||
font-size: 32rpx;
|
||||
color: #333333;
|
||||
}
|
||||
}
|
||||
|
||||
.pack {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
padding: 30rpx;
|
||||
box-sizing: border-box;
|
||||
background-color: $uni-bg-color;
|
||||
border-radius: 0 0 22rpx 22rpx;
|
||||
|
||||
.top {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
margin-top: 8rpx;
|
||||
|
||||
.title {
|
||||
font-size: 28rpx;
|
||||
color: #333;
|
||||
font-weight: bold;
|
||||
margin-bottom: 16rpx;
|
||||
}
|
||||
|
||||
.address {
|
||||
font-size: 24rpx;
|
||||
font-weight: 400;
|
||||
color: #999;
|
||||
}
|
||||
}
|
||||
|
||||
.list {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
|
||||
.item {
|
||||
height: 70rpx;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
font-size: 28rpx;
|
||||
|
||||
.lable {
|
||||
color: #666;
|
||||
font-weight: 500;
|
||||
}
|
||||
|
||||
.getPhone {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
|
||||
.u-input {
|
||||
width: 340rpx;
|
||||
border: none;
|
||||
|
||||
input {
|
||||
font-size: 24rpx;
|
||||
color: #333;
|
||||
|
||||
}
|
||||
|
||||
.input-placeholder {
|
||||
font-size: 24rpx;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.text,
|
||||
.getBtn {
|
||||
color: #E8AD7B;
|
||||
}
|
||||
|
||||
.getBtn {
|
||||
border-radius: 12rpx;
|
||||
border: 2rpx solid #E8AD7B;
|
||||
padding: 8rpx 20rpx;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
.card_head_box {
|
||||
width: 100%;
|
||||
display: flex;
|
||||
|
||||
@@ -1,223 +0,0 @@
|
||||
<template>
|
||||
<!-- 支付方式 -->
|
||||
<view class="paymentMethod">
|
||||
<view class="paymentMethod_content">
|
||||
<view class="paymentMethod_title">支付方式</view>
|
||||
<u-radio-group v-model="radiovalue" iconPlacement="right" @change="groupChange" :size="28"
|
||||
placement="column">
|
||||
<block v-for="(item,index) in paymentMethodList" :key="index">
|
||||
<view class="method_list" @click="groupChange(item.type)">
|
||||
<view class="method_list_top">
|
||||
<view class="method_list_top_left">
|
||||
<image class="icon" :src="item.url" mode="aspectFill"/>
|
||||
<view class="method_list_top_cen">
|
||||
<view class="name"> {{ item.name }} </view>
|
||||
<view class="method_list_bom" v-if="item.type == 1">
|
||||
<text class="balance">会员卡余额 ¥{{amountVIP?amountVIP.amount:0}}</text>
|
||||
<text class="topUpNow" @click="goRecharge">去充值</text>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<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>
|
||||
|
||||
</view>
|
||||
</block>
|
||||
</u-radio-group>
|
||||
</view>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
export default {
|
||||
|
||||
|
||||
data() {
|
||||
return {
|
||||
paymentMethodList:[
|
||||
{ name: "余额支付", type: 1, url: "https://czg-qr-order.oss-cn-beijing.aliyuncs.com/drder/wechat.png"},
|
||||
// #ifdef MP-WEIXIN
|
||||
{ name: "微信支付", type: 2, url: "https://czg-qr-order.oss-cn-beijing.aliyuncs.com/confirmOrder/weChat.png"},
|
||||
// #endif
|
||||
// #ifdef MP-ALIPAY
|
||||
{ name: "支付宝支付", type: 3, url: "https://czg-qr-order.oss-cn-beijing.aliyuncs.com/confirmOrder/alipay.png"},
|
||||
// #endif
|
||||
],
|
||||
paymentMethodName:[
|
||||
{ name: "余额支付", type: 1, url: "https://czg-qr-order.oss-cn-beijing.aliyuncs.com/drder/wechat.png"},
|
||||
{ name: "微信支付", type: 2, url: "https://czg-qr-order.oss-cn-beijing.aliyuncs.com/confirmOrder/weChat.png"},
|
||||
{ name: "支付宝支付", type: 3, url: "https://czg-qr-order.oss-cn-beijing.aliyuncs.com/confirmOrder/alipay.png"},
|
||||
],
|
||||
radiovalue: 1, // 支付方式
|
||||
ispws: false, // 输入支付密码
|
||||
storeInfo: {},
|
||||
}
|
||||
},
|
||||
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)
|
||||
// this.getAount();
|
||||
|
||||
},
|
||||
methods: {
|
||||
/**
|
||||
* 监听支付方式切换
|
||||
* @param {Object}
|
||||
*/
|
||||
groupChange(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 })
|
||||
},
|
||||
|
||||
|
||||
/**
|
||||
* 去充值
|
||||
*/
|
||||
goRecharge() {
|
||||
uni.pro.navigateTo('/pages/member/index', {
|
||||
shopId: uni.cache.get('shopId')
|
||||
})
|
||||
},
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="scss">
|
||||
.paymentMethod{
|
||||
box-sizing: border-box;
|
||||
margin-top: 30rpx;
|
||||
border-radius: 18rpx;
|
||||
.paymentMethod_content{
|
||||
background-color: #fff;
|
||||
border-radius: 22rpx;
|
||||
padding:30rpx 30rpx 0 30rpx;
|
||||
box-sizing: border-box;
|
||||
.paymentMethod_title{
|
||||
font-weight: 500;
|
||||
font-size: 32rpx;
|
||||
color: #333333;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
.method_list{
|
||||
padding: 40rpx 0;
|
||||
box-sizing: border-box;
|
||||
.method_list_top{
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
.method_list_top_left{
|
||||
display: flex;
|
||||
align-items: center;
|
||||
.icon{
|
||||
width: 54.67rpx!important;
|
||||
height: 48rpx!important;
|
||||
margin-right: 22rpx;
|
||||
}
|
||||
.name{
|
||||
font-size: 32rpx;
|
||||
font-weight: 500;
|
||||
color: #333;
|
||||
}
|
||||
.method_list_top_cen{
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
.method_list_bom{
|
||||
display: flex;
|
||||
align-items: center;
|
||||
.balance{
|
||||
margin-right: 20rpx;
|
||||
font-size: 24rpx;
|
||||
}
|
||||
.topUpNow{
|
||||
color: #FF803D;
|
||||
font-size: 28rpx;
|
||||
}
|
||||
}
|
||||
}
|
||||
.method_list:nth-child(odd){
|
||||
border-bottom: 2rpx solid #e5e5e5;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
</style>
|
||||
Reference in New Issue
Block a user