支付方式调整混合支付时微信支付和孔雀币支付都选中,孔雀币为0时不选中

master
chen 2022-04-14 18:04:31 +08:00
parent d00227b836
commit 60845dc587
26 changed files with 872 additions and 42 deletions

View File

@ -62,7 +62,7 @@ const checkError = (e) => {
} }
} }
} }
const flag = true; let flag = true;
// 封装请求 // 封装请求
const request = (method, url, options, ifLogin) => { const request = (method, url, options, ifLogin) => {
let methods = ''; let methods = '';
@ -116,6 +116,7 @@ const request = (method, url, options, ifLogin) => {
data: params, data: params,
success: res => { success: res => {
if(res.data.data.token!=''){ if(res.data.data.token!=''){
flag = true;
uni.setStorageSync('token',res.data.data.token); // 缓存token uni.setStorageSync('token',res.data.data.token); // 缓存token
uni.setStorageSync('openid',res.data.data.openid)//缓存openid uni.setStorageSync('openid',res.data.data.openid)//缓存openid
uni.setStorageSync('expire',res.data.data.expire); // 缓存失效时间(时间戳格式) uni.setStorageSync('expire',res.data.data.expire); // 缓存失效时间(时间戳格式)
@ -150,6 +151,7 @@ const request = (method, url, options, ifLogin) => {
data: params, data: params,
success: res => { success: res => {
if(res.data.data.token!=''){ if(res.data.data.token!=''){
flag = true;
uni.setStorageSync('token',res.data.data.token); // 缓存token uni.setStorageSync('token',res.data.data.token); // 缓存token
uni.setStorageSync('openid',res.data.data.openid)//缓存openid uni.setStorageSync('openid',res.data.data.openid)//缓存openid
uni.setStorageSync('expire',res.data.data.expire); // 缓存失效时间(时间戳格式) uni.setStorageSync('expire',res.data.data.expire); // 缓存失效时间(时间戳格式)

View File

@ -61,12 +61,17 @@
} }
,{ ,{
"path" : "getReadyDan/getReadyDan", "path" : "getReadyDan/getReadyDan",
"style" : "style" : {
{ "navigationBarTitleText": "",
"enablePullDownRefresh": false
}
}
,{
"path" : "getReadyDan/getReadyDan-two",
"style" : {
"navigationBarTitleText": "", "navigationBarTitleText": "",
"enablePullDownRefresh": false "enablePullDownRefresh": false
} }
} }
,{ ,{
"path" : "member/member", "path" : "member/member",

View File

@ -472,7 +472,6 @@
// console.log('',res); // console.log('',res);
if(res.code==0 && res.data.length!=0) { if(res.code==0 && res.data.length!=0) {
this.userInfo = res.data; this.userInfo = res.data;
console.log(this.userInfo,513);
uni.setStorageSync('userId',res.data.id); uni.setStorageSync('userId',res.data.id);
uni.setStorageSync('phone',this.userInfo.mobile); uni.setStorageSync('phone',this.userInfo.mobile);
this.userPhone = this.$toolAll.tools.hideMPhone(this.userInfo.mobile) this.userPhone = this.$toolAll.tools.hideMPhone(this.userInfo.mobile)

View File

@ -0,0 +1,818 @@
<template>
<view>
<!-- 状态栏 -->
<status-nav :titleVal="'购物车'" :statusTitle="true"></status-nav>
<view v-if="loading" :style="{paddingTop: statusHeight+'px'}" class="pad-zy30" style="padding-bottom: 150rpx;">
<view class="bacf radius20 mar-s20 disjbac pad-sx27-zy20">
<view class="bold">配送方式</view>
<view class="fon26 col3 disac">
<view @tap="expressEv(1)" :class="!isExpress?'activeT':'expressT'" :style="{background:isExpress?'':publicColor}">自提</view>
<view v-if="!isVirtual" @tap="expressEv(0)" :class="isExpress?'activeT':'expressT'" :style="{background:isExpress?publicColor:''}"></view>
</view>
</view>
<!-- 地址信息 -->
<view v-if="isExpress" class="bacf radius20 mar-s20 pad-sx27-zy20">
<view class="bold">收件人信息</view>
<navigator url="/pagesA/myAddress/myAddress?isWhere=0" hover-class="none">
<view class="fon26 col3 disjbac pad-s50">
<view v-if="addressInfo!=''">
<view class="fon28 col3 bold mar-x20">{{addressInfo.name}} <span class="mar-z20">{{userPphone}}</span></view>
<view class="fon24 col9">{{addressInfo.province_str}}{{addressInfo.city_str}}{{addressInfo.county_str || ''}}{{addressInfo.address || ''}}</view>
</view>
<view v-else class="fon24 col9">请完善收件人信息</view>
<image src="/static/public/nextM.png" class="xiaDan-next" mode="aspectFill"></image>
</view>
</navigator>
</view>
<!-- 自提地址 -->
<view v-else class="bacf radius20 mar-s20 pad-sx27-zy20">
<view class="bold">自提地址</view>
<input type="number" maxlength="11" :focus="isFocus" @blur="blurEv" v-model="zPhone" class="mar-s50 mar-x20" style="border: 2rpx solid #E0E0E0;padding: 20rpx;border-radius: 10rpx;font-size: 24rpx;" placeholder="请输入收货人手机号" />
<view class="fon26 col3 disjbac">
<view>
<view class="fon28 col3 bold mar-x20">恒美植发</view>
<view class="fon24 col9">{{goAddress}}</view>
</view>
<!-- 立即导航 -->
<image @tap="goThere(goAddress)" src="/static/public/daoh.png" class="there" mode="aspectFill"></image>
</view>
</view>
<!-- 订单信息 -->
<view class="bacf radius20 mar-s20 pad-sx27-zy20">
<view class="bold">订单信息</view>
<view v-for="(item,index) in orderList" :key="index" class="fon26 col3 disjbac pad-sx50 disjbac bbot">
<image lazy-load @tap="goShopDetail(item.id)" :src="item.imgSrc" class="flexs order-image" mode="aspectFill"></image>
<view class="width100 disjb fw" style="height: 166rpx;">
<view>
<view @tap="goShopDetail(item.id)" class="fon28 col3 bold clips2">{{item.title}}</view>
<view class="order-sy">{{item.sku_name}}</view>
</view>
<view class="disjbac mar-s10 width100">
<view class="order-item-price" v-if="isNei!=3">{{item.price}}</view>
<view class="order-item-price" v-else>{{item.price}}</view>
<view class="fon28 col6">x{{item.num}}</view>
</view>
</view>
</view>
<view class="fon28 disjbac mar-s20 pad-s10">
<view class="col6">{{allNum}}</view>
<view class="bold colf8" v-if="isNei!=3">{{zanAllPrice}}</view>
<view class="bold colf8" v-else>{{allPrice}}</view>
</view>
</view>
<!-- 选择支付方式 -->
<view class="bacf radius20 mar-s20 fon28 col3 pad-sx30 pad-zy20">
<view class="bold fon28">选择支付方式</view>
<view @tap="chooseFS(index)" v-for="(item,index) in payFS" :key="index" v-if="isCurrent!=index" class="disjbac mar-s30">
<view class="disac">
<image v-if="item.isActive" src="/static/public/chooseFS.png" class="chooseDX" mode=""></image>
<image v-else src="/static/public/cancle-FS.png" class="chooseDX" mode=""></image>
<view class="mar-z25">{{item.title}}</view>
</view>
<view v-if="item.num!=0">{{item.num}}</view>
</view>
</view>
<!-- 优惠 -->
<view v-if="isNei!=3" class="bacf radius20 mar-s20 pad-sx27-zy20">
<view class="bold">优惠</view>
<view @tap="quanEv(1)" class="fon28 col3 disjbac mar-sx40">
<view>优惠券</view>
<view class="disac">
<view class="colf8 bold">-{{youQuan.youPrice}}</view>
<image src="/static/public/nextM.png" class="xiaDan-next" mode="aspectFill"></image>
</view>
</view>
</view>
<!-- 快递费用 -->
<view v-if="isExpress" class="bacf radius20 mar-s20 disjbac pad-sx27-zy20">
<view class="bold">快递费用</view>
<view class="fon28 colf8 bold">{{expressInfo.default_price}}</view>
</view>
<view class="disjbac posixzy bacf pad-zy32" style="height: 124rpx;line-height: 124rpx;">
<!-- 去支付 -->
<view class="fon36 colf8 bold" v-if="isNei!=3">{{allPrice<0?0:allPrice}}<span v-if="isKq">+{{zf_kqPrice}}</span><span v-if="isExpress && expressInfo.default_price!=0" style="font-size: 24rpx;color: #000;">+ {{expressInfo.default_price}}</span></view>
<view class="fon40 colf8 bold dis" v-else><span class="col3 fon28">合计积分</span>{{allPrice}}<span v-if="isExpress && expressInfo.default_price!=0">+ {{expressInfo.default_price}}</span></view>
<view @tap="goPayment" v-if="isNei!=3" class="goPayment"></view>
<view @tap="isDui=true" v-else class="goPayment">去兑换</view>
</view>
</view>
<view v-if="showQuan" @tap.stop="showQuan=false" class="posAll">
<view class="bacf posixzy" style="border-radius: 40rpx 40rpx 0rpx 0rpx;" @tap.stop="showQuan=true">
<view class="pad-sx20 pad-zy50">
<view class="disjbac">
<view class="fon28 bold col3">可用优惠券({{quanList.length}})</view>
<image @tap.stop="showQuan=false" src="/static/public/cha-close.png" style="width: 30rpx;height: 30rpx;" mode="aspectFill"></image>
</view>
<!-- <view class="fon28 bold col3 disja pad-s50" style="padding-bottom: 16rpx;">
<view class="posir" :class="switchQuan?'activeQuan':''" @tap="switchQuan=true">(1)</view>
<view class="posir" :class="!switchQuan?'activeQuan':''" @tap="switchQuan=false">(0)</view>
</view> -->
<scroll-view scroll-y class="mar-s40 quan-list-box">
<view @tap.stop="chooseQuan(index)" v-for="(item,index) in quanList" :key="index" class="mar-x40">
<view class="disjbac quan-item-box">
<view class="posir">
<image class="posia" src="/static/public/quan-left.png" mode=""></image>
<view class="posir" style="z-index: 1;">
<view class="pad-s40 pad-x30 fon28"><span class="bold fon56">{{item.youPrice}}</span></view>
<view class="fon24" style="padding-left: 12rpx;">{{item.manPrice}}元可使用</view>
</view>
</view>
<view>
<!-- <view class="fon28 col3 mar-s20">{{['黄金','白银'][item.isGrade]}}会员专属优惠券</view> -->
<view class="fon28 col3 mar-s20">{{item.name}}</view>
<view>
<image v-if="item.isStatus" src="/static/public/chooseQuan.png"></image>
<image v-else src="/static/public/cancleQuan.png"></image>
</view>
<view class="fon20 col3 mar-x20">有效期{{item.startTime.slice(0,10)}}{{item.endTime.slice(0,10)}}</view>
</view>
</view>
</view>
</scroll-view>
<!-- 领取优惠券按钮 -->
<view @tap.stop="goCoupon" class="ling-btn">领取优惠券</view>
</view>
</view>
</view>
<!-- 确认兑换弹框 -->
<view v-if="isDui" @tap.stop="isDui=false" class="posAll zhun-dui-box">
<view class="bacf radius20 width100 tc fon28 col3 pad20" @tap.stop="isDui=true">
<view class="bold" style="margin: 0rpx 0 56rpx 0;">兑换商品</view>
<view style="margin: 0rpx 0 66rpx 0;">您确定使用{{allPrice}}积分兑换吗</view>
<view class="disjbac mar-x20 pad-zy20 zhun-dui-btn">
<view @tap.stop="isDui=false">暂不兑换</view>
<view @tap.stop="goPayment">立即兑换</view>
</view>
</view>
</view>
<!-- 支付成功 -->
<view v-if="isSuccess" class="posAll" :style="{top:statusHeight+'px'}" style="z-index: 3;background-color: #F5F5F5;">
<view class="bacf radius20 mar-s20 mar-zy20 success-box">
<image src="/static/public/pay-success.png" mode=""></image>
<view class="fon28 col3 pad-s20 pad-x40">支付成功</view>
<view class="success-hj"><span v-if="isNei!=3">{{jsPrice<0?0:jsPrice}}</span><span v-else>{{jsPrice}}</span></view>
<view class="disja success-btn">
<view @tap="goDetail"></view>
<view @tap="goShop" class="colf" :style="{background:publicColor}">再逛一逛</view>
</view>
</view>
</view>
<!-- 分享弹框 -->
<view v-if="isfen" class="posAll disjcac" style="background-color: rgba(0,0,0,.25);z-index: 8;">
<view class="bacf width100 radius20 posir" style="padding: 60rpx 50rpx;margin: 0 70rpx;text-align: center;">
<image @tap="isfen=false" src="../../static/public/closequan.png" class="posia heyan-close" mode=""></image>
<view style="color: #f55255;font-size: 36rpx;">立即完成拼单?</view>
<view style="margin: 50rpx 0;font-size: 26rpx;">点击下方分享给朋友完成拼单</view>
<view class="posir radius15 disjcac pad-sx20" style="background-color: #22cc3e;color: #FFFFFF;font-size: 36rpx;">
分享给朋友
<button open-type="share" class="posia-op">分享给朋友</button>
</view>
</view>
</view>
<!-- 用户信息授权手机号授权 -->
<auth-userInfo-mobileInfo></auth-userInfo-mobileInfo>
</view>
</template>
<script>
export default {
data() {
return {
isExpress:false,
switchQuan:true,
showQuan:false,//
isDui:false,
orderList:uni.getStorageSync('orderList'),
quanList:[],
goAddress:'四川省成都市青羊区青羊大道213号',
youQuan:{
id:0,
youPrice:0
},//
allPrice:0,//
allNum:0,//
zanAllPrice:0,//
isNei:0,
expressInfo:{},//
addressInfo:'',//
userPphone:'请完善信息',
zPhone:'',//
page:1,
size:10,
isFocus:false,
loading:false,
zf_allPrice:0,//
zf_kqPrice:0,//
payFS:[
{title:'微信支付',isActive:true,num:0},
{title:'孔雀币',isActive:false,num:100},
{title:'积分',isActive:false,num:100},
],
isKq:false,
jsPrice:0,//,
zc_allPrice:0,//
coin_price:0,//
isSuccess:false,//
ntype:'money',//money coin
times:0,//
isCurrent:2,
isfen:false,
checkGrounpId:0,
expressInfo:{
default_price:0
},
isVirtual:false,//
payType:''// wechat=;coin=;hybrid=
}
},
computed: {
//
publicColor() {
return this.$store.state.publicColor
},
statusHeight() {
return this.$store.state.statusHeight
}
},
onShareAppMessage(res) {
var shareObj = {
     title: this.orderList[0].title, // (slogan)
     path: `/pagesB/shopDetail/shopDetail?id=${this.orderList[0].id}&category_id=0&is_activity=${this.orderList[0].is_activity}&share_id=${uni.getStorageSync('userId')}&invite_code=${uni.getStorageSync('invite_code')}`, // /
     imageUrl: this.orderList[0].imgSrc//PNGJPG imageUrl 使 5:4
  };
  return shareObj;
//   return false;
},
onShow() {
//
this.$toolAll.tools.disableShareEv();
this.checkChoose();//
uni.removeStorageSync('orderInfo');
},
onLoad(options) {
// wechat=;coin=;hybrid=
this.payType = uni.getStorageSync('payType');
// this.payType = 'coin';
if(this.payType=='wechat') {
this.payFS = [{title:'微信支付',isActive:true,num:0}]
} else if(this.payType=='coin'){
this.payFS = [{title:'孔雀币',isActive:true,num:0}]
} else if(this.payType=='hybrid'){
this.payFS = [
{title:'微信支付',isActive:true,num:0},
{title:'孔雀币',isActive:false,num:0}
]
}
//
this.zPhone = uni.getStorageSync('phone');
//
options.isVirtual == "virtual" ? this.isVirtual = true : this.isVirtual = false
this.checkexpress();//
this.checkeList(options.isNei);//
this.checkOrderDetail();//
this.isNei = options.isNei;
if(this.isNei==3) {
this.payFS[0].isActive = false;
this.payFS[2].isActive = true;
this.isCurrent = 1;
}
},
methods: {
checkChoose(){
if(uni.getStorageSync('chooseAddress')==''){
this.checkAddress();//
} else {
let naddress = uni.getStorageSync('chooseAddress');
this.addressInfo = {
id:naddress.id,
name:naddress.userName,
phone:naddress.userPhone,
province_str:naddress.province,
city_str:naddress.city,
county_str:naddress.county,
address:naddress.address
}
this.userPphone = this.$toolAll.tools.hideMPhone(naddress.userPhone);
}
},
obtainCoin(coinNum){//
this.$requst.post('user/get-coin-price',{amount:coinNum,get_type:this.ntype}).then(res=>{
if(res.code==0){
if(this.ntype=='money'){
this.coin_price = res.data.amount/100;
if(this.payType=='coin'){
//
if(this.zanAllPrice - this.coin_price<=0){//
this.allPrice = 0;
this.zf_kqPrice = this.zanAllPrice*1;
} else {//
this.allPrice = (this.$toolAll.tools.addXiaoShu(this.zanAllPrice - this.coin_price)*1).toFixed(2);
this.zf_kqPrice = this.coin_price;
}
this.isKq = true;
}
} else {
this.zf_kqPrice = res.data.amount;
this.isKq = true;
}
}
})
},
goShopDetail(id){
uni.navigateTo({
url:`/pagesB/shopDetail/shopDetail?id=${id}`
})
},
chooseFS(index){
this.payFS[index].isActive = !this.payFS[index].isActive;
if(this.isNei==3){//
if(!this.payFS[0].isActive && !this.payFS[2].isActive){
this.$toolAll.tools.showToast('请选择支付方式');
this.allPrice = this.zanAllPrice;
this.isKq = false;
return;
}
} else {//
if(this.payType!='coin'){
if(!this.payFS[0].isActive && !this.payFS[1].isActive){
this.$toolAll.tools.showToast('请选择支付方式')
this.allPrice = this.zanAllPrice;
this.isKq = false;
this.zf_kqPrice = this.payFS[1].num;
return;
}
}
}
if(this.payFS[index].title=='微信支付'){
if(this.isNei!=3){
//+
if(this.payFS[0].isActive && this.payFS[1].isActive){
if(this.zanAllPrice - this.coin_price >=0){//
this.allPrice = this.$toolAll.tools.addXiaoShu(this.zanAllPrice - this.coin_price);
this.zf_kqPrice = this.payFS[1].num;
} else {//
this.allPrice = 0;
this.ntype = 'coin';
this.obtainCoin(this.zanAllPrice*100);
}
return;
}
//+
if(!this.payFS[0].isActive && this.payFS[1].isActive){
if(this.zanAllPrice - this.coin_price>0){
this.$toolAll.tools.showToast('孔雀币不足');
}
return;
}
//+
if(this.payFS[0].isActive && !this.payFS[1].isActive){
this.isKq = false;
this.zf_kqPrice = 0;
return;
}
} else {
if(this.expressInfo.default_price==0){
this.$toolAll.tools.showToast('暂不可微信支付');
this.payFS[index].isActive = false;
}
}
}
if(this.payFS[index].title=='孔雀币') {
if(this.payType!='coin'){
if(this.youQuan.youPrice!=0){
this.payFS[1].isActive = false;
this.$toolAll.tools.showToast('无法使用孔雀币支付');
} else {
if(this.coin_price!=0){
//+
if(this.payFS[0].isActive && this.payFS[1].isActive) {
if(this.zanAllPrice - this.coin_price<=0){//
this.ntype = 'coin';
this.obtainCoin(this.zanAllPrice*100);
this.allPrice = 0;
} else {//
this.allPrice = (this.$toolAll.tools.addXiaoShu(this.zanAllPrice - this.coin_price)*1).toFixed(2);
this.zf_kqPrice = this.payFS[1].num;
}
this.isKq = true;
return;
}
//+
if(this.payFS[0].isActive && !this.payFS[1].isActive) {
this.isKq = false;
this.zf_kqPrice = 0;
// 0
if(this.youQuan.youPrice==0){
this.allPrice = (this.$toolAll.tools.addXiaoShu(this.zanAllPrice)*1).toFixed(2);
} else {
this.allPrice = (this.$toolAll.tools.addXiaoShu(this.zanAllPrice - this.youQuan.youPrice)*1).toFixed(2);
}
return;
}
//+
if(!this.payFS[0].isActive && this.payFS[1].isActive){
if(this.zanAllPrice - this.coin_price<=0){//
this.ntype = 'coin'
this.obtainCoin(this.allPrice*100);
this.allPrice = 0;
}
if(this.zanAllPrice - this.coin_price>0){//
this.$toolAll.tools.showToast('孔雀币不足')
this.allPrice = (this.$toolAll.tools.addXiaoShu(this.zanAllPrice - this.coin_price)*1).toFixed(2);
this.zf_kqPrice = this.payFS[1].num;
}
return;
}
//+
if(!this.payFS[0].isActive && !this.payFS[1].isActive){
this.isKq = false;
this.allPrice = (this.$toolAll.tools.addXiaoShu(this.zanAllPrice)*1).toFixed(2);
return;
}
} else {
this.$toolAll.tools.showToast('暂无可用孔雀币');
this.payFS[index].isActive = false;
}
}
} else {
if(!this.payFS[index].isActive) {
this.isKq = false;
this.zf_kqPrice = 0;
this.allPrice = this.zanAllPrice;
} else {
//
if(this.zanAllPrice - this.coin_price<=0){//
this.ntype = 'coin';
this.obtainCoin(this.zanAllPrice*100);
this.allPrice = 0;
} else {//
this.allPrice = (this.$toolAll.tools.addXiaoShu(this.zanAllPrice - this.coin_price)*1).toFixed(2);
this.zf_kqPrice = this.payFS[0].num;
}
}
}
}
},
goPayment(){//
this.isFocus = false;
this.isDui = false;
let nphone = '';
if(this.isExpress) {
nphone = this.addressInfo.phone;//
} else nphone = this.zPhone;//
let self = 0;//
if(!this.isExpress) self = 1;//
let nsku_list = [];
let is_only = 0;
this.orderList.forEach(item=>{
let obj = {
sku_coding:item.coding,
num:item.num,
group_id:item.pin_user_id
}
nsku_list.push(obj);
is_only = item.is_only;
})
let is_score = 0;
if(this.isNei == 3) {is_score = 1}
if(this.zf_kqPrice!=0) {
this.jsPrice = `${this.allPrice} +${this.zf_kqPrice}孔雀币`;
} else {
this.jsPrice = this.allPrice;
}
let parmas = {
sku_list: nsku_list,//
total: this.allPrice*100,//
address_id: this.addressInfo.id || 0,//ID
express_code: this.expressInfo.code || 0,//
coupon_id: this.youQuan.id,//ID
coupon_price: this.youQuan.youPrice*100,//
pick_self: self,//0 1
pick_self_phone: nphone,//
original_total: this.zanAllPrice*100,//
freight: this.expressInfo.default_price || 0,//
remarks: "",//
is_only:is_only,//0 12
is_score:is_score,//0 1
coin:this.zf_kqPrice//
}
if(this.addressInfo=='' && self!=1){
this.$toolAll.tools.showToast('请完善收件人信息');
} else if(nphone=='') {
this.$toolAll.tools.showToast('请填写收货人手机号');
this.focusEv();
} else if(this.$toolAll.tools.isPhone(nphone)) {
this.$toolAll.tools.showToast('请正确填写收货人手机号');
this.focusEv();
} else if(this.isNei == 3 && !this.payFS[2].isActive){//
this.$toolAll.tools.showToast('请选择积分付款方式');
} else if(this.isNei == 3 && this.expressInfo.default_price!=0 && this.expressInfo.default_price!=undefined && !this.payFS[0].isActive){//
this.$toolAll.tools.showToast('请添加微信支付方式');
} else if(this.isNei != 3 && !this.payFS[0].isActive && !this.payFS[1].isActive){
this.$toolAll.tools.showToast('请选择支付方式')
} else if(this.payType=='coin' && this.allPrice*1 > this.coin_price*1){
this.$toolAll.tools.showToast('孔雀币不足');
} else if(this.payType=='hybrid' && this.isNei != 3 && !this.payFS[0].isActive && this.allPrice*1 > this.coin_price*1){
this.$toolAll.tools.showToast('孔雀币不足');
} else {
if(this.times==0){
this.times++;
if(this.allPrice==0){
this.$toolAll.tools.showToast('正在支付','loading',1500);
} else {
this.$toolAll.tools.showToast('正在调起支付','loading',1500);
}
uni.request({
url:`${uni.getStorageSync('hostapi')}order/create`,
data:parmas,
method:'post',
header:{
'Content-Type': 'application/json; charset=UTF-8',
'Authorization': 'Bearer '+uni.getStorageSync('token') || ''
},
success: (res) => {
if(res.data.code==0){
this.times = 0;
this.payment(res.data.data);
// uni.setStorageSync('orderList',this.orderList);
// uni.setStorageSync('orderInfo',res.data.data);
// uni.navigateTo({
// url:`/pagesA/immediatePayment/immediatePayment?allPrice=${this.allPrice}&allNum=${this.allNum}&startTime=${new Date(res.header.Date).getTime()}`
// })
} else {
this.$toolAll.tools.showToast(res.data.msg,'none',3000);
this.times = 0;
}
}
})
}
}
},
payment(info){
if(info.needPay){
uni.requestPayment({
provider: 'wxpay',
appId:info.payment_params.appId,//appId
timeStamp: info.payment_params.timeStamp,//
nonceStr: info.payment_params.nonceStr,//
package: info.payment_params.package,//package
signType: info.payment_params.signType,//MD5
paySign: info.payment_params.sign,//
success:(res)=> {
this.$requst.post('order/paid',{order_coding:info.coding}).then(res=>{
if(res.code==0){
this.suseeceEv(info.coding);
} else this.$toolAll.tools.showToast(res.msg);
})
},
fail:()=> {
this.$toolAll.tools.showToast('取消支付');
setTimeout(()=>{
uni.navigateTo({
url:'/pagesA/myOrder/myOrder'
})
},2000)
}
});
} else {
this.$requst.post('order/paid',{order_coding:info.coding}).then(res=>{
if(res.code==0){
this.suseeceEv(info.coding);
} else this.$toolAll.tools.showToast(res.msg);
})
}
},
suseeceEv(coding){
uni.removeStorageSync('chooseAddress')
this.isSuccess = true;
if(this.orderList[0].cateNum==1 && this.orderList.pin_user_id!=0){
this.isfen = true;
this.$requst.post('order/get-group-id',{order_coding:coding}).then(res=>{
if(res.code==0){
this.checkGrounpId = res.data.group_id;
}
})
}
},
goThere(val){//
wx.getLocation({//
type: 'wgs84', //wx.openLocationbug: iOS 6.3.30 type wgs84
success: function (res) {
wx.openLocation({//使
latitude: 30.67554,//-
longitude: 104.010642,//-
name: val,
address: val
})
}
})
},
checkAddress(){//
this.$requst.post('user/address').then(res=>{
if(res.code==0){
if(res.data.length!=0){
res.data.forEach(item=>{
if(item.is_default==1) {
this.addressInfo = item;
} else {
if(res.data.length==1){
this.addressInfo = item;
}
}
})
this.userPphone = this.$toolAll.tools.hideMPhone(this.addressInfo.phone);
}
}
})
},
checkexpress(){//
if(this.isExpress) {
this.$requst.post('common/express-list').then(res=>{
if(res.code==0){
if(res.data.length!=0){
res.data.forEach(item=>{
if(item.is_default==1){
this.expressInfo = item;
this.expressInfo.default_price = this.expressInfo.default_price/100;
}
})
this.totalEv();
}
}
})
}
},
expressEv(index){//
if(index==0) {
this.isExpress = true;
this.checkexpress();
if(this.addressInfo==''){this.$toolAll.tools.showToast('请完善收件人信息','none',1500);}
}
if(index==1) {
this.isExpress = false;
this.expressInfo.default_price = 0;
}
},
totalEv(){//
if(this.isNei!=3) {
//
this.allPrice = this.zanAllPrice - this.youQuan.youPrice;
if(this.payType=='coin'){
this.obtainCoin(this.payFS[0].num);
}
} else {
//
this.allPrice = this.zanAllPrice;
}
this.loading = true;
},
checkOrderDetail(){//
let nsku_list = [];
this.orderList.forEach(item=>{
let obj = {
sku_coding:item.coding,
num:item.num
}
nsku_list.push(obj)
})
let parmas = {
sku_list: nsku_list,
pick_self: 0
}
this.$requst.post('order/prepare-info',parmas).then(res=>{
if(res.code==0){
this.obtainCoin(res.data.account.coin);
if(this.payType=='coin'){
this.payFS[0].num = res.data.account.coin;
} else if(this.payType=='wechat'){
} else if(this.payType=='hybrid'){
this.payFS[1].num = res.data.account.coin;
if(res.data.account.coin==0) {
this.payFS[1].isActive = false;
} else {
setTimeout(()=>{
this.chooseFS(1);
},500)
}
} else {
this.payFS[1].num = res.data.account.coin;
this.payFS[2].num = res.data.account.score;
}
} else this.$toolAll.tools.showToast(res.msg);
})
},
checkeList(isJfen){
this.allPrice = this.allPrice*1;
this.orderList.forEach(item=>{
this.allPrice += item.price*item.num;
this.allNum += item.num;
})
if(isJfen==3){//
this.zanAllPrice = this.allPrice;
} else {
this.zanAllPrice = this.$toolAll.tools.addXiaoShu(this.allPrice);
}
this.quanEv(0);//
this.totalEv();
},
quanEv(index){//
if(this.payType!='coin' && this.payType!='wechat'){
if(this.payFS[1].isActive){
// this.$toolAll.tools.showToast('使');
// this.allPrice = this.$toolAll.tools.addXiaoShu(this.zanAllPrice*1 + this.expressInfo.default_price*1);
} else {
if(index==1){
this.showQuan = true
}
this.youQuan.id = 0;
this.youQuan.youPrice = 0;
this.allPrice = (this.zanAllPrice*1 - this.expressInfo.default_price*1).toFixed(2);
this.checkQuan();//
}
}
},
checkQuan(){//
this.$requst.post('user/get-coupon-list',{status:'normal',page:this.page,size:this.size}).then(res=>{
if(res.code==0){
this.quanList = [];
if(res.data.length!=0){
res.data.forEach(item=>{
if(item.type!='taste'){//
let obj = {
id:item.id,
youPrice:item.amount/100,
manPrice:item.condition/100,
isGrade:0,
name:item.name,
startTime:item.begin_at,
endTime:item.end_at,
isStatus:false
}
this.quanList.push(obj);
}
})
}
}
})
},
chooseQuan(index){//
if(this.zanAllPrice <= this.quanList[index].manPrice){//
this.$toolAll.tools.showToast('未达到使用条件')
} else {
if(this.allPrice==0){
this.$toolAll.tools.showToast('此订单费用为 0');
// this.$requst.post('user/get-coin-price',{amount:this.quanList[index].youPrice,get_type:'coin'}).then(res=>{
// if(res.code==0){
// this.zf_kqPrice = this.zf_kqPrice - res.data.amount;
// this.showQuan = false;
// }
// })
} else {
this.quanList.forEach(item=>{
item.isStatus = false;
});
this.quanList[index].isStatus = true;
this.showQuan = false;
this.quanList[index].youPrice = this.$toolAll.tools.addXiaoShu(this.quanList[index].youPrice);
this.youQuan = this.quanList[index];
this.allPrice = this.zanAllPrice*1 - this.quanList[index].youPrice*1 + this.expressInfo.default_price*1;// = -
this.allPrice = this.allPrice.toFixed(2)*1;
}
}
},
goCoupon(){//
this.showQuan = false;
uni.navigateTo({
url:'/pagesA/coupon/coupon'
})
},
focusEv(){//
this.isFocus = true;
},
blurEv(){//
this.isFocus = false;
},
goDetail(){//
uni.navigateTo({
url:'/pagesA/myOrder/myOrder'
})
},
goShop(){//
let nurl = '';
if(this.isNei==3) nurl = '/pagesA/pointsMall/pointsMall';
else nurl = '/pages/tabbar/shop/shop';
uni.reLaunch({
url:nurl
})
}
}
}
</script>
<style>
page {
background-color: #F5F5F5;
}
</style>

View File

@ -49,6 +49,7 @@
<view class="fon28 col3"> <view class="fon28 col3">
<view class="mar-sx20 disjbac"> <view class="mar-sx20 disjbac">
<view> <view>
<view class="" v-if="item.group">
<!-- <view v-if="item.is_only==0 && item.open_one==1 && item.is_group_make==1 && item.open_one_success==0" class="posir disjcac flexs" style="color: #010101;font-size: 24rpx;"> --> <!-- <view v-if="item.is_only==0 && item.open_one==1 && item.is_group_make==1 && item.open_one_success==0" class="posir disjcac flexs" style="color: #010101;font-size: 24rpx;"> -->
<view v-if="item.is_only==0 && item.group.surplus > 0" class="posir disjcac flexs" style="color: #010101;font-size: 24rpx;"> <view v-if="item.is_only==0 && item.group.surplus > 0" class="posir disjcac flexs" style="color: #010101;font-size: 24rpx;">
<image src="../../static/public/weix.png" mode="" class="flexs" style="width: 50rpx;height: 50rpx;"></image> <image src="../../static/public/weix.png" mode="" class="flexs" style="width: 50rpx;height: 50rpx;"></image>
@ -61,15 +62,18 @@
class="posia-op">分享给朋友</button> class="posia-op">分享给朋友</button>
</view> </view>
</view> </view>
</view>
<view> <view>
<span v-if="item.isShop==0"><span v-if="item.is_only!=1">{{item.total}}</span><span v-if="item.is_only==1">{{item.total}}</span> <span v-if="item.coin!=0">+{{item.coin}}</span></span><span v-else>{{item.total}}</span> <span v-if="item.isShop==0"><span v-if="item.is_only!=1">{{item.total}}</span><span v-if="item.is_only==1">{{item.total}}</span> <span v-if="item.coin!=0">+{{item.coin}}</span></span><span v-else>{{item.total}}</span>
</view> </view>
</view> </view>
<view class="disjbac"> <view class="disjbac">
<view class="width100 disje"> <view class="width100 disje">
<view class="" v-if="item.group">
<view v-if="item.group.surplus > 0"> <view v-if="item.group.surplus > 0">
<view @tap="comeing(item.orderNum)" v-if="item.is_only==0 && item.open_one==1 && item.is_group_make==1 && item.open_one_success==0" class="order-btn mar-y20"></view> <view @tap="comeing(item.orderNum)" v-if="item.is_only==0 && item.open_one==1 && item.is_group_make==1 && item.open_one_success==0" class="order-btn mar-y20"></view>
</view> </view>
</view>
<view @tap="transferFrame(index)" v-if="item.orderStatus != 0 && item.orderStatus != 5 && item.virtual_check==0 && item.orderStatus!=5" class="order-cancle"></view> <view @tap="transferFrame(index)" v-if="item.orderStatus != 0 && item.orderStatus != 5 && item.virtual_check==0 && item.orderStatus!=5" class="order-cancle"></view>
<view @tap="payMentEv(index)" v-if="item.orderStatus == 1" class="order-btn"></view> <view @tap="payMentEv(index)" v-if="item.orderStatus == 1" class="order-btn"></view>
<!-- <view class="order-btn" v-if="item.is_only==1"></view> --> <!-- <view class="order-btn" v-if="item.is_only==1"></view> -->
@ -333,7 +337,7 @@
is_group_make:item.is_group_make, is_group_make:item.is_group_make,
group_make_end_at:item.group_make_end_at, group_make_end_at:item.group_make_end_at,
group_id:item.group_id, group_id:item.group_id,
status_text:item.group.surplus > 0 ? '待拼成' : item.status_text,// status_text:item.group ? item.group.surplus > 0 ? '待拼成' : item.status_text : item.status_text,//
group:item.group// group:item.group//
} }
this.zanArr.push(obj); this.zanArr.push(obj);

View File

@ -250,7 +250,8 @@
} else { } else {
uni.setStorageSync('payType',0); uni.setStorageSync('payType',0);
uni.navigateTo({ uni.navigateTo({
url:`/pagesA/getReadyDan/getReadyDan?isNei=${isNei}` // url:`/pagesA/getReadyDan/getReadyDan?isNei=${isNei}`
url:`/pagesA/getReadyDan/getReadyDan-two?isNei=${isNei}`
}) })
} }
} else { } else {

View File

@ -112,7 +112,6 @@
this.category_id = options.category_id this.category_id = options.category_id
if(uni.getStorageSync('phone_active')!=0 && uni.getStorageSync('is_active')!=0){ if(uni.getStorageSync('phone_active')!=0 && uni.getStorageSync('is_active')!=0){
this.checkDetail(options.id); this.checkDetail(options.id);
this.checkAbout(this.category_id);
this.$requst.get('index/base-config').then(res=>{ this.$requst.get('index/base-config').then(res=>{
this.headImg = this.$http + res.data.logo; this.headImg = this.$http + res.data.logo;
this.name = res.data.logo_title; this.name = res.data.logo_title;
@ -204,6 +203,7 @@
uni.hideToast() uni.hideToast()
this.isLoading = true this.isLoading = true
} }
this.checkAbout(this.category_id);
},error=>{}) },error=>{})
} }
} }

View File

@ -581,7 +581,8 @@
uni.setStorageSync('payType',this.detailObj.pay_type); uni.setStorageSync('payType',this.detailObj.pay_type);
} else {uni.setStorageSync('payType','')} } else {uni.setStorageSync('payType','')}
uni.navigateTo({ uni.navigateTo({
url:`/pagesA/getReadyDan/getReadyDan?isNei=${this.isNei}&isVirtual=${this.detailObj.spu_type}` // url:`/pagesA/getReadyDan/getReadyDan?isNei=${this.isNei}&isVirtual=${this.detailObj.spu_type}`
url:`/pagesA/getReadyDan/getReadyDan-two?isNei=${this.isNei}&isVirtual=${this.detailObj.spu_type}`
}) })
}, },
addCart(){// addCart(){//

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long