|
|
@ -1,28 +1,30 @@ |
|
|
|
<template> |
|
|
|
<template> |
|
|
|
<view class="sureOrder"> |
|
|
|
<view class="sureOrder"> |
|
|
|
<view> |
|
|
|
<view> |
|
|
|
<u-navbar title="确认订单" :border-bottom="false" title-color="#333" |
|
|
|
<u-navbar title="确认订单" :border-bottom="false" title-color="#333" :background="background"></u-navbar> |
|
|
|
:background="background"></u-navbar> |
|
|
|
|
|
|
|
</view> |
|
|
|
</view> |
|
|
|
<view class="buyType"> |
|
|
|
<view class="buyType"> |
|
|
|
<view class="toDoor" @click="choseType('sm')" |
|
|
|
<view class="toDoor" :class="buyType=='sm'?'':'toDoor-dis'" @click="choseType('sm')"> |
|
|
|
:style="{'background':buyType=='sm'?'#fff':'rgba(255, 255, 255, 0.57)','height':buyType=='zq'?'88rpx':'78rpx'}"> |
|
|
|
|
|
|
|
送货上门 |
|
|
|
送货上门 |
|
|
|
</view> |
|
|
|
</view> |
|
|
|
<view class="bySelf" @click="choseType('zq')" |
|
|
|
<view class="toDoor" :class="buyType=='zq'?'':'toDoor-dis'" @click="choseType('zq')"> |
|
|
|
:style="{'background':buyType=='zq'?'#fff':'rgba(255, 255, 255, 0.57)','height':buyType=='zq'?'88rpx':'78rpx'}"> |
|
|
|
|
|
|
|
到店自取 |
|
|
|
到店自取 |
|
|
|
</view> |
|
|
|
</view> |
|
|
|
|
|
|
|
<view class="toDoor-on" :style="{'left': buyType=='sm'?'0':'345rpx'}">{{buyType=='zq'?'到店自取':'送货上门'}}</view> |
|
|
|
</view> |
|
|
|
</view> |
|
|
|
<view class="address" v-if="buyType!='sm'"> |
|
|
|
<view class="getSelf" > |
|
|
|
<view class="addAddress"> |
|
|
|
<view class="address" v-if="buyType=='sm'"> |
|
|
|
请点击添加收货地址 |
|
|
|
<view class="addAddress"> |
|
|
|
</view> |
|
|
|
<view class="tip" v-if="true">请点击添加收货地址</view> |
|
|
|
<view class="leftImg"> |
|
|
|
<view class="info" v-else> |
|
|
|
<image src="/static/order/left.png" mode=""></image> |
|
|
|
<view class="name"></view> |
|
|
|
|
|
|
|
<view class="detail"></view> |
|
|
|
|
|
|
|
</view> |
|
|
|
|
|
|
|
</view> |
|
|
|
|
|
|
|
<view class="leftImg"> |
|
|
|
|
|
|
|
<image :src="$picUrl+'/static/order/left.png'"></image> |
|
|
|
|
|
|
|
</view> |
|
|
|
</view> |
|
|
|
</view> |
|
|
|
</view> |
|
|
|
|
|
|
|
<view class="getSelf"> |
|
|
|
|
|
|
|
<view class="shopAddress" v-if="buyType=='zq'"> |
|
|
|
<view class="shopAddress" v-if="buyType=='zq'"> |
|
|
|
<view class="youTime"> |
|
|
|
<view class="youTime"> |
|
|
|
花梨服务站 |
|
|
|
花梨服务站 |
|
|
@ -33,7 +35,7 @@ |
|
|
|
</view> |
|
|
|
</view> |
|
|
|
</view> |
|
|
|
</view> |
|
|
|
<view class="addressDetail"> |
|
|
|
<view class="addressDetail"> |
|
|
|
{{addressInfo.name}} {{addressInfo.region.province +addressInfo.region.city+addressInfo.region.region}} |
|
|
|
|
|
|
|
</view> |
|
|
|
</view> |
|
|
|
<view class="lookMap" v-if="buyType=='zq'"> |
|
|
|
<view class="lookMap" v-if="buyType=='zq'"> |
|
|
|
<image src="/static/user/address.png" mode="" class="addressIcon"></image> |
|
|
|
<image src="/static/user/address.png" mode="" class="addressIcon"></image> |
|
|
@ -51,7 +53,7 @@ |
|
|
|
取件人 |
|
|
|
取件人 |
|
|
|
</view> |
|
|
|
</view> |
|
|
|
<view class="name"> |
|
|
|
<view class="name"> |
|
|
|
{{addressInfo.name}} |
|
|
|
|
|
|
|
</view> |
|
|
|
</view> |
|
|
|
</view> |
|
|
|
</view> |
|
|
|
<view class="pickPeople"> |
|
|
|
<view class="pickPeople"> |
|
|
@ -67,7 +69,7 @@ |
|
|
|
预留电话 |
|
|
|
预留电话 |
|
|
|
</view> |
|
|
|
</view> |
|
|
|
<view class="name"> |
|
|
|
<view class="name"> |
|
|
|
{{addressInfo.phone}} |
|
|
|
|
|
|
|
</view> |
|
|
|
</view> |
|
|
|
</view> |
|
|
|
</view> |
|
|
|
<view class="pickPeople"> |
|
|
|
<view class="pickPeople"> |
|
|
@ -94,7 +96,7 @@ |
|
|
|
<switch /> |
|
|
|
<switch /> |
|
|
|
</view> |
|
|
|
</view> |
|
|
|
</view> |
|
|
|
</view> |
|
|
|
<!-- <view class="time"> |
|
|
|
<view class="time"> |
|
|
|
<view class="youTime"> |
|
|
|
<view class="youTime"> |
|
|
|
预计到货时间 |
|
|
|
预计到货时间 |
|
|
|
</view> |
|
|
|
</view> |
|
|
@ -103,8 +105,8 @@ |
|
|
|
|
|
|
|
|
|
|
|
<image src="/static/order/left.png" mode=""></image> |
|
|
|
<image src="/static/order/left.png" mode=""></image> |
|
|
|
</view> |
|
|
|
</view> |
|
|
|
</view> --> |
|
|
|
</view> |
|
|
|
<!-- <view class="time"> |
|
|
|
<view class="time"> |
|
|
|
<view class="youTime"> |
|
|
|
<view class="youTime"> |
|
|
|
您期待的收货时间 |
|
|
|
您期待的收货时间 |
|
|
|
</view> |
|
|
|
</view> |
|
|
@ -112,7 +114,7 @@ |
|
|
|
请选择 |
|
|
|
请选择 |
|
|
|
<image src="/static/order/left.png" mode=""></image> |
|
|
|
<image src="/static/order/left.png" mode=""></image> |
|
|
|
</view> |
|
|
|
</view> |
|
|
|
</view> --> |
|
|
|
</view> |
|
|
|
<view class="goodsDetail"> |
|
|
|
<view class="goodsDetail"> |
|
|
|
<view class="goodsType"> |
|
|
|
<view class="goodsType"> |
|
|
|
<image src="/static/order/bag.png" mode="" class="bag"></image> |
|
|
|
<image src="/static/order/bag.png" mode="" class="bag"></image> |
|
|
@ -235,242 +237,352 @@ |
|
|
|
</template> |
|
|
|
</template> |
|
|
|
|
|
|
|
|
|
|
|
<script> |
|
|
|
<script> |
|
|
|
import * as order from '@/api/checkout.js' |
|
|
|
import * as Verify from '@/utils/verify' |
|
|
|
// import img from "@/static/member/head.png" |
|
|
|
import * as CheckoutApi from '@/api/checkout' |
|
|
|
import * as storeShop from '@/api/shop.js' |
|
|
|
import * as SharpCheckoutApi from '@/api/sharp/checkout' |
|
|
|
import * as address from '@/api/address.js' |
|
|
|
import * as BargainCheckoutApi from '@/api/bargain/checkout' |
|
|
|
import * as cashier from '@/api/cashier/index.js' |
|
|
|
import * as GrouponCheckoutApi from '@/api/groupon/checkout' |
|
|
|
import * as CouponApi from '@/api/coupon' |
|
|
|
import { CouponTypeEnum } from '@/common/enum/coupon' |
|
|
|
import { |
|
|
|
import { OrderTypeEnum, DeliveryTypeEnum } from '@/common/enum/order' |
|
|
|
Wechat |
|
|
|
|
|
|
|
} from '@/core/payment' |
|
|
|
const CouponColors = ['red', 'blue', 'violet', 'yellow'] |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// 根据指定mode获取对应的api类 |
|
|
|
|
|
|
|
const getCheckoutApi = (mode) => { |
|
|
|
|
|
|
|
const apiEnum = { |
|
|
|
|
|
|
|
buyNow: CheckoutApi, |
|
|
|
|
|
|
|
cart: CheckoutApi, |
|
|
|
|
|
|
|
bargain: BargainCheckoutApi, |
|
|
|
|
|
|
|
sharp: SharpCheckoutApi, |
|
|
|
|
|
|
|
groupon: GrouponCheckoutApi |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
return apiEnum[mode] |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// 根据指定mode获取param |
|
|
|
|
|
|
|
const getModeParam = (mode, options) => { |
|
|
|
|
|
|
|
const param = {} |
|
|
|
|
|
|
|
// 结算模式: 立即购买 |
|
|
|
|
|
|
|
if (mode === 'buyNow') { |
|
|
|
|
|
|
|
param.goodsId = options.goodsId |
|
|
|
|
|
|
|
param.goodsNum = options.goodsNum |
|
|
|
|
|
|
|
param.goodsSkuId = options.goodsSkuId |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
// 结算模式: 购物车 |
|
|
|
|
|
|
|
if (mode === 'cart') { |
|
|
|
|
|
|
|
param.cartIds = options.cartIds |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
// 结算模式: 砍价活动 |
|
|
|
|
|
|
|
if (mode === 'bargain') { |
|
|
|
|
|
|
|
param.taskId = options.taskId |
|
|
|
|
|
|
|
param.goodsSkuId = options.goodsSkuId |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
// 结算模式: 整点秒杀 |
|
|
|
|
|
|
|
if (mode === 'sharp') { |
|
|
|
|
|
|
|
param.activeTimeId = options.activeTimeId |
|
|
|
|
|
|
|
param.sharpGoodsId = options.sharpGoodsId |
|
|
|
|
|
|
|
param.goodsSkuId = options.goodsSkuId |
|
|
|
|
|
|
|
param.goodsNum = options.goodsNum |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
// 结算模式: 多人拼团 |
|
|
|
|
|
|
|
if (mode === 'groupon') { |
|
|
|
|
|
|
|
param.grouponGoodsId = options.grouponGoodsId |
|
|
|
|
|
|
|
param.taskId = options.taskId |
|
|
|
|
|
|
|
param.goodsSkuId = options.goodsSkuId |
|
|
|
|
|
|
|
param.goodsNum = options.goodsNum |
|
|
|
|
|
|
|
param.stepPeople = options.stepPeople |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
return param |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
export default { |
|
|
|
export default { |
|
|
|
data() { |
|
|
|
data() { |
|
|
|
return { |
|
|
|
return { |
|
|
|
remark: '', |
|
|
|
// 枚举类 |
|
|
|
payType: 'weChat', |
|
|
|
OrderTypeEnum, |
|
|
|
buyType: 'sm', |
|
|
|
DeliveryTypeEnum, |
|
|
|
background: { |
|
|
|
CouponTypeEnum, |
|
|
|
background: 'url(https://www.royaum.com.cn/static/member/head.png) center top no-repeat', |
|
|
|
// 当前页面参数 |
|
|
|
backgroundSize: '100% auto', |
|
|
|
options: {}, |
|
|
|
}, |
|
|
|
// 配送方式 |
|
|
|
goodsInfo: {}, |
|
|
|
isShowTab: false, |
|
|
|
shopInfo: {}, |
|
|
|
DeliveryTypeEnum, |
|
|
|
addressList: [], |
|
|
|
curDelivery: null, |
|
|
|
addressInfo: {}, |
|
|
|
// 自提信息 |
|
|
|
payMethList: [], |
|
|
|
selectedShopId: 0, // 选择的门店ID |
|
|
|
orderID: '', |
|
|
|
linkman: '', // 自提联系人 |
|
|
|
couponList: [], |
|
|
|
phone: '', // 自提联系电话 |
|
|
|
} |
|
|
|
// 优惠券颜色组 |
|
|
|
}, |
|
|
|
CouponColors, |
|
|
|
onLoad(options) { |
|
|
|
// 选择的优惠券 |
|
|
|
console.log(options, 'kkkkkk') |
|
|
|
selectCouponId: 0, |
|
|
|
// if (options.goodsInfo) { |
|
|
|
// 是否使用积分抵扣 |
|
|
|
let goodsInfo = options.goodsID; |
|
|
|
isUsePoints: false, |
|
|
|
console.log(goodsInfo, '5555555', typeof(goodsInfo)); |
|
|
|
// 买家留言 |
|
|
|
this.goodsInfo = JSON.parse(decodeURIComponent(goodsInfo)) |
|
|
|
remark: '', |
|
|
|
console.log(this.goodsInfo, '666666'); |
|
|
|
// 禁用submit按钮 |
|
|
|
// } |
|
|
|
disabled: false, |
|
|
|
}, |
|
|
|
// 是否显示积分说明 |
|
|
|
onShow() { |
|
|
|
showPoints: false, |
|
|
|
this.getShopInfo() |
|
|
|
// 是否显示优惠券弹窗 |
|
|
|
this.getAddressList(); |
|
|
|
showPopup: false, |
|
|
|
this.orderSubmit() |
|
|
|
// 订单信息 (从后端api中获取) |
|
|
|
this.getCoupon() |
|
|
|
order: { |
|
|
|
|
|
|
|
// 商品列表 |
|
|
|
}, |
|
|
|
goodsList: [], |
|
|
|
methods: { |
|
|
|
// 优惠券列表 |
|
|
|
getCoupon() { |
|
|
|
couponList: [], |
|
|
|
const that =this |
|
|
|
// 是否存在收货地址 |
|
|
|
let param = { |
|
|
|
existAddress: false, |
|
|
|
dataType:'isUsable' |
|
|
|
// 默认收货地址 |
|
|
|
} |
|
|
|
address: null, |
|
|
|
CouponApi.myCouponList(param) |
|
|
|
// 是否存在收货地址 |
|
|
|
.then(res => { |
|
|
|
existAddress: false, |
|
|
|
that.couponList = res.data.list.data |
|
|
|
// 当前用户收货城市是否存在配送规则中 |
|
|
|
}) |
|
|
|
isIntraRegion: true, |
|
|
|
.finally() |
|
|
|
// 是否存在错误 |
|
|
|
}, |
|
|
|
hasError: false, |
|
|
|
choseCoupon() { |
|
|
|
// 错误信息 |
|
|
|
// 选择优惠券 |
|
|
|
errorMsg: '', |
|
|
|
uni.navigateTo({ |
|
|
|
}, |
|
|
|
url: '/pages/news/coupon/list?chose=true', |
|
|
|
// 个人信息 |
|
|
|
}) |
|
|
|
personal: {}, |
|
|
|
}, |
|
|
|
// 商城设置 |
|
|
|
chosePayType(item) { |
|
|
|
setting: {} |
|
|
|
this.payType = item.method |
|
|
|
} |
|
|
|
}, |
|
|
|
}, |
|
|
|
choseType(val) { |
|
|
|
|
|
|
|
this.buyType = val |
|
|
|
/** |
|
|
|
}, |
|
|
|
* 生命周期函数--监听页面加载 |
|
|
|
getDefaultAddress() { |
|
|
|
*/ |
|
|
|
const that = this |
|
|
|
onLoad(options) { |
|
|
|
return new Promise((resolve, reject) => { |
|
|
|
this.options = options; |
|
|
|
address.defaultId().then(res => { |
|
|
|
console.log(options) |
|
|
|
if (res.status == 200) { |
|
|
|
// 注册全局事件订阅: 选择自提门店 |
|
|
|
for (var i = 0; i < that.addressList.length; i++) { |
|
|
|
uni.$on('syncSelectedId', selectedId => { |
|
|
|
if (res.data.defaultId == that.addressList[i].address_id) { |
|
|
|
this.selectedShopId = selectedId |
|
|
|
that.addressInfo = that.addressList[i] |
|
|
|
}) |
|
|
|
console.log(that.addressInfo, '获取收货地址') |
|
|
|
}, |
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
/** |
|
|
|
} |
|
|
|
* 生命周期函数--监听页面的卸载 |
|
|
|
}) |
|
|
|
*/ |
|
|
|
.catch() |
|
|
|
onUnload() { |
|
|
|
}) |
|
|
|
// 卸载全局事件订阅: 选择自提门店 |
|
|
|
}, |
|
|
|
uni.$off('syncSelectedId') |
|
|
|
getAddressList() { |
|
|
|
}, |
|
|
|
const that = this |
|
|
|
|
|
|
|
return new Promise((resolve, reject) => { |
|
|
|
/** |
|
|
|
address.list().then(res => { |
|
|
|
* 生命周期函数--监听页面显示 |
|
|
|
if (res.status == 200) { |
|
|
|
*/ |
|
|
|
that.addressList = res.data.list |
|
|
|
onShow() { |
|
|
|
that.getDefaultAddress() |
|
|
|
// 获取当前订单信息 |
|
|
|
} |
|
|
|
this.getOrderData() |
|
|
|
}) |
|
|
|
}, |
|
|
|
.catch() |
|
|
|
|
|
|
|
}) |
|
|
|
methods: { |
|
|
|
}, |
|
|
|
|
|
|
|
getShopInfo() { |
|
|
|
// 获取订单数据 |
|
|
|
return new Promise((resolve, reject) => { |
|
|
|
getOrderData() { |
|
|
|
storeShop.list().then(res => { |
|
|
|
const app = this |
|
|
|
console.log(res, '获取店铺信息') |
|
|
|
const { options: { mode } } = app |
|
|
|
}) |
|
|
|
// 请求的参数 |
|
|
|
.catch() |
|
|
|
const params = app.getRequestParam() |
|
|
|
}) |
|
|
|
// 请求api |
|
|
|
|
|
|
|
getCheckoutApi(mode) |
|
|
|
}, |
|
|
|
.order(mode, params) |
|
|
|
orderSubmit() { |
|
|
|
.then(result => app.initData(result.data)) |
|
|
|
const that = this; |
|
|
|
.catch(err => err) |
|
|
|
console.log(that.goodsInfo, '55555') |
|
|
|
}, |
|
|
|
let params = { |
|
|
|
|
|
|
|
mode: 'buyNow', |
|
|
|
// 初始化数据 |
|
|
|
delivery: '10', |
|
|
|
initData({ order, setting, personal }) { |
|
|
|
couponId: '', |
|
|
|
const app = this |
|
|
|
isUsePoints: 0, |
|
|
|
app.order = order |
|
|
|
remark: that.remark, |
|
|
|
app.personal = personal |
|
|
|
shopId: '', |
|
|
|
app.setting = setting |
|
|
|
linkman: '', |
|
|
|
// 显示错误信息 |
|
|
|
phone: '', |
|
|
|
if (order.hasError) { |
|
|
|
goodsId: that.goodsInfo.goods_id, |
|
|
|
app.showToast(order.errorMsg, 3000) |
|
|
|
goodsNum: 1, |
|
|
|
} |
|
|
|
goodsSkuId: that.goodsInfo.skuList[0].goods_sku_id, |
|
|
|
// 当前选择的配送方式 |
|
|
|
cartIds: '' |
|
|
|
app.curDelivery = order.delivery |
|
|
|
} |
|
|
|
// 如果只有一种配送方式则不显示选项卡 |
|
|
|
order.submit('buyNow', params) |
|
|
|
app.isShowTab = setting.deliveryType.length > 1 |
|
|
|
.then(res => { |
|
|
|
// 上门自提联系信息 |
|
|
|
if (res.status == 200) { |
|
|
|
if (app.linkman === '') { |
|
|
|
that.orderId = res.data.orderId |
|
|
|
app.linkman = order.lastExtract.linkman |
|
|
|
that.getOrderInfoPay(res.data.orderId) |
|
|
|
} |
|
|
|
} |
|
|
|
if (app.phone === '') { |
|
|
|
}) |
|
|
|
app.phone = order.lastExtract.phone |
|
|
|
.catch() |
|
|
|
} |
|
|
|
}, |
|
|
|
}, |
|
|
|
getOrderInfoPay(val) { |
|
|
|
|
|
|
|
cashier.orderInfo(val).then(res => { |
|
|
|
// 获取api请求的参数 |
|
|
|
if (res.status == 200) { |
|
|
|
getRequestParam() { |
|
|
|
this.payMethList = res.data.paymentMethods |
|
|
|
const app = this |
|
|
|
} |
|
|
|
const { options } = app |
|
|
|
}) |
|
|
|
// 结算模式的固定参数 |
|
|
|
.catch() |
|
|
|
const modeParam = getModeParam(options.mode, options) |
|
|
|
}, |
|
|
|
// 订单结算参数(用户选择) |
|
|
|
onShowSuccess(res) { |
|
|
|
const orderParam = { |
|
|
|
this.$toast(message || '订单支付成功') |
|
|
|
delivery: app.curDelivery || 0, |
|
|
|
uni.navigateTo({ |
|
|
|
shopId: app.selectedShopId || 0, |
|
|
|
url: '/pages/news/recycling/orderList' |
|
|
|
couponId: app.selectCouponId || 0, |
|
|
|
}) |
|
|
|
isUsePoints: app.isUsePoints ? 1 : 0, |
|
|
|
}, |
|
|
|
} |
|
|
|
orderPay() { |
|
|
|
return { ...orderParam, ...modeParam } |
|
|
|
const that = this |
|
|
|
}, |
|
|
|
if (that.payType == 'balance') { |
|
|
|
|
|
|
|
that.payBanlance() |
|
|
|
// 切换配送方式 |
|
|
|
return |
|
|
|
handleSwichDelivery(key) { |
|
|
|
} |
|
|
|
this.curDelivery = key |
|
|
|
cashier.orderPay(that.orderId).then(res => { |
|
|
|
this.getOrderData() |
|
|
|
if (res.status == 200) { |
|
|
|
}, |
|
|
|
|
|
|
|
|
|
|
|
let paymentData = res.data.payment |
|
|
|
// 显示积分说明 |
|
|
|
Wechat.payment({ |
|
|
|
handleShowPoints() { |
|
|
|
orderKey: res.data.payment.out_trade_no, |
|
|
|
this.showPoints = true |
|
|
|
...paymentData |
|
|
|
}, |
|
|
|
}) |
|
|
|
|
|
|
|
.then((result) => { |
|
|
|
// 显示优惠券弹窗 |
|
|
|
console.log(result) |
|
|
|
handleShowPopup() { |
|
|
|
that.onShowSuccess(result) |
|
|
|
this.showPopup = true |
|
|
|
}) |
|
|
|
}, |
|
|
|
.catch(err => { |
|
|
|
|
|
|
|
console.log(err) |
|
|
|
// 选择优惠券 |
|
|
|
}) |
|
|
|
handleSelectCoupon(index) { |
|
|
|
|
|
|
|
const app = this |
|
|
|
|
|
|
|
const { couponList } = app.order |
|
|
|
} |
|
|
|
// 当前选择的优惠券 |
|
|
|
}) |
|
|
|
const couponItem = couponList[index] |
|
|
|
.catch() |
|
|
|
// 判断是否在适用范围 |
|
|
|
|
|
|
|
if (!couponItem.is_apply) { |
|
|
|
}, |
|
|
|
app.showToast(couponItem.not_apply_info) |
|
|
|
payBanlance() { |
|
|
|
return |
|
|
|
const that = this |
|
|
|
} |
|
|
|
let params = { |
|
|
|
// 记录选中的优惠券id |
|
|
|
extra: {}, |
|
|
|
app.selectCouponId = couponItem.user_coupon_id |
|
|
|
method: 'balance', |
|
|
|
// 重新获取订单信息 |
|
|
|
client: 'weChat' |
|
|
|
app.getOrderData() |
|
|
|
} |
|
|
|
// 隐藏优惠券弹层 |
|
|
|
cashier.orderPay(that.orderID, params).then(res => { |
|
|
|
app.showPopup = false |
|
|
|
that.$toast(res.message) |
|
|
|
}, |
|
|
|
if (res.status == 200) { |
|
|
|
|
|
|
|
|
|
|
|
// 不使用优惠券 |
|
|
|
setTimeout(() => { |
|
|
|
handleNotUseCoupon() { |
|
|
|
uni.navigateTo({ |
|
|
|
const app = this |
|
|
|
url: '/pages/news/recycling/orderList' |
|
|
|
app.selectCouponId = 0 |
|
|
|
}) |
|
|
|
// 重新获取订单信息 |
|
|
|
}, 1000) |
|
|
|
app.getOrderData() |
|
|
|
|
|
|
|
// 隐藏优惠券弹层 |
|
|
|
} |
|
|
|
app.showPopup = false |
|
|
|
}) |
|
|
|
}, |
|
|
|
.catch() |
|
|
|
|
|
|
|
|
|
|
|
// 快递配送:选择收货地址 |
|
|
|
}, |
|
|
|
onSelectAddress() { |
|
|
|
// getOrderInfo() { |
|
|
|
this.$navTo('pages/address/index', { from: 'checkout' }) |
|
|
|
// const that = this |
|
|
|
}, |
|
|
|
// let params = { |
|
|
|
|
|
|
|
// orderId: 10202, |
|
|
|
// 上门自提:选择自提点 |
|
|
|
// client: 'wechat' |
|
|
|
onSelectExtractPoint() { |
|
|
|
// } |
|
|
|
this.$navTo('pages/shop/extract', { selectedId: this.selectedShopId }) |
|
|
|
// cashier.orderInfo(params) |
|
|
|
}, |
|
|
|
// .then(res => { |
|
|
|
|
|
|
|
// if (res.status == 200) { |
|
|
|
// 跳转到商品详情页 |
|
|
|
// that.payOrderInfo() |
|
|
|
onTargetGoods(goodsId) { |
|
|
|
// } |
|
|
|
this.$navTo('pages/goods/detail', { goodsId }) |
|
|
|
// }) |
|
|
|
}, |
|
|
|
// .catch() |
|
|
|
|
|
|
|
// }, |
|
|
|
// 订单提交 |
|
|
|
payOrderInfo() { |
|
|
|
onSubmitOrder() { |
|
|
|
const that = this |
|
|
|
const app = this |
|
|
|
let form = { |
|
|
|
if (app.disabled) { |
|
|
|
client: 'wechat', |
|
|
|
return false |
|
|
|
method: 'wechat', |
|
|
|
} |
|
|
|
extra: {} |
|
|
|
// 表单验证 |
|
|
|
} |
|
|
|
if (!app.onVerifyFrom()) { |
|
|
|
cashier.orderInfo(10202, form) |
|
|
|
return false |
|
|
|
.then(res => { |
|
|
|
} |
|
|
|
if (res.status == 200) { |
|
|
|
// 按钮禁用 |
|
|
|
|
|
|
|
app.disabled = true |
|
|
|
let paymentData = res.data.payment |
|
|
|
// 请求api |
|
|
|
Wechat.payment({ |
|
|
|
getCheckoutApi(app.options.mode) |
|
|
|
orderKey: res.data.payment.out_trade_no, |
|
|
|
.submit(app.options.mode, app.getFormData()) |
|
|
|
...paymentData |
|
|
|
.then(result => { |
|
|
|
}) |
|
|
|
// 订单创建成功: 跳转到订单支付页 |
|
|
|
.then((result) => { |
|
|
|
const orderId = result.data.orderId |
|
|
|
console.log(result) |
|
|
|
setTimeout(() => { |
|
|
|
}) |
|
|
|
this.$navTo('pages/checkout/cashier/index', { orderId }, 'redirectTo') |
|
|
|
.catch(err => { |
|
|
|
}, 100) |
|
|
|
console.log(err) |
|
|
|
}) |
|
|
|
}) |
|
|
|
.catch(res => app.showToast(res.errMsg, 3000)) |
|
|
|
} |
|
|
|
.finally(() => setTimeout(() => app.disabled = false, 800)) |
|
|
|
}) |
|
|
|
}, |
|
|
|
.catch() |
|
|
|
|
|
|
|
}, |
|
|
|
// 跳转到我的订单(等待1秒) |
|
|
|
}, |
|
|
|
navToMyOrder() { |
|
|
|
|
|
|
|
setTimeout(() => { |
|
|
|
|
|
|
|
this.$navTo('pages/order/index', {}, 'redirectTo') |
|
|
|
|
|
|
|
}, 1000) |
|
|
|
|
|
|
|
}, |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// 表单提交的数据 |
|
|
|
|
|
|
|
getFormData() { |
|
|
|
|
|
|
|
const app = this |
|
|
|
|
|
|
|
const { options } = app |
|
|
|
|
|
|
|
// 表单数据 |
|
|
|
|
|
|
|
const form = { |
|
|
|
|
|
|
|
delivery: app.curDelivery, |
|
|
|
|
|
|
|
couponId: app.selectCouponId || 0, |
|
|
|
|
|
|
|
shopId: app.selectedShopId || 0, |
|
|
|
|
|
|
|
linkman: app.linkman, |
|
|
|
|
|
|
|
phone: app.phone, |
|
|
|
|
|
|
|
isUsePoints: app.isUsePoints ? 1 : 0, |
|
|
|
|
|
|
|
remark: app.remark || '', |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
// 获取不同模式的参数 |
|
|
|
|
|
|
|
const modeParam = getModeParam(options.mode, options) |
|
|
|
|
|
|
|
return { ...form, ...modeParam } |
|
|
|
|
|
|
|
}, |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// 表单验证 |
|
|
|
|
|
|
|
onVerifyFrom() { |
|
|
|
|
|
|
|
const app = this |
|
|
|
|
|
|
|
if (app.hasError) { |
|
|
|
|
|
|
|
app.showToast(app.errorMsg, 3000) |
|
|
|
|
|
|
|
return false |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
// 验证自提填写的联系方式 |
|
|
|
|
|
|
|
if (app.curDelivery == DeliveryTypeEnum.EXTRACT.value) { |
|
|
|
|
|
|
|
app.linkman = app.linkman.trim() |
|
|
|
|
|
|
|
app.phone = app.phone.trim() |
|
|
|
|
|
|
|
if (app.selectedShopId <= 0) { |
|
|
|
|
|
|
|
app.showToast('请选择自提的门店') |
|
|
|
|
|
|
|
return false |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
if (Verify.isEmpty(app.linkman)) { |
|
|
|
|
|
|
|
app.showToast('请填写自提联系人') |
|
|
|
|
|
|
|
return false |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
if (Verify.isEmpty(app.phone)) { |
|
|
|
|
|
|
|
app.showToast('请填写自提联系电话') |
|
|
|
|
|
|
|
return false |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
if (!Verify.isPhone(app.phone)) { |
|
|
|
|
|
|
|
app.showToast('请输入正确的联系电话') |
|
|
|
|
|
|
|
return false |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
return true |
|
|
|
|
|
|
|
}, |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// 显示toast信息 |
|
|
|
|
|
|
|
showToast(title, duration = 2000) { |
|
|
|
|
|
|
|
this.$refs.uToast.show({ title, duration }) |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
</script> |
|
|
|
</script> |
|
|
|
|
|
|
|
|
|
|
@ -479,43 +591,51 @@ |
|
|
|
width: 750rpx; |
|
|
|
width: 750rpx; |
|
|
|
min-height: 750rpx; |
|
|
|
min-height: 750rpx; |
|
|
|
padding-bottom: 120rpx; |
|
|
|
padding-bottom: 120rpx; |
|
|
|
background: url('https://www.royaum.com.cn/static/member/head.png') center top no-repeat; |
|
|
|
background: url('https://www.royaum.com.cn/static/news/login-bg.png') center top no-repeat; |
|
|
|
background-size: 100% auto; |
|
|
|
background-size: 100% auto; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
.buyType { |
|
|
|
.buyType { |
|
|
|
display: flex; |
|
|
|
width: 700rpx; |
|
|
|
margin: 70rpx 0 0 26rpx; |
|
|
|
margin: 30rpx auto 0; |
|
|
|
|
|
|
|
position: relative; |
|
|
|
|
|
|
|
height: 88rpx; |
|
|
|
.toDoor { |
|
|
|
.toDoor { |
|
|
|
width: 348rpx; |
|
|
|
width: 50%; |
|
|
|
height: 88rpx; |
|
|
|
height: 74rpx; |
|
|
|
background-color: #fff; |
|
|
|
background-color: rgba(255, 255, 255, 0.5); |
|
|
|
font-size: 28rpx; |
|
|
|
font-size: 28rpx; |
|
|
|
font-family: PingFang SC, PingFang SC; |
|
|
|
|
|
|
|
font-weight: 500; |
|
|
|
font-weight: 500; |
|
|
|
color: #000000; |
|
|
|
|
|
|
|
line-height: 88rpx; |
|
|
|
|
|
|
|
text-align: center; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
.bySelf { |
|
|
|
|
|
|
|
width: 350rpx; |
|
|
|
|
|
|
|
height: 74rpx; |
|
|
|
|
|
|
|
background-color: rgba(255, 255, 255, 0.570000); |
|
|
|
|
|
|
|
line-height: 74rpx; |
|
|
|
|
|
|
|
text-align: center; |
|
|
|
|
|
|
|
font-size: 24rpx; |
|
|
|
|
|
|
|
font-family: PingFang SC, PingFang SC; |
|
|
|
|
|
|
|
font-weight: 400; |
|
|
|
|
|
|
|
color: #606060; |
|
|
|
color: #606060; |
|
|
|
line-height: 74rpx; |
|
|
|
line-height: 74rpx; |
|
|
|
position: relative; |
|
|
|
text-align: center; |
|
|
|
top: 14rpx; |
|
|
|
float: left; |
|
|
|
|
|
|
|
margin-top: 14rpx; |
|
|
|
|
|
|
|
float: left; |
|
|
|
|
|
|
|
&-on{ |
|
|
|
|
|
|
|
width: 350rpx; |
|
|
|
|
|
|
|
height: 88rpx; |
|
|
|
|
|
|
|
background-color: #FFF; |
|
|
|
|
|
|
|
text-align: center; |
|
|
|
|
|
|
|
font-size: 34rpx; |
|
|
|
|
|
|
|
font-weight: 400; |
|
|
|
|
|
|
|
color: #000; |
|
|
|
|
|
|
|
line-height: 88rpx; |
|
|
|
|
|
|
|
position: absolute; |
|
|
|
|
|
|
|
bottom: 0; |
|
|
|
|
|
|
|
left: 0; |
|
|
|
|
|
|
|
z-index: 2; |
|
|
|
|
|
|
|
border-radius: 10rpx 10rpx 0 0; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
&-dis{ |
|
|
|
|
|
|
|
border-radius: 10rpx 10rpx 0 0; |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
.getSelf { |
|
|
|
.getSelf { |
|
|
|
|
|
|
|
width: 700rpx; |
|
|
|
|
|
|
|
margin: 0 auto; |
|
|
|
.shopAddress { |
|
|
|
.shopAddress { |
|
|
|
display: flex; |
|
|
|
display: flex; |
|
|
|
align-items: center; |
|
|
|
align-items: center; |
|
|
@ -541,14 +661,11 @@ |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
background-image: url('https://www.royaum.com.cn/static/order/map.png'); |
|
|
|
margin-left: 26rpx; |
|
|
|
background-size: 100%; |
|
|
|
background-image: url('../../static/order/map.png'); |
|
|
|
height: 160rpx; |
|
|
|
background-size: 100% 100%; |
|
|
|
padding: 14rpx 46rpx 0 32rpx; |
|
|
|
width: 694rpx; |
|
|
|
box-sizing: border-box; |
|
|
|
height: 246rpx; |
|
|
|
|
|
|
|
padding:14rpx 46rpx 0 32rpx; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
.addressDetail { |
|
|
|
.addressDetail { |
|
|
|
height: 34rpx; |
|
|
|
height: 34rpx; |
|
|
|
font-size: 24rpx; |
|
|
|
font-size: 24rpx; |
|
|
|