926 lines
28 KiB
Vue
926 lines
28 KiB
Vue
<template>
|
||
<view class="order-submission" style="padding: 30rpx;">
|
||
<view class="allAddress" style="background-color: #f6f6f6;">
|
||
<!-- <view class="nav acea-row">
|
||
<view
|
||
class="item font-color-red"
|
||
:class="shipping_type === 0 ? 'on' : 'on2'"
|
||
@click="addressType(0)"
|
||
v-if="systemStore"
|
||
></view>
|
||
<view
|
||
class="item font-color-red"
|
||
:class="shipping_type === 1 ? 'on' : 'on2'"
|
||
@click="addressType(1)"
|
||
v-if="storeSelfMention"
|
||
></view>
|
||
</view> -->
|
||
|
||
<!-- <view class="acea-row" style="padding-left: 28rpx;">
|
||
<view v-if="systemStore" class="item" style="position: relative;" @click="addressType(0)">
|
||
<text :class="shipping_type === 0 ? 'on' :''" class="goods-detail-title">送货上门</text>
|
||
<text v-if="shipping_type === 0" class="pink-dot"></text>
|
||
</view>
|
||
<view v-if="storeSelfMention" class="item" style="position: relative;margin-left: 40rpx;" @click="addressType(1)">
|
||
<text :class="shipping_type === 1 ? 'on' :''" class="goods-detail-title">到店自取</text>
|
||
<text v-if="shipping_type === 1" class="pink-dot"></text>
|
||
</view>
|
||
</view> -->
|
||
|
||
<view
|
||
class="address acea-row row-middle"
|
||
style="flex-wrap: nowrap;margin: 0 0 30rpx 0;border-radius: 16rpx;"
|
||
v-if="shipping_type === 0"
|
||
@click="addressTap"
|
||
>
|
||
<image style="flex-shrink: 0;width: 48rpx;height: 48rpx;margin-right: 20rpx;"
|
||
:src="webUrl+'/20230304135530688212.png'" mode=""></image>
|
||
<view class="acea-row row-between-wrapper" style="flex-wrap: nowrap;flex-grow: 1;">
|
||
<view class="addressCon" v-if="addressInfo.realName">
|
||
<view class="name">
|
||
{{ addressInfo.realName }}
|
||
<text class="phone">{{ addressInfo.phone }}</text>
|
||
</view>
|
||
<view>
|
||
<!-- <text class="default font-color-lightred" v-if="addressInfo.isDefault">[默认]</text> -->
|
||
{{ addressInfo.province }}{{ addressInfo.city }}{{ addressInfo.district }}{{ addressInfo.detail }}
|
||
</view>
|
||
</view>
|
||
<view class="addressCon" v-else>
|
||
<view class="setaddress">设置收货地址</view>
|
||
</view>
|
||
<view class="iconfont icon-jiantou" style="flex-shrink: 0;"></view>
|
||
</view>
|
||
</view>
|
||
<div style="flex-wrap: nowrap;" class="address acea-row row-middle" v-else @click="showStoreList">
|
||
|
||
<image style="flex-shrink: 0;width: 48rpx;height: 48rpx;margin-right: 20rpx;"
|
||
:src="webUrl+'/20230304135530688212.png'" mode=""></image>
|
||
<view class="acea-row row-between-wrapper" style="flex-wrap: nowrap;flex-grow: 1;">
|
||
<div class="addressCon">
|
||
<div class="name">
|
||
{{ isNullOrEmpty(storeItems) ? systemStore.name : storeItems.name }}
|
||
<span
|
||
class="phone"
|
||
>{{ isNullOrEmpty(storeItems) ? systemStore.phone : storeItems.phone }}</span>
|
||
</div>
|
||
<div>{{ isNullOrEmpty(storeItems) ? systemStore.address : storeItems.address }}</div>
|
||
</div>
|
||
<div class="iconfont icon-jiantou"></div>
|
||
</view>
|
||
|
||
</div>
|
||
</view>
|
||
|
||
<OrderGoods :evaluate="0" :cartInfo="orderGroupInfo.cartInfo" title="商品列表"></OrderGoods>
|
||
|
||
|
||
<view class="wrapper" style="margin: 30rpx 0;border-radius: 16rpx;">
|
||
|
||
<!-- 优惠券开始 -->
|
||
<!-- <view class="item acea-row row-between-wrapper" @click="couponTap" v-if="deduction === false">
|
||
<view>优惠券</view>
|
||
<view class="discount">
|
||
{{ usableCoupon.couponTitle || "请选择" }}
|
||
<text class="iconfont icon-jiantou"></text>
|
||
</view>
|
||
</view> -->
|
||
<!-- 优惠券结束 -->
|
||
|
||
<!-- 积分抵扣开始 -->
|
||
<!-- <view
|
||
class="item acea-row row-between-wrapper"
|
||
v-if="deduction === false && enableIntegral === true"
|
||
>
|
||
<view>积分抵扣</view>
|
||
<view class="discount">
|
||
<view class="select-btn">
|
||
<view class="checkbox-wrapper">
|
||
<checkbox-group @change="changeUseIntegral">
|
||
<label class="well-check">
|
||
<text class="integral">
|
||
当前积分
|
||
<text class="num font-color-red">{{ userInfo.integral || 0 }}</text>
|
||
</text>
|
||
<checkbox value="true" :checked="useIntegral ? true : false"></checkbox>
|
||
</label>
|
||
</checkbox-group>
|
||
</view>
|
||
</view>
|
||
</view>
|
||
</view> -->
|
||
<!-- 积分抵扣结束 -->
|
||
|
||
<view class="item acea-row row-between-wrapper" style="flex-wrap: nowrap;" v-if="shipping_type === 0">
|
||
<view class="acea-row row-middle" style="flex-wrap: nowrap;">
|
||
<image style="width: 32rpx;height: 32rpx;margin-right: 12rpx;" :src="webUrl+'/20210807230820761721.png'"
|
||
mode=""></image>
|
||
<text class="">快递费用</text>
|
||
</view>
|
||
<!-- <view class="discount">
|
||
{{
|
||
orderGroupInfo.priceGroup.storePostage > 0
|
||
? force2Decimal(orderGroupInfo.priceGroup.storePostage)
|
||
: (orderPrice.payPostage>0?force2Decimal(orderPrice.payPostage):"免运费")
|
||
}}
|
||
</view> -->
|
||
<view class="discount" style="width: auto !important;">
|
||
{{ orderPrice.payPostage > 0 ? force2Decimal(orderPrice.payPostage) : "免运费" }}
|
||
</view>
|
||
</view>
|
||
<view v-else>
|
||
<view class="item acea-row row-between-wrapper">
|
||
<view>联系人</view>
|
||
<view class="discount">
|
||
<input type="text" placeholder="请填写您的联系姓名" v-model="contacts"/>
|
||
</view>
|
||
</view>
|
||
<view class="item acea-row row-between-wrapper">
|
||
<view>联系电话</view>
|
||
<view class="discount">
|
||
<input type="text" placeholder="请填写您的联系电话" v-model="contactsTel"/>
|
||
</view>
|
||
</view>
|
||
</view>
|
||
<view class="item" style="z-index: -1">
|
||
<view class="acea-row row-middle">
|
||
<image style="width: 32rpx;height: 32rpx;margin-right: 12rpx;" :src="webUrl+'/20210807230836494421.png'"
|
||
mode=""></image>
|
||
<text class="">备注信息(150字以内)</text>
|
||
</view>
|
||
<textarea v-model="mark" ></textarea>
|
||
</view>
|
||
</view>
|
||
<view class="wrapper" style="margin: 30rpx 0;border-radius: 16rpx;">
|
||
<view class="item">
|
||
<!-- <view>支付方式</view> -->
|
||
<view class="acea-row row-left row-middle">
|
||
<view class="acea-row row-middle" style="position: relative;">
|
||
<image style="width: 32rpx;height: 32rpx;margin-right: 12rpx;" :src="webUrl+'/20210807230846995104.png'"
|
||
mode=""></image>
|
||
<text class="pay-method-title">支付方式</text>
|
||
<!-- <text class="pink-dot"></text> -->
|
||
</view>
|
||
</view>
|
||
<view class="list">
|
||
<view
|
||
class="payItem acea-row row-middle"
|
||
:class="active === 'weixin' ? 'on' : ''"
|
||
@click="payItem('weixin')"
|
||
v-show="isWeixin"
|
||
style="flex-wrap: nowrap;"
|
||
>
|
||
<view class="name acea-row">
|
||
<view class="iconfont icon-weixin2" :class="active === 'weixin' ? 'bounceIn' : ''"></view>
|
||
微信支付
|
||
</view>
|
||
<view class="tip">微信快捷支付</view>
|
||
<label class="radio">
|
||
<radio style="transform: scale(0.7);" value="" :checked="active === 'weixin'" color="#FF0000"/>
|
||
<text></text>
|
||
</label>
|
||
</view>
|
||
<view
|
||
class="payItem acea-row row-middle"
|
||
:class="active === 'weixin' ? 'on' : ''"
|
||
@click="payItem('weixin')"
|
||
v-show="!isWeixin"
|
||
style="flex-wrap: nowrap;"
|
||
>
|
||
<view class="name acea-row ">
|
||
<view class="iconfont icon-weixin2" :class="active === 'weixin' ? 'bounceIn' : ''"></view>
|
||
微信支付
|
||
</view>
|
||
<view class="tip"></view>
|
||
<label class="radio">
|
||
<radio style="transform: scale(0.7);" value="" :checked="active === 'weixin'" color="#FF0000"/>
|
||
<text></text>
|
||
</label>
|
||
|
||
</view>
|
||
<view
|
||
class="payItem acea-row row-middle"
|
||
:class="active === 'yue' ? 'on' : ''"
|
||
@click="payItem('yue')"
|
||
style="flex-wrap: nowrap;"
|
||
>
|
||
<view class="name acea-row ">
|
||
<view style="background-color: #007AFF;" class="iconfont icon-icon-test"
|
||
:class="active === 'yue' ? 'bounceIn' : ''"></view>
|
||
余额支付
|
||
</view>
|
||
<view class="tip">可用余额:{{ userInfo.nowMoney ? force2Decimal(userInfo.nowMoney) : 0.00 }}</view>
|
||
<label class="radio">
|
||
<radio style="transform: scale(0.7);" value="" :checked="active === 'yue'" color="#FF0000"/>
|
||
<text></text>
|
||
</label>
|
||
|
||
</view>
|
||
</view>
|
||
</view>
|
||
</view>
|
||
<view class="moneyList" style="margin-bottom:30rpx;border-radius: 16rpx;">
|
||
<view class="item acea-row row-between-wrapper" v-if="orderPrice.totalPrice !== undefined">
|
||
<view>商品总价:</view>
|
||
<view class="money">¥{{ force2Decimal(orderPrice.totalPrice) }}</view>
|
||
</view>
|
||
<view class="item acea-row row-between-wrapper" v-if="orderPrice.payPostage > 0">
|
||
<view>运费:</view>
|
||
<view class="money">¥{{ force2Decimal(orderPrice.payPostage) }}</view>
|
||
</view>
|
||
<view class="item acea-row row-between-wrapper" v-if="orderPrice.couponPrice > 0">
|
||
<view>优惠券抵扣:</view>
|
||
<view class="money">-¥{{ force2Decimal(orderPrice.couponPrice) }}</view>
|
||
</view>
|
||
<view class="item acea-row row-between-wrapper" v-if="orderPrice.deductionPrice > 0">
|
||
<view>积分抵扣:</view>
|
||
<view class="money">-¥{{ force2Decimal(orderPrice.deductionPrice) }}</view>
|
||
</view>
|
||
</view>
|
||
<view style="height:80rpx"></view>
|
||
<view class="footer acea-row row-between-wrapper" style="height: 80rpx;">
|
||
<view style="margin-left: 30rpx;">
|
||
<text style="color: #000000;font-size: 24rpx;font-weight: bold;">合计:</text>
|
||
<text class="" style="color: #FF564A;font-size: 28rpx;font-weight: bold;">¥{{
|
||
force2Decimal(orderPrice.payPrice)
|
||
}}
|
||
</text>
|
||
</view>
|
||
<view class="settlement acea-row row-middle row-center" @click="subscribePay">立即结算</view>
|
||
</view>
|
||
<CouponListWindow
|
||
v-on:couponchange="changecoupon($event)"
|
||
v-model="showCoupon"
|
||
:price="orderPrice.totalPrice"
|
||
:checked="usableCoupon.id"
|
||
@checked="changeCoupon"
|
||
:cartid="cartid"
|
||
></CouponListWindow>
|
||
<AddressWindow
|
||
@checked="changeAddress"
|
||
@redirect="addressRedirect"
|
||
v-model="showAddress"
|
||
:checked="addressInfo.id"
|
||
ref="mychild"
|
||
></AddressWindow>
|
||
<!-- <uni-popup ref="popup" type="bottom">
|
||
<blPaymentPasswordInput hideTopBorder ref="secrity" @input="onInput" @confirm="onConfirm">
|
||
<block slot='header' style='width: 100%;'>
|
||
<view style="font-size: 36rpx;color: #8B8F99;margin: 10rpx 0;">请输入支付密码</view>
|
||
</block>
|
||
</blPaymentPasswordInput>
|
||
</uni-popup> -->
|
||
<passkeyborad :money="orderPrice.payPrice" showMoney :show="isShowPayPwdPop" ref='payPwdPop' @close="pwdPopClose"
|
||
@finish="pwdPopFinish"></passkeyborad>
|
||
</view>
|
||
</template>
|
||
|
||
<script>
|
||
|
||
import passkeyborad from '@/components/yzc-paykeyboard/yzc-paykeyboard'
|
||
import OrderGoods from "@/components/OrderGoods";
|
||
import CouponListWindow from "@/components/CouponListWindow";
|
||
import AddressWindow from "@/components/AddressWindow";
|
||
import {createOrder, postOrderComputed, postOrderConfirm} from "@/api/order";
|
||
import {mapGetters} from "vuex";
|
||
import {weappPay} from "@/libs/wechat";
|
||
import {isNullOrEmpty, isWeixin} from "@/utils";
|
||
import blPaymentPasswordInput from '@/components/blPaymentPasswordInput.vue';
|
||
import uniPopup from '@/components/uni-popup/uni-popup.vue';
|
||
|
||
const NAME = "OrderSubmission",
|
||
_isWeixin = isWeixin();
|
||
export default {
|
||
name: NAME,
|
||
components: {
|
||
OrderGoods,
|
||
CouponListWindow,
|
||
AddressWindow,
|
||
blPaymentPasswordInput,
|
||
uniPopup,
|
||
passkeyborad
|
||
},
|
||
props: {},
|
||
data: function () {
|
||
return {
|
||
webUrl: this.$VUE_APP_RESOURCES_URL,
|
||
isShowPayPwdPop: false,
|
||
offlinePayStatus: 2,
|
||
from: this.$deviceType,
|
||
deduction: true,
|
||
enableIntegral: true,
|
||
enableIntegralNum: 0,
|
||
isWeixin: _isWeixin,
|
||
pinkId: 0,
|
||
// active: _isWeixin ? "weixin" : "yue",
|
||
active: "weixin",
|
||
showCoupon: false,
|
||
showAddress: false,
|
||
addressInfo: {},
|
||
couponId: 0,
|
||
orderGroupInfo: {
|
||
priceGroup: {}
|
||
},
|
||
usableCoupon: {},
|
||
addressLoaded: false,
|
||
useIntegral: false,
|
||
orderPrice: {
|
||
payPrice: "计算中"
|
||
},
|
||
mark: "",
|
||
systemStore: {},
|
||
shipping_type: 0,
|
||
contacts: "",
|
||
contactsTel: "",
|
||
storeSelfMention: 0,
|
||
cartid: "",
|
||
payPassword: null
|
||
};
|
||
},
|
||
computed: mapGetters(["userInfo", "storeItems"]),
|
||
watch: {
|
||
useIntegral() {
|
||
this.computedPrice();
|
||
},
|
||
// $yroute(n) {
|
||
// if (n.name === NAME){
|
||
// this.getCartInfo();
|
||
// // this.$store.dispatch("getUser", true);
|
||
// }
|
||
// },
|
||
shipping_type() {
|
||
this.computedPrice();
|
||
}
|
||
},
|
||
// mounted: function() {
|
||
// let that = this;
|
||
// // this.$store.dispatch("getUser", true);
|
||
// that.getCartInfo();
|
||
// console.log(that.$yroute);
|
||
// if (that.$yroute.query.pinkid !== undefined) {
|
||
// that.pinkId = that.$yroute.query.pinkid;
|
||
// }
|
||
// if (that.$yroute.query.id !== undefined) {
|
||
// that.cartid = that.$yroute.query.id;
|
||
// console.log(that.cartid)
|
||
// }
|
||
// },
|
||
onLoad: function () {
|
||
//获取用户信息
|
||
// this.$store.dispatch("getUser", true);
|
||
let that = this;
|
||
uni.$on('chooseAddress', (res) => {
|
||
console.log('监听到选择收货地址:' + JSON.stringify(res));
|
||
that.addressInfo = res;
|
||
//地址切换也要重新计算一下
|
||
that.computedPrice();
|
||
})
|
||
that.getCartInfo();
|
||
console.log(that.$yroute);
|
||
if (that.$yroute.query.pinkid !== undefined) {
|
||
that.pinkId = that.$yroute.query.pinkid;
|
||
}
|
||
if (that.$yroute.query.id !== undefined) {
|
||
that.cartid = that.$yroute.query.id;
|
||
console.log(that.cartid)
|
||
}
|
||
},
|
||
onUnload: function () {
|
||
console.log('关闭监听选择收货地址');
|
||
uni.$off('chooseAddress');
|
||
},
|
||
onShow: function () {
|
||
//获取用户信息
|
||
this.$store.dispatch("getUser", true);
|
||
},
|
||
methods: {
|
||
isNullOrEmpty,
|
||
showStoreList() {
|
||
this.$store.commit("get_to", "orders");
|
||
this.$yrouter.push({
|
||
path: "/pages/shop/StoreList/index"
|
||
});
|
||
},
|
||
force2Decimal(value) {
|
||
return this.$force2Decimal(value);
|
||
},
|
||
addressType: function (index) {
|
||
if (index && !this.systemStore.id) {
|
||
uni.showToast({
|
||
title: "暂无门店信息,您无法选择到店自提!",
|
||
icon: "none",
|
||
duration: 2000
|
||
});
|
||
return;
|
||
}
|
||
this.shipping_type = index;
|
||
},
|
||
changeUseIntegral: function (e) {
|
||
// this.computedPrice();
|
||
this.useIntegral = e.mp.detail.value[0];
|
||
},
|
||
computedPrice() {
|
||
let shipping_type = this.shipping_type;
|
||
postOrderComputed(this.orderGroupInfo.orderKey, {
|
||
addressId: this.addressInfo.id,
|
||
useIntegral: this.useIntegral ? 1 : 0,
|
||
couponId: this.usableCoupon.id || 0,
|
||
shipping_type: parseInt(shipping_type) + 1
|
||
}).then(res => {
|
||
const data = res.data;
|
||
if (data.status === "EXTEND_ORDER") {
|
||
this.$yrouter.replace({
|
||
path: "/pages/order/OrderDetails/index",
|
||
query: {
|
||
id: data.result.orderId
|
||
}
|
||
});
|
||
} else {
|
||
this.orderPrice = data.result;
|
||
}
|
||
});
|
||
},
|
||
getCartInfo() {
|
||
var that = this;
|
||
const cartIds = this.$yroute.query.id;
|
||
if (!cartIds) {
|
||
uni.showToast({
|
||
title: "参数有误",
|
||
icon: "none",
|
||
duration: 2000
|
||
});
|
||
return this.$yrouter.back();
|
||
}
|
||
postOrderConfirm(cartIds)
|
||
.then(res => {
|
||
that.offlinePayStatus = res.data.offline_pay_status;
|
||
that.orderGroupInfo = res.data;
|
||
that.deduction = res.data.deduction;
|
||
that.usableCoupon = res.data.usableCoupon || {};
|
||
that.addressInfo = res.data.addressInfo || {};
|
||
that.systemStore = res.data.systemStore || {};
|
||
that.storeSelfMention = res.data.storeSelfMention;
|
||
that.computedPrice();
|
||
})
|
||
.catch(err => {
|
||
uni.showToast({
|
||
title: err.msg,
|
||
icon: "none",
|
||
duration: 2000
|
||
});
|
||
});
|
||
},
|
||
addressTap: function () {
|
||
|
||
// this.showAddress = true;
|
||
// if (!this.addressLoaded) {
|
||
// this.addressLoaded = true;
|
||
// this.$refs.mychild.getAddressList();
|
||
// }
|
||
|
||
//改用跳转页面方式
|
||
this.$yrouter.push({
|
||
path: "/pages/user/address/AddressManagement/index",
|
||
query: {
|
||
choosMode: 1
|
||
}
|
||
});
|
||
|
||
|
||
},
|
||
addressRedirect() {
|
||
this.addressLoaded = false;
|
||
this.showAddress = false;
|
||
},
|
||
couponTap: function () {
|
||
this.showCoupon = true;
|
||
},
|
||
changeCoupon: function (coupon) {
|
||
if (!coupon) {
|
||
this.usableCoupon = {
|
||
couponTitle: "不使用优惠券",
|
||
id: 0
|
||
};
|
||
} else {
|
||
this.usableCoupon = coupon;
|
||
}
|
||
this.computedPrice();
|
||
},
|
||
payItem: function (index) {
|
||
this.active = index;
|
||
},
|
||
changeAddress(addressInfo) {
|
||
this.addressInfo = addressInfo;
|
||
//地址切换也要重新计算一下
|
||
this.computedPrice();
|
||
},
|
||
pwdPopClose() {
|
||
this.isShowPayPwdPop = false;
|
||
},
|
||
pwdPopFinish(payPwd) {
|
||
this.payPassword = payPwd;
|
||
this.createOrder(true);
|
||
},
|
||
//支付密码输入监听
|
||
onInput(e) {
|
||
|
||
},
|
||
// 支付密码输入确认
|
||
onConfirm(e) {
|
||
let password = e.value;
|
||
|
||
// if(password)
|
||
console.log('password:' + password);
|
||
|
||
this.payPassword = password;
|
||
this.$refs.popup.close();//关闭支付密码弹窗
|
||
this.$refs.secrity.clear();//清空支付密码
|
||
this.createOrder(true);
|
||
|
||
|
||
},
|
||
subscribePay() {
|
||
uni.requestSubscribeMessage({
|
||
tmplIds: ['7O3wKw7_D4t7yfSOlvecKuOQP8QEPY88uBx2FJg43HE', 'TSmTnGibZ8IxWCiRWOvLxha6-0u7tE-V1-WbDCiPkKU', '9Q6xLHe6HyjkU5Zn5k_2zxYPf2y4MxVyUbOSW8pcZRU'],
|
||
complete: () => this.createOrder(false)
|
||
})
|
||
},
|
||
createOrder(isyue) {
|
||
let shipping_type = this.shipping_type;
|
||
if (!this.active) {
|
||
uni.showToast({
|
||
title: "请选择支付方式",
|
||
icon: "none",
|
||
duration: 2000
|
||
});
|
||
return;
|
||
}
|
||
if (!this.addressInfo.id && !this.shipping_type) {
|
||
uni.showToast({
|
||
title: "请选择收货地址",
|
||
icon: "none",
|
||
duration: 2000
|
||
});
|
||
return;
|
||
}
|
||
|
||
if (this.shipping_type) {
|
||
if (
|
||
(this.contacts === "" || this.contactsTel === "") &&
|
||
this.shipping_type
|
||
) {
|
||
uni.showToast({
|
||
title: "请填写联系人或联系人电话",
|
||
icon: "none",
|
||
duration: 2000
|
||
});
|
||
return;
|
||
}
|
||
|
||
if (!/^1(3|4|5|7|8|9|6)\d{9}$/.test(this.contactsTel)) {
|
||
uni.showToast({
|
||
title: "请填写正确的手机号",
|
||
icon: "none",
|
||
duration: 2000
|
||
});
|
||
return;
|
||
}
|
||
if (!/^[\u4e00-\u9fa5\w]{2,16}$/.test(this.contacts)) {
|
||
uni.showToast({
|
||
title: "请填写您的真实姓名",
|
||
icon: "none",
|
||
duration: 2000
|
||
});
|
||
return;
|
||
}
|
||
}
|
||
|
||
//判断如果是余额支付,先要输入支付密码
|
||
if (this.active == 'yue' && !isyue) {
|
||
//先判断用户是否绑定过手机
|
||
if (this.userInfo.phone) {
|
||
//再判断用户是否设置过支付密码
|
||
if (this.userInfo.hasPwdPay) {
|
||
//显示输入支付密码
|
||
this.isShowPayPwdPop = true;
|
||
} else {
|
||
//设置支付密码
|
||
this.$yrouter.push("/pkg_user/views/payPassword?isSetMode=true");
|
||
}
|
||
} else {
|
||
//跳转到绑定手机
|
||
this.$yrouter.push("/pkg_user/views/bindPhone");
|
||
}
|
||
|
||
return;
|
||
}
|
||
|
||
uni.showLoading({
|
||
title: "生成订单中"
|
||
});
|
||
let from = {};
|
||
if (this.$deviceType == "app") {
|
||
from.from = "app";
|
||
}
|
||
console.log(this.storeItems, this.systemStore);
|
||
|
||
var params = {
|
||
realName: this.contacts,
|
||
phone: this.contactsTel,
|
||
addressId: this.addressInfo.id,
|
||
useIntegral: this.useIntegral ? 1 : 0,
|
||
couponId: this.usableCoupon.id || 0,
|
||
payType: this.active,
|
||
pinkId: this.pinkId,
|
||
seckillId: this.orderGroupInfo.seckill_id,
|
||
combinationId: this.orderGroupInfo.combination_id,
|
||
bargainId: this.orderGroupInfo.bargain_id,
|
||
from: this.from,
|
||
mark: this.mark || "",
|
||
shippingType: parseInt(shipping_type) + 1,
|
||
storeId: this.storeItems ? this.storeItems.id : this.systemStore.id,
|
||
...from
|
||
}
|
||
|
||
//余额支付的支付密码
|
||
if (this.active == 'yue') {
|
||
params.passwordPay = this.payPassword;
|
||
}
|
||
|
||
var that = this;
|
||
createOrder(this.orderGroupInfo.orderKey, params)
|
||
.then(res => {
|
||
uni.hideLoading();
|
||
const data = res.data;
|
||
switch (data.status) {
|
||
case "ORDER_EXIST":
|
||
case "EXTEND_ORDER":
|
||
uni.showToast({
|
||
title: res.msg,
|
||
icon: "none",
|
||
duration: 2000
|
||
});
|
||
this.$yrouter.replace({
|
||
path: "/pages/order/OrderDetails/index",
|
||
query: {
|
||
id: data.result.orderId
|
||
}
|
||
});
|
||
break;
|
||
case "PAY_DEFICIENCY":
|
||
break;
|
||
|
||
case "PAY_ERROR":
|
||
uni.showToast({
|
||
title: res.msg,
|
||
icon: "none",
|
||
duration: 2000
|
||
});
|
||
this.$yrouter.replace({
|
||
path: "/pages/order/OrderDetails/index",
|
||
query: {
|
||
id: data.result.orderId
|
||
}
|
||
});
|
||
break;
|
||
case "SUCCESS":
|
||
uni.showToast({
|
||
title: res.msg,
|
||
icon: "none",
|
||
duration: 2000
|
||
});
|
||
this.$yrouter.replace({
|
||
path: "/pages/order/OrderDetails/index",
|
||
query: {
|
||
id: data.result.orderId
|
||
}
|
||
});
|
||
break;
|
||
case "WECHAT_H5_PAY":
|
||
// H5支付
|
||
this.$yrouter.replace({
|
||
path: "/pages/order/OrderDetails/index",
|
||
query: {
|
||
id: data.result.orderId
|
||
}
|
||
});
|
||
setTimeout(() => {
|
||
// location.href = data.result.jsConfig.mweb_url;
|
||
}, 100);
|
||
break;
|
||
case "WECHAT_PAY":
|
||
// 小程序支付
|
||
weappPay(data.result.jsConfig).finally(() => {
|
||
this.$yrouter.replace({
|
||
path: "/pages/order/OrderDetails/index",
|
||
query: {
|
||
id: data.result.orderId
|
||
}
|
||
});
|
||
});
|
||
break;
|
||
|
||
case "WECHAT_APP_PAY":
|
||
// APP支付
|
||
weappPay(data.result.jsConfig).finally(() => {
|
||
this.$yrouter.replace({
|
||
path: "/pages/order/OrderDetails/index",
|
||
query: {
|
||
id: data.result.orderId
|
||
}
|
||
});
|
||
});
|
||
break;
|
||
// 下面为原先微信支付方式,
|
||
// pay(data.result.jsConfig).finally(() => {
|
||
// this.$yrouter.replace({
|
||
// path: "/pages/order/OrderDetails/index" ,query: { id: data.result.orderId}
|
||
// });
|
||
// });
|
||
}
|
||
})
|
||
.catch(err => {
|
||
uni.hideLoading();
|
||
uni.showToast({
|
||
title:
|
||
err.msg ||
|
||
err.response.data.msg ||
|
||
err.response.data.message ||
|
||
"创建订单失败",
|
||
icon: "none",
|
||
duration: 2000
|
||
});
|
||
}).finally(function () {
|
||
that.isShowPayPwdPop = false;
|
||
that.$refs.payPwdPop.clear();//清空支付密码
|
||
that.$refs.payPwdPop.close();//关闭支付密码弹窗
|
||
});
|
||
}
|
||
}
|
||
};
|
||
</script>
|
||
<style scoped lang="less">
|
||
|
||
.pink-dot {
|
||
width: 24rpx;
|
||
height: 24rpx;
|
||
background: rgba(255, 86, 74, 0.4);
|
||
border-radius: 50%;
|
||
position: absolute;
|
||
z-index: 0;
|
||
bottom: 0;
|
||
right: -12rpx;
|
||
}
|
||
|
||
.pay-method-title {
|
||
font-size: 26rpx;
|
||
color: #080F1A;
|
||
font-weight: bold;
|
||
}
|
||
|
||
.goods-detail-title {
|
||
font-size: 36rpx;
|
||
color: #C2C5CC;
|
||
font-weight: bold;
|
||
}
|
||
|
||
.goods-detail-title.on {
|
||
color: #080F1A;
|
||
font-weight: normal;
|
||
}
|
||
|
||
.order-submission .footer {
|
||
background: #fff;
|
||
left: 0;
|
||
right: 0;
|
||
bottom: 0;
|
||
border-top: 1px solid #f6f6f6;
|
||
padding: 0 !important;
|
||
}
|
||
|
||
.order-submission .footer .settlement {
|
||
background-color: #FF564A;
|
||
color: #fff;
|
||
width: 198rpx;
|
||
height: 100%;
|
||
border-radius: 0 !important;
|
||
text-align: center;
|
||
}
|
||
|
||
.order-submission .wrapper .item .list .payItem {
|
||
border: none !important;
|
||
}
|
||
|
||
.order-submission .wrapper .item .list .payItem.on {
|
||
border-color: #eee !important;
|
||
color: inherit !important;
|
||
}
|
||
|
||
|
||
.order-submission .wrapper .shipping select {
|
||
color: #999;
|
||
padding-right: 0.15 * 100rpx;
|
||
}
|
||
|
||
.order-submission .wrapper .shipping .iconfont {
|
||
font-size: 0.3 * 100rpx;
|
||
color: #515151;
|
||
}
|
||
|
||
.order-submission .allAddress {
|
||
width: 100%;
|
||
// background-image: linear-gradient(to bottom, #00c17b 0%, #00c17b 100%);
|
||
// background-image: -webkit-linear-gradient(
|
||
// to bottom,
|
||
// #00c17b 0%,
|
||
// #00c17b 100%
|
||
// );
|
||
// background-image: -moz-linear-gradient(to bottom, #00c17b 0%, #00c17b 100%);
|
||
// padding-top: 1 * 100rpx;
|
||
// padding-top: 40rpx;
|
||
}
|
||
|
||
.order-submission .allAddress .nav {
|
||
margin: 0 auto;
|
||
padding: 0 30rpx;
|
||
width: 100%;
|
||
box-sizing: border-box;
|
||
}
|
||
|
||
.order-submission .address .addressCon {
|
||
width: auto !important;
|
||
}
|
||
|
||
.order-submission .allAddress .nav .item {
|
||
flex: 1;
|
||
position: relative;
|
||
}
|
||
|
||
.order-submission .allAddress .nav .item.on {
|
||
position: relative;
|
||
}
|
||
|
||
.order-submission .allAddress .nav .item.on:before {
|
||
position: absolute;
|
||
bottom: 0;
|
||
content: "快递配送";
|
||
font-size: 0.28 * 100rpx;
|
||
display: block;
|
||
height: 0;
|
||
left: 0;
|
||
right: 0;
|
||
border-width: 0.4 * 100rpx;
|
||
border-style: solid;
|
||
border-color: #fff;
|
||
z-index: 9;
|
||
text-align: center;
|
||
line-height: 0.14 * 100rpx;
|
||
}
|
||
|
||
.order-submission .allAddress .nav .item:nth-of-type(2).on:before {
|
||
content: "到店自提";
|
||
border-width: 0.4 * 100rpx;
|
||
}
|
||
|
||
.order-submission .allAddress .nav .item.on2 {
|
||
position: relative;
|
||
}
|
||
|
||
.order-submission .allAddress .nav .item.on2:before {
|
||
position: absolute;
|
||
bottom: 0;
|
||
content: "到店自提";
|
||
font-size: 0.28 * 100rpx;
|
||
display: block;
|
||
height: 0;
|
||
left: 0;
|
||
right: 0;
|
||
border-width: 0.4 * 100rpx;
|
||
border-style: solid;
|
||
border-color: #d5e6e6;
|
||
text-align: center;
|
||
line-height: 0.14 * 100rpx;
|
||
}
|
||
|
||
.order-submission .allAddress .nav .item:nth-of-type(1).on2:before {
|
||
content: "快递配送";
|
||
border-width: 0.4 * 100rpx;
|
||
}
|
||
|
||
.order-submission .allAddress .address {
|
||
width: 6.91 * 100rpx;
|
||
height: 1.5 * 100rpx;
|
||
margin: 0 auto;
|
||
box-sizing: border-box;
|
||
}
|
||
|
||
.order-submission .allAddress .line {
|
||
width: 7.1 * 100rpx;
|
||
margin: 0 auto;
|
||
}
|
||
|
||
.order-submission .wrapper .item .discount input::placeholder {
|
||
color: #ccc;
|
||
}
|
||
</style>
|