You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
1127 lines
35 KiB
1127 lines
35 KiB
<template>
|
|
<view>
|
|
<!-- <view class="width100 height120 headsbg backcorfff fotct">
|
|
<view class="height20"></view>
|
|
<view class="width100 font18 fcor666">时代天街</view>
|
|
<image src="../static/imgs/location.png" v-if="typeid == 1" mode="widthFix" class="icon20 mart5"></image>
|
|
<image src="../static/imgs/locabtn.png" v-if="typeid == 2" mode="widthFix" class="icon20 mart5"></image>
|
|
<view class="width100 mart5 font12 fcor666">时代天街时代天街时代天街时代天街</view>
|
|
</view> -->
|
|
<view class="width96 mart20 colorc3 font12 fotct" v-if="typeid == 1">
|
|
注:约5分钟后取餐,请尽快到餐厅取餐哦
|
|
</view>
|
|
|
|
<view class="concont width94 mart10 backcorfff height45 alijusstart" v-if="typeid == 2">
|
|
<view class="width25 font14 paddleft10 fcor333">
|
|
餐品详情
|
|
</view>
|
|
<view class="color2f6f43 font14">
|
|
3-10分钟出单,请凭取餐口令到店取餐
|
|
</view>
|
|
</view>
|
|
|
|
<view class="concont width94 mart10 backcorfff">
|
|
<view class="width94 paddtop10 font14 fcor333">
|
|
餐品详情
|
|
</view>
|
|
<view class="width100 bor-botm1 mart10 marb10"></view>
|
|
<view class="width100">
|
|
<view class="width100 alijusstart mart10 bor-botm1" v-for="(item,index) in orderList" :key="index">
|
|
<view class="width30">
|
|
<image :src="item.imgs" mode="widthFix" class="width100"></image>
|
|
</view>
|
|
<view class="width40 ">
|
|
<view class="width100 font14 fcor333 fontwig6">{{item.name}}</view>
|
|
<view class="width100 font12 fcor999 mart5">
|
|
<text v-if="item.cupSize">{{item.cupSize}}</text><text
|
|
v-if="item.temperature">,{{item.temperature}}</text><text
|
|
v-if="item.cream">,{{item.cream}}</text><text
|
|
v-if="item.espresso">,{{item.espresso}}</text><text
|
|
v-if="item.milk">,{{item.milk}}</text><text
|
|
v-if="item.milkBubble">,{{item.milkBubble}}</text>
|
|
</view>
|
|
</view>
|
|
<view class="width10 font12 fcor999">x{{item.num}}</view>
|
|
<view class="width20">
|
|
<view class="width100 fcor333 font12">¥
|
|
<text class="fontwig6 font16" v-if="!memDiscountId">{{item.price}}</text>
|
|
<text class="fontwig6 font16" v-else>{{item.oldprice}}</text>
|
|
</view>
|
|
<view class="width100 fcor999 font12" v-if="item.price != item.oldprice && !memDiscountId"
|
|
style="text-decoration: line-through;">¥{{item.oldprice}}
|
|
</view>
|
|
</view>
|
|
</view>
|
|
<view class="width90 fotrt height50 font13 fcor999">
|
|
共 <text class="fcor333 fontwig6" style="margin: 0px 5px;"> {{totalnum}} </text> 件 小计:
|
|
<text class="font16 colorc3 fontwig6 margle" v-if="typeid == 1 && memDiscountId">
|
|
¥{{orderPrice}}</text>
|
|
<text class="font16 colorc3 fontwig6 margle" v-if="typeid == 1 && !memDiscountId">
|
|
¥{{totalprice}}</text>
|
|
<text class="font12 fcor999 fontwig6 margle" v-if="typeid == 1 && !memDiscountId"
|
|
style="text-decoration: line-through;"> ¥{{orderPrice}}</text>
|
|
|
|
<text class="font16 color2f6f43 fontwig6 margle" v-if="typeid == 2 && memDiscountId">
|
|
¥{{orderPrice}}</text>
|
|
<text class="font16 color2f6f43 fontwig6 margle" v-if="typeid == 2 && !memDiscountId">
|
|
¥{{totalprice}}</text>
|
|
<text class="font12 fcor999 fontwig6 margle" v-if="typeid == 2 && !memDiscountId"
|
|
style="text-decoration: line-through;"> ¥{{orderPrice}}</text>
|
|
</view>
|
|
</view>
|
|
</view>
|
|
|
|
<view class="width94 backcorfff mart10">
|
|
<view class="width94 alijusstart height50 font14 fcor666">
|
|
<view class="width40 fcor333 fontwig6 font16" style="padding-left: 2%;">邀请码</view>
|
|
<input class="width60 fotrt font15" v-model="identificationCode" placeholder="请输入邀请码" />
|
|
</view>
|
|
</view>
|
|
|
|
<view class="width94 concont mart10 backcorfff">
|
|
<view class="height50 width100 paddtop5 backcorfff" @click="showPopup()">
|
|
<view class="width50 flleft fcor333 fontwig6 font16" style="padding-left: 4%;">
|
|
优惠抵扣<text class="yhqky">{{OrderPreList.length}}张可用</text>
|
|
</view>
|
|
<view class="width40 flright fotrt paddtright10 font15 fontwig6 fcor666 alijun"
|
|
style="align-items: center;" v-if="deductionPrice == 0">
|
|
未使用
|
|
<image style="width: 40rpx;height: 40rpx;" src="../../static/img/jt.png"></image>
|
|
</view>
|
|
<view class="width40 flright fotrt paddtright10 font15 fontwig6 fcoreb5 alijun"
|
|
style="align-items: center;" v-else>
|
|
-¥{{deductionPrice}}
|
|
<image style="width: 40rpx;height: 40rpx;" src="../../static/img/jt.png"></image>
|
|
</view>
|
|
</view>
|
|
<view class="width94 line1 mart5 marb5"></view>
|
|
<view class="Bubble alijusstart font14 fcor999">
|
|
选取: <text class="tests fotct font14 colorc3 paddleft5 paddtright5"
|
|
v-if="typeid == 1">{{priceValue[1]}}</text><text
|
|
class="tests fotct font14 color2f6f43 paddleft5 paddtright5"
|
|
v-if="typeid == 2">{{priceValue[1]}}</text> 分
|
|
</view>
|
|
<view class="width92 alijusstart paddtop10">
|
|
<view class="width30 fcor333 fontwig6 font16">
|
|
积分抵扣
|
|
</view>
|
|
<view class="cj-slider">
|
|
<view class="flleft fotct font14 fcor666" style="width: 15%;">0</view>
|
|
<cj-slider style="width: 60%; float:left;" v-if="isDiscount" v-model="priceValue" :min="0"
|
|
:max="availIntegal" :step="1" :blockWidth="40" @start="blockStart" @moving="blockMoving"
|
|
@end="blockEnd" />
|
|
<view class="flright fotrt font14 fcor666" style="width: 25%;">{{availIntegal}}</view>
|
|
</view>
|
|
</view>
|
|
<view class="width94 line1 mart15 marb5"></view>
|
|
<view class="height50 width100 backcorfff">
|
|
<view class="width70 flleft fcor666 font16 text1" style="padding-left: 4%;">
|
|
抵扣金额
|
|
</view>
|
|
<view class="width20 flright fotrt paddtright10 font15 fcor666 alijun" style="align-items: center;">
|
|
¥{{priceValue[1] / 100}}
|
|
</view>
|
|
</view>
|
|
<view class="width94 line1 marb5"></view>
|
|
|
|
<view class="height40 width100 backcorfff">
|
|
<view class="width40 flleft fcor666 font15 text1 alijusstart" style="padding-left: 2%;">
|
|
<image src="../../static/img/rebate.png" mode="widthFix" style="width: 25px;"></image>
|
|
<text>下单返积分</text>
|
|
</view>
|
|
<view class="width50 flright fotrt paddtright10 font15 colore95 alijun" v-if="Integrastu == 1"
|
|
style="align-items: center;">
|
|
返{{rebateIntegral}}积分
|
|
</view>
|
|
<view class="width50 flright fotrt paddtright10 font15 colore95 alijun" v-if="Integrastu == 2"
|
|
style="align-items: center;">
|
|
{{rebateIntegral}}
|
|
</view>
|
|
</view>
|
|
<view class=" width100 backcorfff alijusstart paddbotm10" style="padding-left: 2%;">
|
|
<image src="../../static/img/sigh.png" mode="widthFix" class="icon20"></image>
|
|
<text class="fcor999 font13">积分抵扣与优惠券抵扣不同享</text>
|
|
</view>
|
|
|
|
<view class="width94 line1 marb5"></view>
|
|
<view class="height50 width100">
|
|
<view class="width100 flleft fcor333 fontwig6 font16" style="padding-left: 4%;">
|
|
支付方式
|
|
<!-- :
|
|
<text class="jfrecharge" style="background-color: #c72a20;" v-if="typeid == 1" @click="jumpdeposits">积分充值</text>
|
|
<text class="jfrecharge backcorf2f6" v-if="typeid == 2" @click="jumpdeposits">积分充值</text> -->
|
|
</view>
|
|
</view>
|
|
<view class="width100" v-for="(item,index) in paytypeList" :key="index">
|
|
<view class="width94 line1 mart5 marb5" v-if="item == 2"></view>
|
|
<view class="height50 width100 backcorfff" @tap="paytype='2'" v-if="item == 2">
|
|
<view class="width50 flleft fcor666 font16" style="padding-left: 4%;">
|
|
微信支付
|
|
</view>
|
|
<view class="width40 flright fotrt paddtright10 font15 fontwig6 fcor666 alijun"
|
|
style="align-items: center;" v-if="isUse">
|
|
<radio :checked="paytype=='2'" v-if="typeid == 1" color="#c72a20" />
|
|
<radio :checked="paytype=='2'" v-else color="#2f6f43" />
|
|
</view>
|
|
</view>
|
|
<view class="width94 line1 mart5 marb5" v-if="item == 3"></view>
|
|
<view class="height50 width100 backcorfff" @tap="paytype='3'" v-if="item == 3">
|
|
<view class="width70 flleft fcor666 font16 text1" style="padding-left: 4%;">
|
|
汇联通工会卡<text class="font14 fcor666 margle">可用余额: {{tongCardPrice}}元</text>
|
|
</view>
|
|
<view class="width20 flright fotrt paddtright10 font15 fontwig6 fcor666 alijun"
|
|
style="align-items: center;" v-if="isUse">
|
|
<radio :checked="paytype=='3'" v-if="typeid == 1" @click="changeRiado()" color="#c72a20" />
|
|
<radio :checked="paytype=='3'" v-else @click="changeRiado()" color="#2f6f43" />
|
|
</view>
|
|
</view>
|
|
</view>
|
|
</view>
|
|
<view class="concont width94 mart10 backcorfff">
|
|
<view class="width94 alijusstart height40p paddtop10 font14 fcor666">
|
|
<view class="width40">联系电话</view>
|
|
<input class="width60 fotrt font15" v-model="customerMobile" placeholder="请输入联系人手机号" />
|
|
</view>
|
|
<view class="width94 font12 fcor999 mart5 paddbotm10">经用于接收取餐码,请正确填写</view>
|
|
</view>
|
|
|
|
<view class="concont width94 mart20 backcorfff marb150" v-if="typeid == 1">
|
|
<view class="width94 paddtop10 font14 fcor333 fontwig6">
|
|
就餐方式
|
|
</view>
|
|
<view class="width94 mart20 paddbotm20 alijusstart">
|
|
<view class="takemode height30 alijus fcor999" :class="sttypeid == '1'?'aftermode':''"
|
|
@click="changedissr(1)">
|
|
<image src="../static/imgs/menu3.png" mode="widthFix" class="icon20"></image>
|
|
<view class="font14 margle10">店内就餐</view>
|
|
</view>
|
|
<view class="takemode height30 alijus fcor999" style="margin-left: 4%;"
|
|
:class="sttypeid == '2'?'aftermode':''" @click="changedissr(2)">
|
|
<image src="../static/imgs/menu2.png" mode="widthFix" class="icon20"></image>
|
|
<view class="font14 margle10">打包带走</view>
|
|
</view>
|
|
</view>
|
|
</view>
|
|
<view class="concont width94 mart20 backcorfff marb150 font13" v-if="typeid == 2">
|
|
<view class="width94 alijusstart paddtop10 font14" @click="radioChange()">
|
|
<view class="width50 fcor333">购买须知</view>
|
|
<!-- <view ></view> -->
|
|
<radio-group class="width50 fotrt alijusend font14" style="transform: scale(0.77)">
|
|
<radio :checked="radiostu == 1" v-if="typeid == 1" color="#c72a20" />
|
|
<radio :checked="radiostu == 1" v-if="typeid == 2" color="#2f6f43" />
|
|
<text>已读</text>
|
|
<!-- <text>未读</text> -->
|
|
</radio-group>
|
|
</view>
|
|
<view class="fcor666 width94 mart10">
|
|
1.本平台商品为折扣商品,<text class="fontwig6 fcoreb5">付款后订单不可取消!!!不可退换!!!</text>请准确核对信息,确认后购买。
|
|
</view>
|
|
<view class="fcor666 width94 mart10">
|
|
2.出餐是由平台入驻的商家提供咖啡代点服务,若出餐失败,将会在两小时内自动退款。
|
|
</view>
|
|
<view class="fcor666 width94 mart10">
|
|
3.购买成功后,将会以推送消息的方式提醒您购买成功,请查看短信或者到订单详情页查看取餐口令,凭取餐口令可到门店取餐。
|
|
</view>
|
|
<view class="fcor666 width94 mart10 paddbotm20">
|
|
4.如遇出餐失败,配送失败等任何平台方原因导致的订单异常,请及时联系在线客服处理。
|
|
</view>
|
|
</view>
|
|
|
|
|
|
<view class="footbtn width100 height50 backcor33">
|
|
<view class="width94 alijusstart">
|
|
<view class="width70 fcorfff">
|
|
合计: ¥<text class="font16 fontwig6" style="margin: 0px 6px;">{{payPrice}}</text>
|
|
<!-- <text class="font12">已省:¥{{disconutprice}}</text> -->
|
|
</view>
|
|
<view class="width30 fotrt" @click="qzaddorder()">
|
|
<view class="btnpay fotct font13 fcorfff" style="background-color: #c72a20;" v-if="typeid == 1">去支付
|
|
</view>
|
|
<view class="btnpay fotct font13 fcorfff backcorf2f6" v-if="typeid == 2">去支付</view>
|
|
</view>
|
|
</view>
|
|
</view>
|
|
|
|
<wybPopup ref="popup" type="bottom" width="500" :scrollY="true" radius="6" :showCloseIcon="true">
|
|
<view class="fotct font18 fontwig6 fcor333 mart10 height30">优惠券选择</view>
|
|
<view class="width92 height110 tccs mart10 alijus" v-for="(items, index) in OrderPreList" :key="index"
|
|
@click="radioChanges(items)">
|
|
<image mode="widthFix" :src="imageUrl+items.discountImg"></image>
|
|
<view class="alijus width60 margle10">
|
|
<view class="width80p">
|
|
<view class="font16 fontwig6 fcor333 text1">{{items.discountName}}</view>
|
|
<view class="font13 fcor999 mart5">有效期:{{items.useEndTime | timeFormat('yyyy-mm-dd hh:mm:ss')}}
|
|
</view>
|
|
</view>
|
|
<view class="width20 fotrt">
|
|
<view>
|
|
<radio
|
|
v-if="typeid == 1 && items.discountCondition && orderPrice >= items.discountCondition"
|
|
color="#c72a20" :checked="items.id == memDiscountId" />
|
|
|
|
<radio v-if="typeid == 1 && items.discountCondition && orderPrice < items.discountCondition"
|
|
color="#c72a20" disabled="true" :checked="items.id == memDiscountId" />
|
|
|
|
<radio v-if="typeid == 1 && !items.discountCondition" color="#c72a20"
|
|
:checked="items.id == memDiscountId" />
|
|
|
|
<radio
|
|
v-if="typeid == 2 && items.discountCondition && orderPrice >= items.discountCondition"
|
|
color="#2f6f43" :checked="items.id == memDiscountId" />
|
|
|
|
<radio v-if="typeid == 2 && items.discountCondition && orderPrice < items.discountCondition"
|
|
disabled="true" color="#2f6f43" :checked="items.id == memDiscountId" />
|
|
|
|
<radio v-if="typeid == 2 && !items.discountCondition" color="#2f6f43"
|
|
:checked="items.id == memDiscountId" />
|
|
</view>
|
|
</view>
|
|
</view>
|
|
</view>
|
|
</wybPopup>
|
|
<ssPaymentPassword ref="paymentPassword" :mode="1" @submit="submitHandle" />
|
|
</view>
|
|
</template>
|
|
|
|
<script>
|
|
import cjSlider from '@/components/cj-slider/cj-slider.vue';
|
|
import ssPaymentPassword from '@/components/sanshui-payment-password/index.vue'
|
|
import wybPopup from '@/components/wyb-popup/wyb-popup.vue'
|
|
import {
|
|
create,
|
|
getThirdPartyByDetail,
|
|
getHuiLianTongCardBalance,
|
|
findUser,
|
|
wechatPay,
|
|
cardPay,
|
|
getUserOrderPreList,
|
|
cancel,
|
|
getRebateIntegral
|
|
} from '../../Utils/Api.js';
|
|
// #ifdef H5
|
|
var jweixin = require('jweixin-module');
|
|
// #endif
|
|
let app = getApp();
|
|
export default {
|
|
components: {
|
|
cjSlider,
|
|
ssPaymentPassword,
|
|
wybPopup
|
|
},
|
|
data() {
|
|
return {
|
|
orderList: [],
|
|
sttypeid: 1,
|
|
paytype: '2', //支付方式
|
|
typeid: app.globalData.distinguishid, //类型区分 2:星巴克 1:肯德基
|
|
priceValue: [0, 0], // 积分可以指定默认值
|
|
availIntegal: 0, // 可用积分
|
|
totalprice: 0, //总价
|
|
disconutprice: 0, //优惠价格
|
|
totalnum: '', //总数量
|
|
customerMobile: '', //电话号码
|
|
radiostu: 0, // 须知状态
|
|
storeCode: '', //门店id
|
|
|
|
productType: '', //充值类型
|
|
paytypeList: [], //支付方式
|
|
tongCardPrice: 0, //工会卡余额
|
|
user: '', //个人信息
|
|
isUse: true, // 是否禁用状态
|
|
payPrice: 0, //支付价格
|
|
isDiscount: true, //刷新组件
|
|
showType: '', //支付方式
|
|
memDiscountId: '', //优惠券id
|
|
PaymentPassword: '', //支付密码
|
|
orderId: '', //订单id
|
|
deductionPrice: '0.00', //优惠金额
|
|
OrderPreList: [], //优惠券数据
|
|
imageUrl: app.globalData.imgUrl, //图片地址
|
|
orderPrice: 0, //订单价格
|
|
rechargeDes: '', // 支付详情
|
|
rebateIntegral: '', //返回积分
|
|
Integrastu: 1 ,//返积分状态
|
|
identificationCode: '', //渠道商
|
|
}
|
|
},
|
|
onLoad() {
|
|
this.orderList = app.globalData.qianzhulist;
|
|
this.storeCode = app.globalData.qianzhulist[0].storeCode;
|
|
this.customerMobile = app.globalData.userInfo.phone;
|
|
this.getAllPrice();
|
|
this.getAllCount();
|
|
},
|
|
onShow() {
|
|
this.findUser();
|
|
},
|
|
methods: {
|
|
//查询支付方式
|
|
getThirdPartyByDetail() {
|
|
// #ifdef H5
|
|
this.showType = 2;
|
|
// #endif
|
|
// #ifdef MP
|
|
this.showType = 1;
|
|
// #endif
|
|
|
|
if (this.typeid == 1) {
|
|
this.productType = 2;
|
|
}
|
|
if (this.typeid == 2) {
|
|
this.productType = 1;
|
|
}
|
|
let datas = {
|
|
platformId: this.showType,
|
|
regionId: app.globalData.cityId,
|
|
productType: this.productType
|
|
}
|
|
getThirdPartyByDetail(datas).then(res => {
|
|
if (res.return_code == '000000') {
|
|
this.rechargeDes = res.return_data;
|
|
this.paytypeList = res.return_data.productPayType.split(',');
|
|
this.paytypeList = this.paytypeList.slice(0, this.paytypeList.length - 1);
|
|
let zkprice = parseFloat(res.return_data.integralDiscount / 100).toFixed(2);
|
|
let pprice = parseFloat(this.totalprice * 100).toFixed(0)
|
|
let payprice = parseFloat(this.totalprice * 100 * zkprice).toFixed(
|
|
0);
|
|
if (payprice > this.user.gold) {
|
|
this.availIntegal = this.user.gold;
|
|
} else {
|
|
this.availIntegal = payprice;
|
|
}
|
|
}
|
|
});
|
|
},
|
|
//支付返利积分
|
|
getRebateIntegral() {
|
|
let datas = {
|
|
"companyId": app.globalData.companyId,
|
|
"price": this.payPrice,
|
|
"productId": this.productType,
|
|
"type": 4,
|
|
}
|
|
getRebateIntegral(datas).then(res => {
|
|
if (res.return_code == '000000') {
|
|
this.rebateIntegral = res.return_data;
|
|
this.Integrastu = 1;
|
|
} else {
|
|
this.rebateIntegral = res.return_msg;
|
|
this.Integrastu = 2;
|
|
}
|
|
})
|
|
},
|
|
//查询积分
|
|
findUser() {
|
|
findUser().then(res => {
|
|
if (res.return_code == '000000') {
|
|
app.globalData.userInfo = res.return_data;
|
|
this.user = res.return_data;
|
|
this.getHuiLianTongCardBalance();
|
|
this.getThirdPartyByDetail();
|
|
this.getUserOrderPreList();
|
|
this.getRebateIntegral();
|
|
uni.setStorage({
|
|
key: "user",
|
|
data: res.return_data
|
|
})
|
|
}
|
|
});
|
|
},
|
|
//查询工会卡详情
|
|
getHuiLianTongCardBalance() {
|
|
if (!this.user.hltCardNo) {
|
|
return;
|
|
}
|
|
let params = {
|
|
cardNo: this.user.hltCardNo.cardNo
|
|
}
|
|
getHuiLianTongCardBalance(params).then(res => {
|
|
if (res.return_code == '000000') {
|
|
this.tongCardPrice = res.return_data.balance;
|
|
}
|
|
});
|
|
},
|
|
// 总价
|
|
getAllPrice() {
|
|
let result = 0;
|
|
let result1 = 0;
|
|
this.orderList.forEach((good) => {
|
|
result1 += this.accMul(good.num, good.price);
|
|
result = result1.toFixed(2);
|
|
})
|
|
|
|
// let resul2 = 0;
|
|
let result3 = 0;
|
|
this.orderList.forEach((good) => {
|
|
result3 += this.accMul(good.num, good.oldprice)
|
|
this.disconutprice = (result3 - result).toFixed(2);
|
|
})
|
|
|
|
this.orderPrice = result3;
|
|
this.totalprice = result;
|
|
this.payPrice = result;
|
|
},
|
|
//总数
|
|
getAllCount() {
|
|
let result = 0;
|
|
this.orderList.forEach((food) => {
|
|
result += food.num
|
|
})
|
|
this.totalnum = result;
|
|
},
|
|
accMul(arg1, arg2) {
|
|
let m = 0,
|
|
s1 = '',
|
|
s2 = '';
|
|
if (arg1 && arg1 != null)
|
|
s1 = arg1.toString();
|
|
if (arg2 && arg2 != null)
|
|
s2 = arg2.toString();
|
|
// console.log('m1',s2.replace('.',''))
|
|
try {
|
|
m += s1.split('.')[1].length
|
|
} catch (e) {}
|
|
try {
|
|
m += s2.split('.')[1].length
|
|
} catch (e) {}
|
|
|
|
return Number(s1.replace('.', '')) * Number(s2.replace('.', '')) / Math.pow(10, m);
|
|
},
|
|
//选择方式
|
|
changedissr(item) {
|
|
this.sttypeid = item;
|
|
},
|
|
|
|
//滑动开始
|
|
blockStart() {},
|
|
blockMoving() {
|
|
// console.log('正在滑动中')
|
|
},
|
|
//滑动结束
|
|
blockEnd() {
|
|
this.isDiscount = 1;
|
|
if (this.deductionPrice == 0) {
|
|
this.payPrice = Math.abs(parseFloat(this.totalprice - parseFloat(this.priceValue[1] / 100).toFixed(2))
|
|
.toFixed(
|
|
2));
|
|
} else {
|
|
this.payPrice = Math.abs(parseFloat(this.orderPrice - parseFloat(this.priceValue[1] / 100).toFixed(2) -
|
|
this
|
|
.deductionPrice).toFixed(2));
|
|
}
|
|
if (this.payPrice == 0) {
|
|
this.isUse = false;
|
|
this.paytype = '';
|
|
} else {
|
|
this.isUse = true;
|
|
}
|
|
this.getRebateIntegral();
|
|
},
|
|
//获取选择支付方式
|
|
changeRiado() {
|
|
if (!this.user.isSetHltCard) {
|
|
uni.showToast({
|
|
icon: 'none',
|
|
title: '当前账号还未绑定,前往绑定',
|
|
duration: 2000,
|
|
success() {
|
|
setTimeout(() => {
|
|
uni.navigateTo({
|
|
url: '/pages/user/bindingCard/bindingCard'
|
|
})
|
|
}, 1000)
|
|
}
|
|
});
|
|
return;
|
|
}
|
|
},
|
|
//须知选中
|
|
radioChange() {
|
|
if (this.radiostu == 1) {
|
|
this.radiostu = '';
|
|
} else {
|
|
this.radiostu = 1;
|
|
}
|
|
},
|
|
//下单
|
|
qzaddorder() {
|
|
if (this.customerMobile == '') {
|
|
uni.showToast({
|
|
title: '请输入联系电话',
|
|
icon: 'none',
|
|
duration: 2000
|
|
})
|
|
return;
|
|
}
|
|
|
|
if (this.radiostu != 1 && this.typeid == 2) {
|
|
uni.showToast({
|
|
title: '请勾选协议表示同意',
|
|
icon: 'none',
|
|
duration: 2000
|
|
})
|
|
return;
|
|
}
|
|
if (this.payPrice == 0) {
|
|
if (!this.user.isSetPayPwd) {
|
|
uni.navigateTo({
|
|
url: '../../pages/login/updatePas/updatePas'
|
|
})
|
|
return;
|
|
}
|
|
this.$refs.paymentPassword.modalFun('show');
|
|
return;
|
|
}
|
|
|
|
if (this.paytype == '') {
|
|
uni.showToast({
|
|
title: '请选择支付方式',
|
|
icon: 'none',
|
|
duration: 2000
|
|
})
|
|
return;
|
|
}
|
|
uni.showLoading({
|
|
title: '提交订单中...'
|
|
})
|
|
let datas;
|
|
if (this.typeid == 1) {
|
|
let data1 = [];
|
|
let data2 = '';
|
|
this.orderList.forEach((good) => {
|
|
let sj = good.productId + '|' + good.num;
|
|
data1.push(sj);
|
|
})
|
|
data2 = data1.join(',');
|
|
datas = {
|
|
"childOrderList": [{
|
|
"goodsId": 9999,
|
|
"customerMobile": this.customerMobile,
|
|
"storeCode":this.storeCode,
|
|
"platformId": this.showType,
|
|
"productType": this.productType,
|
|
"orderItems": data2,
|
|
"eatType": this.sttypeid,
|
|
"goodsType": 4,
|
|
"saleCount": 1,
|
|
}],
|
|
"payGold": this.priceValue[1],
|
|
"companyId": app.globalData.companyId,
|
|
"promoteCode": this.identificationCode,
|
|
"memDiscountId": this.memDiscountId,
|
|
}
|
|
}
|
|
if (this.typeid == 2) {
|
|
datas = {
|
|
"childOrderList": [{
|
|
"goodsId": 9999,
|
|
"customerMobile": this.customerMobile,
|
|
"storeCode":this.storeCode,
|
|
"platformId": this.showType,
|
|
"productType": this.productType,
|
|
"orderItems": this.orderList,
|
|
"goodsType": 9,
|
|
"saleCount": 1,
|
|
}],
|
|
"payGold": this.priceValue[1],
|
|
"companyId": app.globalData.companyId,
|
|
"promoteCode": this.identificationCode,
|
|
"memDiscountId": this.memDiscountId,
|
|
}
|
|
}
|
|
create(datas).then(res => {
|
|
uni.hideLoading();
|
|
if (res.return_code == '000000') {
|
|
this.orderId = res.return_data.orderNo;
|
|
let params = {
|
|
"orderNo": res.return_data.orderNo,
|
|
"openId": app.globalData.openId,
|
|
"openIdType": this.showType
|
|
}
|
|
this.wechatPay(params);
|
|
} else {
|
|
uni.showToast({
|
|
title: res.return_msg,
|
|
icon: 'none',
|
|
duration: 2000
|
|
})
|
|
}
|
|
})
|
|
},
|
|
//取消订单
|
|
thirdCancelOrder() {
|
|
let params = {
|
|
orderNo: this.orderId,
|
|
}
|
|
cancel(params).then(res => {
|
|
if (res.return_code == '000000') {
|
|
this.orderId = '';
|
|
}
|
|
})
|
|
},
|
|
//查询优惠券
|
|
getUserOrderPreList() {
|
|
let cope;
|
|
if (this.productType == 1) {
|
|
cope = 5;
|
|
} else {
|
|
cope = 4;
|
|
}
|
|
let params = {
|
|
useScope: cope
|
|
}
|
|
getUserOrderPreList(params).then(res => {
|
|
if (res.return_code == '000000') {
|
|
this.OrderPreList = res.return_data;
|
|
}
|
|
});
|
|
},
|
|
//弹出优惠券
|
|
showPopup() {
|
|
this.$refs.popup.show();
|
|
},
|
|
//选择优惠券
|
|
radioChanges(item) {
|
|
this.rechangeload();
|
|
if (this.memDiscountId == item.id) { // 如果已经选中,则取消选中
|
|
this.memDiscountId = '';
|
|
this.deductionPrice = '0.00';
|
|
this.priceCaluc(this.totalprice);
|
|
|
|
} else { // 否则进行选中赋值
|
|
if (item.discountType == 1) {
|
|
if (this.orderPrice > item.discountCondition) {
|
|
this.memDiscountId = item.id;
|
|
//满减价格
|
|
this.deductionPrice = item.discountPrice;
|
|
let oldprice = this.orderPrice - this.deductionPrice;
|
|
this.priceCaluc(oldprice);
|
|
} else {
|
|
uni.showToast({
|
|
title: '请满' + item.discountCondition + '使用此券',
|
|
icon: 'none',
|
|
duration: 2000
|
|
})
|
|
}
|
|
}
|
|
if (item.discountType == 2) {
|
|
this.memDiscountId = item.id;
|
|
//抵扣价格
|
|
this.deductionPrice = item.discountPrice;
|
|
let oldprice = this.orderPrice - this.deductionPrice;
|
|
this.priceCaluc(oldprice);
|
|
}
|
|
if (item.discountType == 3) {
|
|
this.memDiscountId = item.id;
|
|
// 打折
|
|
this.deductionPrice = parseFloat(this.orderPrice - (this.orderPrice * item.discountPrice))
|
|
.toFixed(2);
|
|
let oldprice = parseFloat(this.orderPrice * item.discountPrice).toFixed(2);
|
|
this.priceCaluc(oldprice);
|
|
|
|
}
|
|
}
|
|
this.$refs.popup.hide();
|
|
},
|
|
//计算价格
|
|
priceCaluc(item) {
|
|
let zkprice = parseFloat(this.rechargeDes.integralDiscount / 100).toFixed(2);
|
|
let pprice = parseFloat(item * 100).toFixed(0);
|
|
let payprice = parseFloat(item * 100 * zkprice).toFixed(0);
|
|
if (payprice > this.user.gold) {
|
|
this.availIntegal = this.user.gold;
|
|
this.priceValue[1] = 0;
|
|
} else {
|
|
this.availIntegal = payprice;
|
|
this.priceValue[1] = 0;
|
|
}
|
|
this.reload();
|
|
this.calculatepayPrice();
|
|
},
|
|
//计算支付价格
|
|
calculatepayPrice() {
|
|
if (this.deductionPrice == 0) {
|
|
this.payPrice = Math.abs(parseFloat(this.totalprice - (parseFloat(this.priceValue[1] / 100).toFixed(
|
|
2)))
|
|
.toFixed(2));
|
|
} else {
|
|
this.payPrice = Math.abs(parseFloat(this.orderPrice - (parseFloat(this.priceValue[1] / 100).toFixed(
|
|
2)) - this
|
|
.deductionPrice).toFixed(2));
|
|
}
|
|
this.getRebateIntegral();
|
|
},
|
|
rechangeload() {
|
|
this.isUse = false;
|
|
this.$nextTick(() => (this.isUse = true))
|
|
},
|
|
//刷新组件
|
|
reload() {
|
|
this.isDiscount = false;
|
|
this.$nextTick(() => (this.isDiscount = true))
|
|
},
|
|
//获取订单数据
|
|
wechatPay(item) {
|
|
let that = this;
|
|
if (that.paytype == '2') {
|
|
wechatPay(item).then(res => {
|
|
if (res.return_code == '000000') {
|
|
// #ifdef MP
|
|
uni.showLoading({
|
|
title: '支付中...'
|
|
})
|
|
uni.requestPayment({
|
|
"appId": res.return_data.appId,
|
|
"nonceStr": res.return_data.nonceStr,
|
|
"package": res.return_data.package,
|
|
"paySign": res.return_data.sign,
|
|
"signType": "MD5",
|
|
"timeStamp": res.return_data.timeStamp,
|
|
success: function(res) {
|
|
uni.hideLoading();
|
|
uni.showToast({
|
|
title: '支付成功'
|
|
})
|
|
uni.reLaunch({
|
|
url: '/qianzhu-KFC/order-details/order-details?id=' +
|
|
that.orderId
|
|
})
|
|
},
|
|
fail: function(err) {
|
|
uni.hideLoading();
|
|
uni.navigateBack({})
|
|
},
|
|
});
|
|
// #endif
|
|
|
|
//判断是否是公众号
|
|
// #ifdef H5
|
|
that.payRequest(res);
|
|
// #endif
|
|
|
|
} else {
|
|
uni.showToast({
|
|
title: res.return_msg,
|
|
duration: 2000,
|
|
icon: 'none'
|
|
})
|
|
}
|
|
})
|
|
} else if (that.paytype == '3') {
|
|
if (that.tongCardPrice < that.payPrice) {
|
|
uni.showToast({
|
|
icon: 'none',
|
|
title: '工会卡余额不足',
|
|
duration: 2000,
|
|
});
|
|
that.thirdCancelOrder();
|
|
return;
|
|
}
|
|
if (!that.user.isSetPayPwd) {
|
|
uni.navigateTo({
|
|
url: '../../pages/login/updatePas/updatePas'
|
|
})
|
|
that.thirdCancelOrder();
|
|
return;
|
|
}
|
|
if (!that.user.isSetHltCard) {
|
|
uni.showToast({
|
|
icon: 'none',
|
|
title: '当前账号还未绑定,前往绑定',
|
|
duration: 2000,
|
|
success() {
|
|
setTimeout(() => {
|
|
uni.navigateTo({
|
|
url: '../../pages/user/bindingCard/bindingCard'
|
|
})
|
|
}, 1000)
|
|
}
|
|
});
|
|
that.thirdCancelOrder();
|
|
return;
|
|
}
|
|
that.$refs.paymentPassword.modalFun('show');
|
|
} else {
|
|
uni.showToast({
|
|
title: '请选择支付方式',
|
|
icon: 'none',
|
|
duration: 2000
|
|
})
|
|
}
|
|
},
|
|
submitHandle(e) {
|
|
uni.showLoading({
|
|
title: '支付中...'
|
|
})
|
|
this.PaymentPassword = e.value;
|
|
if (this.PaymentPassword == '') {
|
|
uni.showToast({
|
|
title: '请勿手动关闭弹窗',
|
|
icon: 'none',
|
|
duration: 2000
|
|
})
|
|
uni.hideLoading();
|
|
return;
|
|
}
|
|
let datas;
|
|
if (this.payPrice == 0) {
|
|
if (this.typeid == 1) {
|
|
let data1 = [];
|
|
let data2 = '';
|
|
this.orderList.forEach((good) => {
|
|
let sj = good.productId + '|' + good.num;
|
|
data1.push(sj);
|
|
})
|
|
data2 = data1.join(',');
|
|
datas = {
|
|
"childOrderList": [{
|
|
"goodsId": 9999,
|
|
"customerMobile": this.customerMobile,
|
|
"storeCode":this.storeCode,
|
|
"platformId": this.showType,
|
|
"productType": this.productType,
|
|
"orderItems": data2,
|
|
"eatType": this.sttypeid,
|
|
"goodsType": 4,
|
|
"saleCount": 1,
|
|
}],
|
|
"payGold": this.priceValue[1],
|
|
"companyId": app.globalData.companyId,
|
|
"promoteCode": this.identificationCode,
|
|
"memDiscountId": this.memDiscountId,
|
|
"payPwd": this.PaymentPassword
|
|
}
|
|
console.log('======'+JSON.stringify(datas));
|
|
}
|
|
if (this.typeid == 2) {
|
|
datas = {
|
|
"childOrderList": [{
|
|
"goodsId": 9999,
|
|
"customerMobile": this.customerMobile,
|
|
"storeCode":this.storeCode,
|
|
"platformId": this.showType,
|
|
"productType": this.productType,
|
|
"orderItems": this.orderList,
|
|
"goodsType": 9,
|
|
"saleCount": 1,
|
|
}],
|
|
"payGold": this.priceValue[1],
|
|
"companyId": app.globalData.companyId,
|
|
"promoteCode": this.identificationCode,
|
|
"memDiscountId": this.memDiscountId,
|
|
"payPwd": this.PaymentPassword
|
|
}
|
|
|
|
}
|
|
|
|
create(datas).then(res => {
|
|
uni.hideLoading();
|
|
if (res.return_code == '000000') {
|
|
this.orderId = res.return_data.orderNo;
|
|
uni.reLaunch({
|
|
url: '/qianzhu-KFC/order-details/order-details?id=' + this.orderId
|
|
})
|
|
return;
|
|
}
|
|
if (res.return_code == '102130') {
|
|
uni.navigateTo({
|
|
url: '../../login/updatePas/updatePas'
|
|
})
|
|
return;
|
|
}
|
|
this.thirdCancelOrder();
|
|
uni.showToast({
|
|
title: res.return_msg,
|
|
icon: 'none',
|
|
duration: 2000
|
|
});
|
|
})
|
|
return;
|
|
}
|
|
let params = {
|
|
"orderNo": this.orderId,
|
|
"cardNo": this.user.hltCardNo.cardNo,
|
|
"password": this.PaymentPassword
|
|
}
|
|
cardPay(params).then(res => {
|
|
uni.hideLoading();
|
|
if (res.return_code == '000000') {
|
|
uni.showToast({
|
|
title: '支付成功'
|
|
})
|
|
uni.reLaunch({
|
|
url: '/qianzhu-KFC/order-details/order-details?id=' + this.orderId
|
|
})
|
|
return;
|
|
}
|
|
if (res.return_code == '102130') {
|
|
uni.navigateTo({
|
|
url: '../../login/updatePas/updatePas'
|
|
})
|
|
return;
|
|
}
|
|
uni.showToast({
|
|
title: res.return_msg,
|
|
icon: 'none',
|
|
duration: 2000
|
|
})
|
|
})
|
|
|
|
|
|
},
|
|
payRequest: function(self) {
|
|
let that = this;
|
|
uni.showLoading({
|
|
title: '支付中...'
|
|
})
|
|
jweixin.config({
|
|
// debug: false, // 开启调试模式,调用的所有api的返回值会在客户端alert出来,若要查看传入的参数,可以在pc端打开,参数信息会通过log打出,仅在pc端时才会打印。
|
|
appId: self.return_data.appId, // 必填,公众号的唯一标识
|
|
timestamp: self.return_data.timeStamp, // 必填,生成签名的时间戳
|
|
nonceStr: self.return_data.nonceStr, // 必填,生成签名的随机串
|
|
signature: self.return_data.sign, // 必填,签名,见附录1
|
|
jsApiList: ['chooseWXPay'] // 必填,需要使用的JS接口列表,所有JS接口列表见附录2
|
|
});
|
|
uni.hideLoading();
|
|
jweixin.ready(function() {
|
|
jweixin.checkJsApi({
|
|
jsApiList: ['chooseWXPay'], // 需要检测的JS接口列表,所有JS接口列表见附录2,
|
|
success: function(res) {},
|
|
fail: function(res) {}
|
|
});
|
|
jweixin.chooseWXPay({
|
|
appId: self.return_data.appId,
|
|
timestamp: self.return_data
|
|
.timeStamp, // 支付签名时间戳,注意微信jssdk中的所有使用timestamp字段均为小写。但最新版的支付后台生成签名使用的timeStamp字段名需大写其中的S字符
|
|
nonceStr: self.return_data.nonceStr, // 支付签名随机串,不长于 32 位
|
|
package: self.return_data
|
|
.package, // 统一支付接口返回的prepay_id参数值,提交格式如:prepay_id=***)
|
|
signType: 'MD5', // 签名方式,默认为'SHA1',使用新版支付需传入'MD5'
|
|
paySign: self.return_data.sign, // 支付签名
|
|
success: function(res) {
|
|
// 支付成功后的回调函数
|
|
uni.showToast({
|
|
title: '支付成功'
|
|
})
|
|
uni.reLaunch({
|
|
url: '/qianzhu-KFC/order-details/order-details?id=' +
|
|
that
|
|
.orderId
|
|
})
|
|
},
|
|
cancel: function(r) {
|
|
uni.navigateBack({})
|
|
},
|
|
fail: function(res) {
|
|
uni.navigateBack({})
|
|
}
|
|
});
|
|
});
|
|
|
|
jweixin.error(function(res) {
|
|
uni.showToast({
|
|
icon: 'none',
|
|
title: '支付失败了',
|
|
duration: 4000
|
|
});
|
|
});
|
|
},
|
|
}
|
|
}
|
|
</script>
|
|
|
|
<style lang="scss">
|
|
page {
|
|
background-color: #f0f0f0;
|
|
}
|
|
|
|
.headsbg {
|
|
border-radius: 0 0 30px 30px;
|
|
}
|
|
|
|
.concont {
|
|
border-radius: 12px;
|
|
}
|
|
|
|
.Bubble {
|
|
margin-left: 50%;
|
|
padding-top: 15px;
|
|
}
|
|
|
|
.tests {
|
|
border-radius: 15px;
|
|
height: 22px;
|
|
line-height: 22px;
|
|
}
|
|
|
|
.jfrecharge {
|
|
padding: 3px 20rpx;
|
|
color: #fff;
|
|
margin-left: 50%;
|
|
justify-content: center;
|
|
align-items: center;
|
|
font-size: 30rpx;
|
|
border-radius: 40rpx;
|
|
}
|
|
|
|
.footbtn {
|
|
bottom: 0px;
|
|
position: fixed;
|
|
}
|
|
|
|
.btnpay {
|
|
width: 90px;
|
|
border-radius: 22px;
|
|
height: 36px;
|
|
line-height: 36px;
|
|
}
|
|
|
|
.takemode {
|
|
width: 48%;
|
|
border-radius: 5px;
|
|
border: 1px solid #999999;
|
|
}
|
|
|
|
.aftermode {
|
|
background-color: #faf1f1;
|
|
color: #c72a20;
|
|
}
|
|
|
|
.cj-slider {
|
|
width: 100%;
|
|
align-items: center;
|
|
display: flex;
|
|
}
|
|
|
|
.yhqky {
|
|
background: #ff0034;
|
|
color: #ffffff;
|
|
font-size: 14px;
|
|
padding-left: 5px;
|
|
padding-right: 5px;
|
|
margin-left: 8px;
|
|
padding-top: 2px;
|
|
padding-bottom: 2px;
|
|
}
|
|
|
|
.yhprice {
|
|
margin-top: -30px;
|
|
}
|
|
|
|
.contrig {
|
|
margin-left: 180rpx;
|
|
}
|
|
|
|
.tccs {
|
|
box-shadow: 0rpx 0rpx 10rpx rgba(0, 0, 0, 0.2);
|
|
border: 1px solid #f6f6f6;
|
|
border-radius: 8px;
|
|
|
|
image {
|
|
// float: left;
|
|
width: 160rpx;
|
|
max-height: 160rpx;
|
|
// margin-left: 10px;
|
|
}
|
|
}
|
|
</style>
|
|
|