|
@@ -1,1124 +0,0 @@
|
|
|
-<template>
|
|
|
- <view class="content padding-t-30">
|
|
|
- <view class="flex tab-address goodsList">
|
|
|
- <view class="left">
|
|
|
- 收货方式
|
|
|
- </view>
|
|
|
- <view class="flex right">
|
|
|
- <view class=" item" :class="{action:tabCurrentIndex==1}" @click="tabCurrentIndex=1">
|
|
|
- 配送
|
|
|
- </view>
|
|
|
- <view class=" item" :class="{action:tabCurrentIndex==2}" @click="tabCurrentIndex=2">
|
|
|
- 自提
|
|
|
- </view>
|
|
|
- </view>
|
|
|
- </view>
|
|
|
- <!-- 地址 -->
|
|
|
- <navigator v-if="tabCurrentIndex == 1" url="/pages/set/address?source=1" class="address-section margin-b-30">
|
|
|
- <view class="order-content " v-if="addressData.real_name">
|
|
|
- <view class="cen">
|
|
|
- <view class="top">
|
|
|
- <text class="name">{{ addressData.real_name }}</text>
|
|
|
- <text class="mobile">{{ addressData.phone }}</text>
|
|
|
- </view>
|
|
|
- <text
|
|
|
- class="address flex">{{ addressData.province + addressData.city + addressData.district }}{{ addressData.detail }}</text>
|
|
|
- </view>
|
|
|
- <text class="iconfont iconenter"></text>
|
|
|
- </view>
|
|
|
- <view class="order-content" v-if="!addressData.real_name">
|
|
|
- <view class="addAddress">
|
|
|
- <text></text>
|
|
|
- <text>添加收货地址</text>
|
|
|
- </view>
|
|
|
- </view>
|
|
|
- </navigator>
|
|
|
- <navigator url="/pages/order/shopList?type=1" class="address-section">
|
|
|
- <view class="shop-box" v-if="shopAddress.name">
|
|
|
- <view class="shop-top flex">
|
|
|
- <view class="flex shop-title">
|
|
|
- <image class="shopImg" :src="shopAddress.image" mode="scaleToFill"></image>
|
|
|
- <view class="shop-name clamp2">{{ shopAddress.name }}</view>
|
|
|
- </view>
|
|
|
- <view class="shop-tip">
|
|
|
- 门店
|
|
|
- </view>
|
|
|
- </view>
|
|
|
- <view class="shop-content margin-t-10">
|
|
|
- <view class="shop-address">
|
|
|
- 电话:{{ shopAddress.phone }}
|
|
|
- </view>
|
|
|
- <text class="shop-address">
|
|
|
- 地区:{{shopAddress.address+shopAddress.detailed_address}}
|
|
|
- </text>
|
|
|
- </view>
|
|
|
- </view>
|
|
|
- <view class="order-content" v-if="!shopAddress.name">
|
|
|
- <view class="addAddress">
|
|
|
- <text></text>
|
|
|
- <text>添加收货地址</text>
|
|
|
- </view>
|
|
|
- </view>
|
|
|
- </navigator>
|
|
|
- <view class="goodsList">
|
|
|
- <view class="goods-section" v-for="(ls, ind) in shopList" :key="ind">
|
|
|
- <!-- 商品列表 -->
|
|
|
- <view class="g-item">
|
|
|
- <image :src="ls.productInfo.image"></image>
|
|
|
- <view class="right">
|
|
|
- <text class="title clamp">{{ ls.productInfo.store_name }}</text>
|
|
|
- <text class="spec">{{ ls.productInfo.attrInfo ? ls.productInfo.attrInfo.suk : '默认' }}</text>
|
|
|
- <view class="price-box">
|
|
|
- <text
|
|
|
- class="price">¥{{ ls.productInfo.attrInfo ? ls.productInfo.attrInfo.price : ls.productInfo.price }}</text>
|
|
|
- <text class="number">{{ 'x ' + ls.cart_num + (ls.productInfo.unit_name || '') }}</text>
|
|
|
- </view>
|
|
|
- <view class="serverSet" v-if="ls.day>0">
|
|
|
- (<text>服务费:{{ls.day_deducted}}</text>
|
|
|
- <text class="margin-l-10">服务天数:{{ls.day}}天</text>)
|
|
|
- </view>
|
|
|
- </view>
|
|
|
- </view>
|
|
|
- </view>
|
|
|
- </view>
|
|
|
- <!-- 金额明细 -->
|
|
|
- <view class="yt-list">
|
|
|
- <view class="yt-list-cell b-b" v-if="certificate_info.num>0">
|
|
|
- <text class="cell-tit clamp">使用卡券({{certificate_info.num}})</text>
|
|
|
- <view class="desc">
|
|
|
- <switch class="switchCard" :checked='certificate_info.checked' style="transform:scale(0.7)"
|
|
|
- @change="switchChange" />
|
|
|
- </view>
|
|
|
- </view>
|
|
|
- <template v-if="tabCurrentIndex == 1">
|
|
|
- <view class="yt-list-cell b-b">
|
|
|
- <text class="cell-tit clamp">送货日期</text>
|
|
|
- <view @click="openTime" class="desc">
|
|
|
- <text v-if="day.day">
|
|
|
- {{timeList[checkedTime].name+day.time}}
|
|
|
- </text>
|
|
|
- <text v-else>
|
|
|
- 请选择送货日期
|
|
|
- </text>
|
|
|
- </view>
|
|
|
- </view>
|
|
|
- </template>
|
|
|
- <template v-if="tabCurrentIndex == 2">
|
|
|
- <view class="yt-list-cell b-b">
|
|
|
- <text class="cell-tit clamp">姓名</text>
|
|
|
- <input class="desc" type="text" v-model="addressData.real_name" placeholder="请填写姓名"
|
|
|
- placeholder-class="placeholder" />
|
|
|
- </view>
|
|
|
- <view class="yt-list-cell b-b">
|
|
|
- <text class="cell-tit clamp">手机号</text>
|
|
|
- <input class="desc" type="text" v-model="addressData.phone" placeholder="请填写手机号"
|
|
|
- placeholder-class="placeholder" />
|
|
|
- </view>
|
|
|
- </template>
|
|
|
- <view class="yt-list-cell b-b">
|
|
|
- <text class="cell-tit clamp">运费</text>
|
|
|
- <text class="cell-tip disabled">{{ Postage }}</text>
|
|
|
- </view>
|
|
|
- <view class="yt-list-cell b-b">
|
|
|
- <text class="cell-tit clamp">备注</text>
|
|
|
- <input class="desc" type="text" v-model="desc" placeholder="请填写备注信息" placeholder-class="placeholder" />
|
|
|
- </view>
|
|
|
- </view>
|
|
|
-
|
|
|
-
|
|
|
- <view class="yt-list">
|
|
|
- <view class="yt-list-cell b-b" @click="payType='weixin'">
|
|
|
- <view class="cell-tit flex">
|
|
|
- <image class="orderIcon" src="../../static/icon/orderWx.png" mode="widthFix"></image>
|
|
|
- <text class="margin-l-10">微信支付</text>
|
|
|
- </view>
|
|
|
- <image class="checked" v-if="payType=='weixin'" src="../../static/icon/addressIconXz.png"
|
|
|
- mode="widthFix"></image>
|
|
|
- <view v-else class="noChecked"></view>
|
|
|
- </view>
|
|
|
- <!-- #ifdef APP-PLUS -->
|
|
|
- <view class="yt-list-cell b-b" @click="payType='ali'">
|
|
|
- <view class="cell-tit flex">
|
|
|
- <image class="orderIcon" src="../../static/icon/orderAli.png" mode="widthFix"></image>
|
|
|
- <text class="margin-l-10">支付宝</text>
|
|
|
- </view>
|
|
|
- <image class="checked" v-if="payType=='ali'" src="../../static/icon/addressIconXz.png" mode="widthFix">
|
|
|
- </image>
|
|
|
- <view v-else class="noChecked"></view>
|
|
|
- </view>
|
|
|
- <!-- #endif -->
|
|
|
- <view class="yt-list-cell b-b" @click="payType='yue'">
|
|
|
- <view class="cell-tit flex">
|
|
|
- <image class="orderIcon" src="../../static/icon/ye.png" mode="widthFix"></image>
|
|
|
- <text class="margin-l-10">余额({{now_money}})</text>
|
|
|
- </view>
|
|
|
- <image class="checked" v-if="payType=='yue'" src="../../static/icon/addressIconXz.png" mode="widthFix">
|
|
|
- </image>
|
|
|
- <view v-else class="noChecked"></view>
|
|
|
- </view>
|
|
|
- <view class="yt-list-cell b-b" v-if="!certificate_info.checked" @click="payType='offline'">
|
|
|
- <view class="cell-tit flex">
|
|
|
- <image class="orderIcon" src="../../static/icon/yh.png" mode="widthFix"></image>
|
|
|
- <text class="margin-l-10">线下支付</text>
|
|
|
- </view>
|
|
|
- <image class="checked" v-if="payType=='offline'" src="../../static/icon/addressIconXz.png"
|
|
|
- mode="widthFix">
|
|
|
- </image>
|
|
|
- <view v-else class="noChecked"></view>
|
|
|
- </view>
|
|
|
- </view>
|
|
|
-
|
|
|
-
|
|
|
- <!-- 底部 -->
|
|
|
- <view class="footer">
|
|
|
- <view class="price-content">
|
|
|
- <text>实付款</text>
|
|
|
- <text class="price-tip">¥</text>
|
|
|
- <text class="price">{{ payPrice }}</text>
|
|
|
- </view>
|
|
|
- <text class="submit" :class="{submitNo:payLoding}" @click="payLoding?'':submit()">提交订单</text>
|
|
|
- </view>
|
|
|
-
|
|
|
- <uni-popup class="alertTime" ref="popup" type="bottom">
|
|
|
- <view class="alert-box position-relative">
|
|
|
- <view class="alert-title ">
|
|
|
- 选择预计送达时间
|
|
|
- </view>
|
|
|
- <view class="tip iconfont iconclose" @click="$refs.popup.close()"></view>
|
|
|
- <view class="flex">
|
|
|
- <view class="left-title">
|
|
|
- <view class="title" :class="{action:checkedTime==ind}" v-for="(item,ind) in timeList"
|
|
|
- @click="changeCheckedTime(item,ind)">
|
|
|
- {{item.name+'('+item.day+')'}}
|
|
|
- </view>
|
|
|
- </view>
|
|
|
- <view class="right-content">
|
|
|
- <view class="list flex" v-for="(item,ind) in timeList[checkedTime].list"
|
|
|
- @click="checkedShopTime(item)">
|
|
|
- <view class="time">
|
|
|
- {{item.time}}
|
|
|
- </view>
|
|
|
- <view class="checked">
|
|
|
- 剩余:{{item.door_number-item.day_number}}
|
|
|
- </view>
|
|
|
- </view>
|
|
|
- </view>
|
|
|
- </view>
|
|
|
- </view>
|
|
|
- </uni-popup>
|
|
|
- </view>
|
|
|
-</template>
|
|
|
-
|
|
|
-<script>
|
|
|
- import {
|
|
|
- mapState
|
|
|
- } from 'vuex';
|
|
|
- import {
|
|
|
- confirm,
|
|
|
- computedOrderkey,
|
|
|
- createOrderkey,
|
|
|
- orderPay
|
|
|
- } from '@/api/order.js';
|
|
|
- import {
|
|
|
- getUserInfo
|
|
|
- } from '@/api/user.js';
|
|
|
- import {
|
|
|
- storeday
|
|
|
- } from '@/api/water.js';
|
|
|
- // #ifdef H5
|
|
|
- import weixinObj from "@/plugin/jweixin-module/index.js";
|
|
|
- // #endif
|
|
|
- export default {
|
|
|
- data() {
|
|
|
- return {
|
|
|
- tabCurrentIndex: 1, //1为自提2为配送
|
|
|
- // #ifdef APP
|
|
|
- payType: 'ali',
|
|
|
- // #endif
|
|
|
- // #ifndef APP
|
|
|
- payType: 'weixin',
|
|
|
- // #endif
|
|
|
- desc: '', //备注
|
|
|
- // 收货地址
|
|
|
- addressData: {},
|
|
|
- // 店铺地址
|
|
|
- shopAddress: {
|
|
|
- name: '',
|
|
|
- mobile: '',
|
|
|
- addressName: '',
|
|
|
- address: '',
|
|
|
- area: '',
|
|
|
- default: false,
|
|
|
- id: ''
|
|
|
- },
|
|
|
- // 商品列表
|
|
|
- shopList: [],
|
|
|
- // 购物车id
|
|
|
- cartId: '',
|
|
|
- //购物金额详情
|
|
|
- moneyAll: {
|
|
|
- storeFreePostage: 0, //邮费优惠
|
|
|
- storePostage: 0, //邮费
|
|
|
- totalPrice: 0, //总支付金额
|
|
|
- vipPrice: 0 //vip优惠价
|
|
|
- },
|
|
|
- payPrice: 0, //总支付金额
|
|
|
- orderKey: '', //订单id
|
|
|
- payLoding: false, //判断是否支付中
|
|
|
- orderId: '', //订单id
|
|
|
- now_money: 0, //余额
|
|
|
- onShopId: -1, //默认-1为不存在商家id
|
|
|
- // 下单日期
|
|
|
- day: {
|
|
|
- day: '',
|
|
|
- id: '',
|
|
|
- time: ''
|
|
|
- },
|
|
|
- // 当前选中的日期对象
|
|
|
- checkedTime: 0,
|
|
|
- // 保存每周日子
|
|
|
- timeName: ['周日', '周一', '周二', '周三', '周四', '周五', '周六'],
|
|
|
- // 保存日期列表
|
|
|
- timeList: [{
|
|
|
- name: '今天',
|
|
|
- day: '',
|
|
|
- time: '',
|
|
|
- list: []
|
|
|
- }, {
|
|
|
- name: '明天',
|
|
|
- day: '',
|
|
|
- time: '',
|
|
|
- list: []
|
|
|
- }, {
|
|
|
- name: '',
|
|
|
- day: '',
|
|
|
- time: '',
|
|
|
- list: []
|
|
|
- }, {
|
|
|
- name: '',
|
|
|
- day: '',
|
|
|
- time: '',
|
|
|
- list: []
|
|
|
- }],
|
|
|
- // 可使用的水票
|
|
|
- certificate_info: {
|
|
|
- id: '',
|
|
|
- num: 0,
|
|
|
- checked: false
|
|
|
- }
|
|
|
- };
|
|
|
- },
|
|
|
- watch: {
|
|
|
- shopAddress(newValue, oldValue) {
|
|
|
- console.log(newValue, 'newValue');
|
|
|
- for (let i = 0; i < this.timeList.length; i++) {
|
|
|
- const item = this.timeList[i];
|
|
|
- const day = `${item.time.getFullYear()}-${item.time.getMonth()+1}-${item.time.getDate()}`
|
|
|
- storeday({
|
|
|
- store_id: newValue.id,
|
|
|
- day
|
|
|
- }).then(({
|
|
|
- data
|
|
|
- }) => {
|
|
|
- item.list = data;
|
|
|
- });
|
|
|
- }
|
|
|
- }
|
|
|
- },
|
|
|
- onLoad(option) {
|
|
|
- // 保存当前商品在购物车中的id
|
|
|
- this.cartId = option.id;
|
|
|
- // 判断是否要读取商家id
|
|
|
- if (option.shopId) {
|
|
|
- this.onShopId = option.shopId;
|
|
|
- }
|
|
|
- this.loadData();
|
|
|
- this.userinfo();
|
|
|
- // 初始化送货时间
|
|
|
- this.timeInit();
|
|
|
- },
|
|
|
- computed: {
|
|
|
- // 计算是否免运费
|
|
|
- Postage() {
|
|
|
- let money = +this.moneyAll.storePostage;
|
|
|
- if (money == 0) {
|
|
|
- return '免运费';
|
|
|
- } else {
|
|
|
- return '¥' + money;
|
|
|
- }
|
|
|
- },
|
|
|
- payAllMoney() {
|
|
|
- return +this.moneyAll.totalPrice + +this.moneyAll.vipPrice;
|
|
|
- },
|
|
|
- },
|
|
|
- methods: {
|
|
|
- // 是否使用卡券切换
|
|
|
- switchChange(res) {
|
|
|
- this.certificate_info.checked = res.detail.value;
|
|
|
- if (this.payType == 'offline') {
|
|
|
- this.payType = 'weixin'
|
|
|
- }
|
|
|
- // 重新计算价格
|
|
|
- this.payMoneyNub();
|
|
|
- },
|
|
|
- checkedShopTime(item) {
|
|
|
-
|
|
|
- if (item.door_number - item.day_number == 0) {
|
|
|
- uni.showModal({
|
|
|
- title: '提示',
|
|
|
- content: '该时间段预约已满!',
|
|
|
- showCancel: false,
|
|
|
- });
|
|
|
- return
|
|
|
- }
|
|
|
- this.day = item;
|
|
|
- this.$refs.popup.close();
|
|
|
- },
|
|
|
- // 选中的时间对象
|
|
|
- changeCheckedTime(item, ind) {
|
|
|
- this.checkedTime = ind;
|
|
|
- },
|
|
|
- // 打开弹窗
|
|
|
- openTime() {
|
|
|
- // 打开弹出窗
|
|
|
- this.$refs.popup.open();
|
|
|
- },
|
|
|
- // 初始化送货时间
|
|
|
- timeInit() {
|
|
|
- // 保存当前时间
|
|
|
- const startTime = new Date();
|
|
|
- for (let i = 0; i < this.timeList.length; i++) {
|
|
|
- const item = this.timeList[i]
|
|
|
- // 保存今天时间戳
|
|
|
- item.time = new Date(startTime.getTime() + 86400000 * i);
|
|
|
- // 获取今日周几
|
|
|
- item.day = this.timeName[item.time.getDay()];
|
|
|
- if (!item.name) {
|
|
|
- // 获取今日日期
|
|
|
- item.name = `${item.time.getMonth()+1}月${item.time.getDate()}日`
|
|
|
- }
|
|
|
- }
|
|
|
- console.log(this.timeList, 'this.timeList');
|
|
|
- },
|
|
|
- // 送货时间修改
|
|
|
- changeTime(res) {
|
|
|
- console.log(res);
|
|
|
- },
|
|
|
- // 加载用户基础信息
|
|
|
- userinfo() {
|
|
|
- getUserInfo({}).then(({
|
|
|
- data
|
|
|
- }) => {
|
|
|
- this.now_money = data.now_money;
|
|
|
- });
|
|
|
- },
|
|
|
- // 计算支付金额
|
|
|
- payMoneyNub() {
|
|
|
- let updata = {
|
|
|
- orderkey: this.orderKey,
|
|
|
- useIntegral: 0, //是否积分抵扣
|
|
|
- addressId: this.addressData.id //地址编号
|
|
|
- }
|
|
|
- // 判断是卡券支付
|
|
|
- if (this.certificate_info.checked) {
|
|
|
- updata.use_certificate_id = this.certificate_info.id
|
|
|
- }
|
|
|
- computedOrderkey(updata)
|
|
|
- .then(({
|
|
|
- data
|
|
|
- }) => {
|
|
|
- this.integralShow = true;
|
|
|
- // 获取支付金额
|
|
|
- this.payPrice = +data.result.pay_price;
|
|
|
- this.integralMoney = data.result.deduction_price;
|
|
|
- })
|
|
|
- .catch(e => {
|
|
|
- console.log(e);
|
|
|
- this.integralShow = false;
|
|
|
- });
|
|
|
- },
|
|
|
- // 加载基础数据
|
|
|
- loadData() {
|
|
|
- let obj = this;
|
|
|
- confirm({
|
|
|
- cartId: obj.cartId + '',
|
|
|
- longitude: uni.getStorageSync('CACHE_LONGITUDE'),
|
|
|
- latitude: uni.getStorageSync('CACHE_LATITUDE'),
|
|
|
- }).then(({
|
|
|
- data
|
|
|
- }) => {
|
|
|
- obj.certificate_info.id = data.certificate_info.id;
|
|
|
- obj.certificate_info.num = data.certificate_info.num;
|
|
|
- obj.addressData = data.addressInfo || {};
|
|
|
- obj.shopList = data.cartInfo; //商品列表
|
|
|
- obj.moneyAll = data.priceGroup; //金额数据
|
|
|
- obj.orderKey = data.orderKey; //订单key
|
|
|
- obj.shopAddress = data.system_store; //到店自提列表
|
|
|
- obj.shopAddress.address = data.system_store.address.join(','); //到店自提列表
|
|
|
- // 计算金额
|
|
|
- this.payMoneyNub();
|
|
|
- });
|
|
|
- },
|
|
|
- // 提交订单
|
|
|
- submit() {
|
|
|
- let obj = this;
|
|
|
- if (!this.addressData.real_name) {
|
|
|
- this.$api.msg('请选择收货地址');
|
|
|
- return false;
|
|
|
- }
|
|
|
- // 判断是否余额不足
|
|
|
- if (obj.payType == 'yue' && +obj.now_money < obj.payPrice) {
|
|
|
- uni.showModal({
|
|
|
- title: '提示',
|
|
|
- content: '账户余额不足!',
|
|
|
- showCancel: false,
|
|
|
- });
|
|
|
- return;
|
|
|
- }
|
|
|
- if (!obj.day.day&&obj.tabCurrentIndex==1) {
|
|
|
- uni.showModal({
|
|
|
- title: '提示',
|
|
|
- content: '请选择送水时间!',
|
|
|
- showCancel: false,
|
|
|
- });
|
|
|
- return
|
|
|
- }
|
|
|
-
|
|
|
- uni.showLoading({
|
|
|
- title: '支付中',
|
|
|
- mask: true
|
|
|
- })
|
|
|
- // 支付中
|
|
|
- obj.payLoding = true;
|
|
|
- // 判断是否为未支付订单中跳转进入
|
|
|
- obj.firstCreateOrder();
|
|
|
- },
|
|
|
- // 订单金额支付
|
|
|
- orderMoneyPay() {
|
|
|
- let obj = this;
|
|
|
- orderPay({
|
|
|
- uni: obj.orderId,
|
|
|
- // #ifdef H5
|
|
|
- from: 'weixin', //来源
|
|
|
- // #endif
|
|
|
- // #ifdef MP-WEIXIN
|
|
|
- from: 'routine', //来源
|
|
|
- // #endif
|
|
|
- // #ifdef APP-PLUS
|
|
|
- from: 'app', //来源
|
|
|
- // #endif
|
|
|
- paytype: obj.payType //支付类型 weixin-微信 yue-余额
|
|
|
- })
|
|
|
- .then(e => {
|
|
|
- // 判断是否微信小程序支付
|
|
|
- if (obj.payType == 'weixin') {
|
|
|
- // #ifdef H5 || MP
|
|
|
- let da = e.data.result.jsConfig;
|
|
|
- let data = {
|
|
|
- nonceStr: da.nonceStr,
|
|
|
- package: da.package,
|
|
|
- signType: da.signType,
|
|
|
- paySign: da.paySign,
|
|
|
- success: function(res) {
|
|
|
- obj.paySuccessTo();
|
|
|
- },
|
|
|
- fail: () => {
|
|
|
- uni.navigateTo({
|
|
|
- url: '/pages/order/order?state=0'
|
|
|
- });
|
|
|
- }
|
|
|
- };
|
|
|
- // #endif
|
|
|
- // #ifdef H5
|
|
|
- data.timestamp = da.timestamp;
|
|
|
- weixinObj.chooseWXPay(data);
|
|
|
- // #endif
|
|
|
- // #ifdef MP-WEIXIN
|
|
|
- data.timeStamp = da.timestamp;
|
|
|
- wx.requestPayment(data);
|
|
|
- // #endif
|
|
|
- // #ifdef APP
|
|
|
- console.log(e.data.result.jsConfig, '返回数值');
|
|
|
- uni.requestPayment({
|
|
|
- provider: 'wxpay',
|
|
|
- orderInfo: e.data.result.jsConfig,
|
|
|
- success(e) {
|
|
|
- obj.paySuccessTo();
|
|
|
- },
|
|
|
- fail: (e) => {
|
|
|
- console.log(e, '支付失败');
|
|
|
- uni.navigateTo({
|
|
|
- url: '/pages/order/order?state=0'
|
|
|
- });
|
|
|
- }
|
|
|
- })
|
|
|
- // #endif
|
|
|
- }
|
|
|
- // #ifdef APP
|
|
|
- if (obj.payType == 'ali') {
|
|
|
- uni.requestPayment({
|
|
|
- provider: 'alipay',
|
|
|
- orderInfo: e.data.result.jsConfig,
|
|
|
- success(e) {
|
|
|
- obj.paySuccessTo();
|
|
|
- },
|
|
|
- fail: (e) => {
|
|
|
- console.log(e, '支付失败');
|
|
|
- uni.navigateTo({
|
|
|
- url: '/pages/order/order?state=0'
|
|
|
- });
|
|
|
- }
|
|
|
- })
|
|
|
- }
|
|
|
- // #endif
|
|
|
- uni.hideLoading();
|
|
|
- obj.payLoding = false;
|
|
|
- })
|
|
|
- .catch(e => {
|
|
|
- // 支付完成
|
|
|
- uni.hideLoading();
|
|
|
- obj.payLoding = false;
|
|
|
- console.log(e);
|
|
|
- });
|
|
|
- },
|
|
|
- // 支付成功跳转
|
|
|
- paySuccessTo() {
|
|
|
- uni.hideLoading();
|
|
|
- uni.redirectTo({
|
|
|
- url: '/pages/user/money/paySuccess?orderid=' + this.orderId,
|
|
|
- });
|
|
|
- },
|
|
|
- // 初次订单创建
|
|
|
- firstCreateOrder() {
|
|
|
- let obj = this;
|
|
|
- console.log(obj.day, 'obj.day');
|
|
|
- let data = {
|
|
|
- real_name: obj.addressData.real_name, //联系人名称
|
|
|
- phone: obj.addressData.phone, //联系人号码
|
|
|
- addressId: obj.addressData.id, //支付地址id
|
|
|
- useIntegral: 0, //是否积分抵扣1为是0为否
|
|
|
- payType: obj.payType, //支付类型 weixin-微信 yue-余额
|
|
|
- mark: obj.desc, //备注
|
|
|
- // #ifdef H5
|
|
|
- from: 'weixin', //来源
|
|
|
- // #endif
|
|
|
- // #ifdef MP-WEIXIN
|
|
|
- from: 'routine', //来源
|
|
|
- // #endif
|
|
|
- // #ifdef APP-PLUS
|
|
|
- from: 'app', //来源
|
|
|
- // #endif
|
|
|
- shipping_type: obj.tabCurrentIndex, //提货方式 1 快递 2自提
|
|
|
- store_id: obj.shopAddress.id || '',
|
|
|
- day: obj.day.day,
|
|
|
- door_id: obj.day.door_id
|
|
|
- };
|
|
|
- if (obj.certificate_info.checked) {
|
|
|
- data.use_certificate_id = obj.certificate_info.id
|
|
|
- }
|
|
|
- // 生成订单
|
|
|
- createOrderkey(data, obj.orderKey)
|
|
|
- .then(({
|
|
|
- data,
|
|
|
- status,
|
|
|
- msg
|
|
|
- }) => {
|
|
|
- // 判断是否支付失败
|
|
|
- if (data.status == 'ORDER_EXIST') {
|
|
|
- uni.showModal({
|
|
|
- title: '提示',
|
|
|
- content: msg,
|
|
|
- showCancel: false
|
|
|
- });
|
|
|
- uni.hideLoading();
|
|
|
- obj.payLoding = false;
|
|
|
- return;
|
|
|
- }
|
|
|
- // 保存订单号
|
|
|
- obj.orderId = data.result.orderId;
|
|
|
-
|
|
|
- if(obj.certificate_info.checked&&obj.payPrice==0){
|
|
|
- if (status == 200 && data.status == 'SUCCESS') {
|
|
|
- obj.paySuccessTo();
|
|
|
- } else {
|
|
|
- obj.$api.msg(msg);
|
|
|
- }
|
|
|
- return
|
|
|
- }
|
|
|
-
|
|
|
-
|
|
|
- // 判断是否为余额支付
|
|
|
- if (obj.payType == 'yue' || obj.payType == 'offline') {
|
|
|
- if (status == 200 && data.status == 'SUCCESS') {
|
|
|
- obj.paySuccessTo();
|
|
|
- } else {
|
|
|
- obj.$api.msg(msg);
|
|
|
- }
|
|
|
- } else {
|
|
|
- // 立即支付
|
|
|
- obj.orderMoneyPay();
|
|
|
- }
|
|
|
- })
|
|
|
- .catch(e => {
|
|
|
- uni.hideLoading();
|
|
|
- obj.payLoding = false;
|
|
|
- console.log(e);
|
|
|
- });
|
|
|
- }
|
|
|
- }
|
|
|
- };
|
|
|
-</script>
|
|
|
-
|
|
|
-<style lang="scss">
|
|
|
- .content {
|
|
|
- padding-bottom: 100rpx;
|
|
|
- }
|
|
|
-
|
|
|
- .address-section {
|
|
|
- border-radius: 20rpx;
|
|
|
- padding: 30rpx;
|
|
|
- margin: 0 $page-row-spacing;
|
|
|
- background: #fff;
|
|
|
- position: relative;
|
|
|
-
|
|
|
- .order-content {
|
|
|
- min-height: 100rpx;
|
|
|
- display: flex;
|
|
|
- align-items: center;
|
|
|
-
|
|
|
- .leftIcon {
|
|
|
- width: 36rpx;
|
|
|
- margin: 0 30rpx;
|
|
|
- }
|
|
|
-
|
|
|
- .addAddress {
|
|
|
- text-align: center;
|
|
|
- width: 100%;
|
|
|
- display: flex;
|
|
|
- justify-content: center;
|
|
|
- align-items: center;
|
|
|
-
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- .cen {
|
|
|
- display: flex;
|
|
|
- flex-direction: column;
|
|
|
- font-size: 28rpx;
|
|
|
- color: $font-color-dark;
|
|
|
- width: 0px;
|
|
|
- flex-grow: 1;
|
|
|
- }
|
|
|
-
|
|
|
- .name {
|
|
|
- font-size: 34rpx;
|
|
|
- margin-right: 24rpx;
|
|
|
- }
|
|
|
-
|
|
|
- .address {
|
|
|
- margin-top: 16rpx;
|
|
|
- margin-right: 20rpx;
|
|
|
- color: $font-color-light;
|
|
|
- }
|
|
|
-
|
|
|
- }
|
|
|
-
|
|
|
- .goodsList {
|
|
|
- margin: 0 $page-row-spacing;
|
|
|
- padding: 30rpx;
|
|
|
- background: #fff;
|
|
|
- border-radius: 20rpx;
|
|
|
- margin-top: 30rpx;
|
|
|
- }
|
|
|
-
|
|
|
- .goods-section {
|
|
|
- .logo {
|
|
|
- display: block;
|
|
|
- width: 50rpx;
|
|
|
- height: 50rpx;
|
|
|
- border-radius: 100px;
|
|
|
- }
|
|
|
-
|
|
|
- .name {
|
|
|
- font-size: 30rpx;
|
|
|
- color: $font-color-base;
|
|
|
- margin-left: 24rpx;
|
|
|
- }
|
|
|
-
|
|
|
- .g-item {
|
|
|
- display: flex;
|
|
|
-
|
|
|
- image {
|
|
|
- flex-shrink: 0;
|
|
|
- display: block;
|
|
|
- width: 170rpx;
|
|
|
- height: 170rpx;
|
|
|
- border-radius: 4rpx;
|
|
|
- }
|
|
|
-
|
|
|
- .right {
|
|
|
- flex: 1;
|
|
|
- padding-left: 24rpx;
|
|
|
- overflow: hidden;
|
|
|
-
|
|
|
- .serverSet {
|
|
|
- font-size: 22rpx;
|
|
|
- color: $font-color-light;
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- .title {
|
|
|
- font-size: 30rpx;
|
|
|
- color: $font-color-dark;
|
|
|
- }
|
|
|
-
|
|
|
- .spec {
|
|
|
- font-size: 26rpx;
|
|
|
- color: $font-color-light;
|
|
|
- }
|
|
|
-
|
|
|
- .price-box {
|
|
|
- display: flex;
|
|
|
- align-items: center;
|
|
|
- font-size: 32rpx;
|
|
|
- padding-top: 10rpx;
|
|
|
- color: $font-color-light;
|
|
|
-
|
|
|
- .price {
|
|
|
- margin-bottom: 4rpx;
|
|
|
- }
|
|
|
-
|
|
|
- .number {
|
|
|
- font-size: 26rpx;
|
|
|
- margin-left: 20rpx;
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- .step-box {
|
|
|
- position: relative;
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- .yt-list {
|
|
|
- background: #fff;
|
|
|
- margin: 0 $page-row-spacing;
|
|
|
- margin-top: 30rpx;
|
|
|
- border-radius: 20rpx;
|
|
|
- }
|
|
|
-
|
|
|
- .yt-list-cell {
|
|
|
- display: flex;
|
|
|
- align-items: center;
|
|
|
- justify-content: space-between;
|
|
|
- padding: 10rpx 30rpx 10rpx 40rpx;
|
|
|
- line-height: 70rpx;
|
|
|
- position: relative;
|
|
|
-
|
|
|
- .checked,
|
|
|
- .noChecked {
|
|
|
- width: 36rpx;
|
|
|
- height: 36rpx;
|
|
|
- }
|
|
|
-
|
|
|
- .noChecked {
|
|
|
- border: 1px solid $font-color-light;
|
|
|
- border-radius: 100rpx;
|
|
|
- }
|
|
|
-
|
|
|
- &.cell-hover {
|
|
|
- background: #fafafa;
|
|
|
- }
|
|
|
-
|
|
|
- &.b-b:after {
|
|
|
- left: 30rpx;
|
|
|
- }
|
|
|
-
|
|
|
- .cell-icon {
|
|
|
- height: 32rpx;
|
|
|
- width: 32rpx;
|
|
|
- font-size: 22rpx;
|
|
|
- color: #fff;
|
|
|
- text-align: center;
|
|
|
- line-height: 32rpx;
|
|
|
- background: #f85e52;
|
|
|
- border-radius: 4rpx;
|
|
|
- margin-right: 12rpx;
|
|
|
-
|
|
|
- &.hb {
|
|
|
- background: #ffaa0e;
|
|
|
- }
|
|
|
-
|
|
|
- &.lpk {
|
|
|
- background: #3ab54a;
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- .cell-more {
|
|
|
- align-self: center;
|
|
|
- font-size: 24rpx;
|
|
|
- color: $font-color-light;
|
|
|
- margin-left: 8rpx;
|
|
|
- margin-right: -10rpx;
|
|
|
- }
|
|
|
-
|
|
|
- .cell-tit {
|
|
|
- font-size: 26rpx;
|
|
|
- color: $font-color-light;
|
|
|
- margin-right: 10rpx;
|
|
|
-
|
|
|
- .orderIcon {
|
|
|
- width: 48rpx;
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- .cell-tip {
|
|
|
- font-size: 26rpx;
|
|
|
- color: $font-color-dark;
|
|
|
-
|
|
|
- &.disabled {
|
|
|
- color: $font-color-light;
|
|
|
- }
|
|
|
-
|
|
|
- &.active {
|
|
|
- color: $base-color;
|
|
|
- }
|
|
|
-
|
|
|
- &.red {
|
|
|
- color: $base-color;
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- &.desc-cell {
|
|
|
- .cell-tit {
|
|
|
- max-width: 90rpx;
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- .desc {
|
|
|
- text-align: right;
|
|
|
- font-size: $font-base;
|
|
|
- color: $font-color-light;
|
|
|
-
|
|
|
- .switchCard {
|
|
|
- margin-right: -20rpx;
|
|
|
-
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- /* 支付列表 */
|
|
|
- .pay-list {
|
|
|
- padding-left: 40rpx;
|
|
|
- margin-top: 16rpx;
|
|
|
- background: #fff;
|
|
|
-
|
|
|
- .pay-item {
|
|
|
- display: flex;
|
|
|
- align-items: center;
|
|
|
- padding-right: 20rpx;
|
|
|
- line-height: 1;
|
|
|
- height: 110rpx;
|
|
|
- position: relative;
|
|
|
- }
|
|
|
-
|
|
|
- .icon-weixinzhifu {
|
|
|
- width: 80rpx;
|
|
|
- font-size: 40rpx;
|
|
|
- color: #6bcc03;
|
|
|
- }
|
|
|
-
|
|
|
- .icon-alipay {
|
|
|
- width: 80rpx;
|
|
|
- font-size: 40rpx;
|
|
|
- color: #06b4fd;
|
|
|
- }
|
|
|
-
|
|
|
- .icon-xuanzhong2 {
|
|
|
- display: flex;
|
|
|
- align-items: center;
|
|
|
- justify-content: center;
|
|
|
- width: 60rpx;
|
|
|
- height: 60rpx;
|
|
|
- font-size: 40rpx;
|
|
|
- color: $base-color;
|
|
|
- }
|
|
|
-
|
|
|
- .tit {
|
|
|
- font-size: 32rpx;
|
|
|
- color: $font-color-dark;
|
|
|
- flex: 1;
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- .footer {
|
|
|
- position: fixed;
|
|
|
- left: 0;
|
|
|
- bottom: 0;
|
|
|
- z-index: 995;
|
|
|
- display: flex;
|
|
|
- align-items: center;
|
|
|
- width: 100%;
|
|
|
- height: 90rpx;
|
|
|
- justify-content: space-between;
|
|
|
- font-size: 30rpx;
|
|
|
- background-color: #fff;
|
|
|
- z-index: 998;
|
|
|
- color: $font-color-base;
|
|
|
- box-shadow: 0 -1px 5px rgba(0, 0, 0, 0.1);
|
|
|
-
|
|
|
- .price-content {
|
|
|
- padding-left: 30rpx;
|
|
|
- }
|
|
|
-
|
|
|
- .price-tip {
|
|
|
- color: $font-color-base;
|
|
|
- margin-left: 8rpx;
|
|
|
- }
|
|
|
-
|
|
|
- .price {
|
|
|
- font-size: 36rpx;
|
|
|
- color: $font-color-base;
|
|
|
- }
|
|
|
-
|
|
|
- .submit {
|
|
|
- display: flex;
|
|
|
- align-items: center;
|
|
|
- justify-content: center;
|
|
|
- width: 280rpx;
|
|
|
- height: 100%;
|
|
|
- color: #fff;
|
|
|
- font-size: 32rpx;
|
|
|
- background: $bg-gradual;
|
|
|
-
|
|
|
- &.submitNo {
|
|
|
- background-color: $font-color-disabled;
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- .tab-address {
|
|
|
- margin-bottom: 30rpx;
|
|
|
- margin-top: 0;
|
|
|
-
|
|
|
- .left {
|
|
|
- font-size: $font-base;
|
|
|
- }
|
|
|
-
|
|
|
- .right {
|
|
|
- font-size: $font-sm;
|
|
|
- color: #FFF;
|
|
|
- background: $bg-gradual;
|
|
|
- padding: 6rpx;
|
|
|
- border-radius: 10rpx;
|
|
|
- line-height: 1;
|
|
|
-
|
|
|
- .item {
|
|
|
- padding: 16rpx 20rpx;
|
|
|
-
|
|
|
- &.action {
|
|
|
- color: $uni-color-primary;
|
|
|
- background-color: #FFF;
|
|
|
- border-radius: 10rpx;
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- .shop-box {
|
|
|
- .shop-top {
|
|
|
- width: 100%;
|
|
|
-
|
|
|
- .shop-title {
|
|
|
- width: 0px;
|
|
|
- flex-grow: 1;
|
|
|
- justify-content: flex-start;
|
|
|
-
|
|
|
- .shopImg {
|
|
|
- height: 65rpx;
|
|
|
- width: 65rpx;
|
|
|
- border-radius: 100rpx;
|
|
|
- margin-right: 20rpx;
|
|
|
- flex-shrink: 0;
|
|
|
- }
|
|
|
-
|
|
|
- .shop-name {
|
|
|
- font-weight: bold;
|
|
|
- font-size: $font-lg;
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- .shop-tip {
|
|
|
- color: #FFF;
|
|
|
- padding: 5rpx 10rpx;
|
|
|
- font-size: $font-sm;
|
|
|
- background: linear-gradient(-90deg, #DCB876 0%, #EECD92 100%);
|
|
|
- border-radius: 5rpx;
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- .shop-content {
|
|
|
- color: $font-color-light;
|
|
|
- font-size: $font-sm;
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- .alertTime {
|
|
|
- z-index: 1000;
|
|
|
-
|
|
|
- .alert-box {
|
|
|
- background-color: #FFF;
|
|
|
- border-top-right-radius: 20rpx;
|
|
|
- border-top-left-radius: 20rpx;
|
|
|
-
|
|
|
- .right-content {
|
|
|
- width: 70%;
|
|
|
-
|
|
|
- .list {
|
|
|
- padding: 20rpx 30rpx;
|
|
|
- font-size: $font-sm;
|
|
|
- border-bottom: 1px solid $border-color-light;
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- .left-title {
|
|
|
- width: 30%;
|
|
|
- align-self: flex-start;
|
|
|
-
|
|
|
- .title {
|
|
|
- padding: 30rpx;
|
|
|
- text-align: center;
|
|
|
- font-weight: bold;
|
|
|
- font-size: $font-sm;
|
|
|
- background-color: rgba(246, 246, 246, 1);
|
|
|
-
|
|
|
- &.action {
|
|
|
- background-color: #FFF;
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- .alert-title {
|
|
|
- text-align: center;
|
|
|
- padding: 30rpx;
|
|
|
- line-height: 1;
|
|
|
- font-weight: bold;
|
|
|
- }
|
|
|
-
|
|
|
- .tip {
|
|
|
- position: absolute;
|
|
|
- top: 30rpx;
|
|
|
- right: 30rpx;
|
|
|
- color: $font-color-disabled;
|
|
|
- font-weight: bold;
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- /deep/ .uni-switch-input {
|
|
|
- &.uni-switch-input-checked {
|
|
|
- border-color: $base-color !important;
|
|
|
- background-color: $base-color !important;
|
|
|
- }
|
|
|
- }
|
|
|
-</style>
|