多余代码优化,界面优化
This commit is contained in:
parent
bf0e339fe8
commit
2ef6021989
@ -1,8 +1,8 @@
|
||||
<template>
|
||||
<view class="container" v-if="merchantInfo">
|
||||
<view class="container" v-if="merchantInfo && !isEmpty">
|
||||
<view class="v-navbar">
|
||||
<u-navbar title="面对面收款" :safeAreaInsetTop="false" :fixed="false" :autoBack="true" bgColor="transparent"
|
||||
leftIconColor="#fff" :titleStyle="{color:'#fff',fontWeight:'bold',fontSize:'34rpx'}">
|
||||
leftIconColor="#fff" :titleStyle="{color:'#fff',fontWeight:'bold',fontSize:'32rpx'}">
|
||||
</u-navbar>
|
||||
</view>
|
||||
|
||||
@ -35,13 +35,18 @@
|
||||
<view class="v-wrap-desc-sub">即买即用</view>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
</view>
|
||||
|
||||
<view class="v-btn-wrap">
|
||||
<view class="v-btn" @click="submitOrder">提交订单</view>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<!-- 无商户信息提示 -->
|
||||
<view v-else class="empty">
|
||||
<image src="/static/images/no_thing.png"></image>
|
||||
<text>该商户没有上架提货卡~</text>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
@ -53,6 +58,7 @@
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
isEmpty: false,
|
||||
cartForm: {
|
||||
product_id: '',
|
||||
product_attr_unique: '',
|
||||
@ -77,11 +83,10 @@
|
||||
},
|
||||
|
||||
onLoad(opt) {
|
||||
this.getProductInfoByMerid(opt.mer_id || 31);
|
||||
this.getProductInfoByMerid(opt.mer_id);
|
||||
},
|
||||
|
||||
methods: {
|
||||
|
||||
// 提交订单
|
||||
submitOrder() {
|
||||
if (!this.cartForm.total_amount) {
|
||||
@ -94,13 +99,12 @@
|
||||
this.cartForm.product_type = this.merchantInfo.product_type;
|
||||
this.cartForm.product_attr_unique = this.merchantInfo.sku[''].unique;
|
||||
|
||||
|
||||
let that = this;
|
||||
addCart(this.cartForm).then(res => {
|
||||
// 购物车ID
|
||||
this.checkForm.cart_id.push(res.data.cart_id);
|
||||
this.$util.Tips({
|
||||
title: "添加购物车成功!"
|
||||
that.checkForm.cart_id.push(res.data.cart_id);
|
||||
that.$util.Tips({
|
||||
title: "操作成功!"
|
||||
}, () => {
|
||||
orderCheck(that.checkForm).then(res => {
|
||||
uni.navigateTo({
|
||||
@ -112,7 +116,7 @@
|
||||
});
|
||||
}).catch(() => {
|
||||
this.$util.Tips({
|
||||
title: "添加购物车失败!"
|
||||
title: "操作失败!"
|
||||
})
|
||||
})
|
||||
},
|
||||
@ -124,12 +128,19 @@
|
||||
}).then(res => {
|
||||
this.merchantInfo = res.data;
|
||||
}).catch((err) => {
|
||||
that.$util.Tips({
|
||||
title: err.message
|
||||
});
|
||||
// #ifdef APP
|
||||
uni.navigateBack({
|
||||
delta: 1
|
||||
})
|
||||
// #endif
|
||||
|
||||
// #ifndef APP
|
||||
that.isEmpty = true;
|
||||
// #endif
|
||||
})
|
||||
},
|
||||
|
||||
// 图片保存
|
||||
handleSavePic() {
|
||||
// 获取要保存的图片路径或URL
|
||||
let imageUrl = this.qrcodeUrl; // 这里使用了网络上的图片作为示例
|
||||
@ -175,11 +186,29 @@
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
<style lang="scss">
|
||||
page {
|
||||
background-color: #FCDFAD;
|
||||
}
|
||||
|
||||
.empty {
|
||||
margin: 130rpx 0 150rpx;
|
||||
text-align: center;
|
||||
|
||||
image,
|
||||
uni-image {
|
||||
display: inline-block;
|
||||
width: 414rpx;
|
||||
height: 305rpx;
|
||||
}
|
||||
|
||||
text {
|
||||
display: block;
|
||||
color: #666;
|
||||
font-size: 26rpx;
|
||||
}
|
||||
}
|
||||
|
||||
.container {
|
||||
position: relative;
|
||||
height: 100vh;
|
||||
@ -219,9 +248,9 @@
|
||||
left: 50%;
|
||||
transform: translateX(-50%);
|
||||
width: 710rpx;
|
||||
height: 1166rpx;
|
||||
height: 680rpx;
|
||||
background: linear-gradient(180deg, #FEB992 0%, #FFFFFF 31%, #FFFFFF 100%);
|
||||
border-radius: 20rpx 20rpx 0rpx 0rpx;
|
||||
border-radius: 20rpx;
|
||||
margin: 0 auto;
|
||||
box-shadow: 0 -4rpx 0px 0px #fff;
|
||||
padding: 53rpx 30rpx 0 30rpx;
|
||||
@ -297,7 +326,7 @@
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
width: 100%;
|
||||
height: 140rpx;
|
||||
height: 240rpx;
|
||||
background-color: #FCDFAD;
|
||||
|
||||
.v-btn {
|
||||
|
@ -86,7 +86,7 @@
|
||||
<view class='item acea-row row-between-wrapper'>
|
||||
<view>补贴抵扣</view>
|
||||
<block v-if="platformConsumption.length > 0">
|
||||
<view class='discount money red_packet' @tap='couponTap3()'>
|
||||
<view class='discount money red_packet'>
|
||||
<text v-if="consumption_id">-¥{{consumption_money||'0.00'}}</text>
|
||||
<text v-else>有补贴补贴未选</text>
|
||||
<text class='iconfont icon-jiantou'></text>
|
||||
@ -143,15 +143,11 @@
|
||||
import {
|
||||
presellAgreement
|
||||
} from '@/api/activity.js';
|
||||
import {
|
||||
storeListApi
|
||||
} from '@/api/store.js';
|
||||
import {
|
||||
CACHE_LONGITUDE,
|
||||
CACHE_LATITUDE
|
||||
} from '@/config/cache.js';
|
||||
import couponListWindow from '@/components/orderCoupon';
|
||||
import addressWindow from '@/components/addressWindow';
|
||||
import orderGoods from '@/components/orderGoods';
|
||||
import checkDelivery from '@/components/checkDelivery/index.vue';
|
||||
import discountDetails from '@/components/discountDetails/index.vue';
|
||||
@ -178,7 +174,6 @@
|
||||
export default {
|
||||
components: {
|
||||
couponListWindow,
|
||||
addressWindow,
|
||||
orderGoods,
|
||||
checkDelivery,
|
||||
addInvoicing,
|
||||
@ -257,31 +252,16 @@
|
||||
couponId: 0, //优惠券id
|
||||
cartId: '', //购物车id
|
||||
userInfo: {}, //用户信息
|
||||
post: {},
|
||||
coupon_price: 0, //优惠券抵扣金额
|
||||
useIntegral: false, //是否使用积分
|
||||
integral_price: 0, //积分抵扣金额
|
||||
integral: 0,
|
||||
ChangePrice: 0, //使用积分抵扣变动后的金额
|
||||
formIds: [], //收集formid
|
||||
status: 0,
|
||||
is_address: false,
|
||||
toPay: false, //修复进入支付时页面隐藏从新刷新页面
|
||||
shippingType: 0,
|
||||
system_store: {},
|
||||
storePostage: 0,
|
||||
contacts: '',
|
||||
contactsTel: '',
|
||||
mydata: {},
|
||||
storeList: [],
|
||||
store_self_mention: 0,
|
||||
cartInfo: [],
|
||||
priceGroup: {},
|
||||
animated: false,
|
||||
totalPrice: 0,
|
||||
use_integral: false,
|
||||
pagesUrl: "",
|
||||
orderKey: "",
|
||||
offlinePostage: "",
|
||||
isAuto: false, //没有授权的不会自动授权
|
||||
isShowAuth: false, //是否隐藏授权
|
||||
@ -302,13 +282,11 @@
|
||||
couponData: {},
|
||||
orderPay: false,
|
||||
take: [],
|
||||
open_integral: 0,
|
||||
coupon_number: 0,
|
||||
store_coupon_number: 0,
|
||||
coupon_amount: 0,
|
||||
store_coupon_amount: 0,
|
||||
plant_coupon_amount: 0,
|
||||
integral_count: '',
|
||||
pics: [],
|
||||
order_model: 2,
|
||||
order_extend: [],
|
||||
@ -355,7 +333,6 @@
|
||||
this.payForm.money = options.money;
|
||||
this.payForm.merName = options.merName;
|
||||
|
||||
|
||||
// #ifdef H5
|
||||
this.from = this.$wechat.isWeixin() ? 'weixin' : 'h5'
|
||||
// #endif
|
||||
@ -373,50 +350,15 @@
|
||||
if (this.payType == 'weixin') {
|
||||
this.payType = this.from
|
||||
}
|
||||
let _this = this
|
||||
uni.setStorage({
|
||||
key: 'invoice_Data',
|
||||
data: {},
|
||||
success: function() {}
|
||||
})
|
||||
},
|
||||
/**
|
||||
* 生命周期函数--监听页面显示
|
||||
*/
|
||||
onShow: function() {
|
||||
|
||||
this.getUserInfo()
|
||||
|
||||
return;
|
||||
let that = this;
|
||||
if (this.isLogin && this.toPay == false && !this.orderPay) {
|
||||
// this.getaddressInfo();
|
||||
this.$nextTick(function() {
|
||||
this.$refs.addressWindow.getAddressList();
|
||||
})
|
||||
}
|
||||
},
|
||||
|
||||
methods: {
|
||||
// 图片预览
|
||||
// 获得相册 idx
|
||||
getPhotoClickIdx(e) {
|
||||
let _this = this;
|
||||
let idx = e.currentTarget.dataset.index;
|
||||
_this.imgPreview(_this.pics, idx);
|
||||
},
|
||||
|
||||
// 图片预览
|
||||
imgPreview: function(list, idx) {
|
||||
// list:图片 url 数组
|
||||
if (list && list.length > 0) {
|
||||
uni.previewImage({
|
||||
current: list[idx], // 传 Number H5端出现不兼容
|
||||
urls: list
|
||||
});
|
||||
}
|
||||
},
|
||||
|
||||
// 获取个人信息
|
||||
getUserInfo() {
|
||||
getUserInfo().then(res => {
|
||||
@ -424,18 +366,6 @@
|
||||
})
|
||||
},
|
||||
|
||||
/**
|
||||
* 授权回调事件
|
||||
*
|
||||
*/
|
||||
onLoadFun: function() {
|
||||
this.isShowAuth = false;
|
||||
this.getaddressInfo();
|
||||
this.getUserInfo();
|
||||
//调用子页面方法授权后执行获取地址列表
|
||||
// this.$scope.selectComponent('#address-window').getAddressList();
|
||||
},
|
||||
|
||||
payItem: function(e) {
|
||||
let that = this;
|
||||
let active = e;
|
||||
@ -448,47 +378,12 @@
|
||||
}
|
||||
},
|
||||
|
||||
couponTap: function(item, index) {
|
||||
this.coupon = item
|
||||
this.$set(this.coupon, 'status', true)
|
||||
this.couponIndex = index
|
||||
this.plantCoupon = false
|
||||
this.$set(this, "coupon_number", this.store_coupon_number);
|
||||
this.$set(this, "coupon_amount", this.store_coupon_amount);
|
||||
},
|
||||
couponTap2: function(item, index) {
|
||||
this.coupon = {
|
||||
coupon: item,
|
||||
mer_id: 0,
|
||||
status: true
|
||||
}
|
||||
this.plantCoupon = true
|
||||
this.$set(this, "coupon_number", this.subCoupon['0'].length);
|
||||
this.$set(this, "coupon_amount", this.plant_coupon_amount);
|
||||
},
|
||||
couponTap3: function(item, index) {
|
||||
uni.navigateTo({
|
||||
url: '/pages/redpacket/redpacket',
|
||||
success: (res) => {
|
||||
res.eventChannel.emit('changeRedPacketInfo', this.platformConsumption)
|
||||
uni.$once('changeRedPacket', (data) => {
|
||||
this.consumption_id = data;
|
||||
})
|
||||
}
|
||||
})
|
||||
},
|
||||
car: function() {
|
||||
let that = this;
|
||||
that.animated = false;
|
||||
},
|
||||
|
||||
payment: function(data) {
|
||||
let that = this;
|
||||
createOrder(data).then(res => {
|
||||
|
||||
let status = res.data.status,
|
||||
orderId = res.data.result.order_id,
|
||||
// callback_key = res.data.result.pay_key,
|
||||
jsConfig = res.data.result.config,
|
||||
// 暂不跳转
|
||||
goPages = '/pages/order_pay_status/index?order_id=' + orderId + '&msg=' + res.message +
|
||||
@ -585,15 +480,6 @@
|
||||
},
|
||||
complete: (res) => {
|
||||
uni.hideLoading();
|
||||
// 暂不跳转
|
||||
// let url = '/pages/order_pay_status/index?order_id=' + orderId +
|
||||
// '&msg=取消支付' + '&product_type=' + that.product_type + '&source=' + that.source;
|
||||
// return that.$util.Tips({
|
||||
// title: '取消支付',
|
||||
// }, {
|
||||
// tab: 4,
|
||||
// url: url
|
||||
// });
|
||||
},
|
||||
});
|
||||
// #endif
|
||||
@ -659,49 +545,6 @@
|
||||
}, 100);
|
||||
break;
|
||||
// #endif
|
||||
// #ifdef APP-PLUS
|
||||
case 'alipayApp':
|
||||
uni.requestPayment({
|
||||
provider: 'alipay',
|
||||
orderInfo: jsConfig,
|
||||
success: (e) => {
|
||||
return that.$util.Tips({
|
||||
title: '支付成功',
|
||||
icon: 'success'
|
||||
}, {
|
||||
tab: 5,
|
||||
url: goPages
|
||||
});
|
||||
},
|
||||
fail: (e) => {
|
||||
// 暂不跳转
|
||||
let pages = '/pages/order_pay_status/index?order_id=' +
|
||||
orderId + '&msg=支付失败' + '&product_type=' + that
|
||||
.product_type + '&source=' + that.source
|
||||
return that.$util.Tips({
|
||||
title: '支付失败'
|
||||
}, {
|
||||
tab: 5,
|
||||
url: pages
|
||||
});
|
||||
},
|
||||
complete: () => {
|
||||
uni.hideLoading();
|
||||
// // 暂不跳转
|
||||
// let pages = '/pages/order_pay_status/index?order_id=' +
|
||||
// orderId + '&msg=取消支付' + '&product_type=' + that
|
||||
// .product_type + '&source=' + that.source
|
||||
|
||||
// return that.$util.Tips({
|
||||
// title: '取消支付'
|
||||
// }, {
|
||||
// tab: 5,
|
||||
// url: pages
|
||||
// });
|
||||
},
|
||||
});
|
||||
break;
|
||||
// #endif
|
||||
default:
|
||||
// 暂不跳转
|
||||
let pages = '/pages/order_pay_status/index?order_id=' +
|
||||
@ -732,8 +575,13 @@
|
||||
if (!that.payType) return that.$util.Tips({
|
||||
title: '请选择支付方式'
|
||||
});
|
||||
this.payForm.pay_type = that.payType;
|
||||
|
||||
if (that.payType == 'balance' && this.userInfo.now_money < this.payForm.money) {
|
||||
return that.$util.Tips({
|
||||
title: '余额不足,请选择其他的支付方式!'
|
||||
});
|
||||
}
|
||||
this.payForm.pay_type = that.payType;
|
||||
uni.showLoading({
|
||||
title: '订单支付中',
|
||||
mask: true
|
||||
@ -748,27 +596,12 @@
|
||||
// #ifndef MP
|
||||
that.payment(this.payForm);
|
||||
// #endif
|
||||
},
|
||||
|
||||
// 继续支付
|
||||
closeAndSubOrder() {
|
||||
this.closeTipsRef();
|
||||
this.$nextTick(() => {
|
||||
this.SubOrder();
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
/deep/checkbox .uni-checkbox-input.uni-checkbox-input-checked,
|
||||
/deep/checkbox .wx-checkbox-input.wx-checkbox-input-checked {
|
||||
border: 1px solid var(--view-theme) !important;
|
||||
background-color: var(--view-theme) !important;
|
||||
color: #fff !important;
|
||||
}
|
||||
|
||||
.order-submission .line {
|
||||
position: absolute;
|
||||
left: 0;
|
||||
|
Loading…
x
Reference in New Issue
Block a user