多余代码优化,界面优化

This commit is contained in:
DESKTOP-GMUNQ1B\k 2024-03-01 14:05:02 +08:00
parent bf0e339fe8
commit 2ef6021989
2 changed files with 53 additions and 191 deletions

View File

@ -1,8 +1,8 @@
<template> <template>
<view class="container" v-if="merchantInfo"> <view class="container" v-if="merchantInfo && !isEmpty">
<view class="v-navbar"> <view class="v-navbar">
<u-navbar title="面对面收款" :safeAreaInsetTop="false" :fixed="false" :autoBack="true" bgColor="transparent" <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> </u-navbar>
</view> </view>
@ -35,13 +35,18 @@
<view class="v-wrap-desc-sub">即买即用</view> <view class="v-wrap-desc-sub">即买即用</view>
</view> </view>
</view> </view>
</view> </view>
<view class="v-btn-wrap"> <view class="v-btn-wrap">
<view class="v-btn" @click="submitOrder">提交订单</view> <view class="v-btn" @click="submitOrder">提交订单</view>
</view> </view>
</view> </view>
<!-- 无商户信息提示 -->
<view v-else class="empty">
<image src="/static/images/no_thing.png"></image>
<text>该商户没有上架提货卡~</text>
</view>
</template> </template>
<script> <script>
@ -53,6 +58,7 @@
export default { export default {
data() { data() {
return { return {
isEmpty: false,
cartForm: { cartForm: {
product_id: '', product_id: '',
product_attr_unique: '', product_attr_unique: '',
@ -77,11 +83,10 @@
}, },
onLoad(opt) { onLoad(opt) {
this.getProductInfoByMerid(opt.mer_id || 31); this.getProductInfoByMerid(opt.mer_id);
}, },
methods: { methods: {
// //
submitOrder() { submitOrder() {
if (!this.cartForm.total_amount) { if (!this.cartForm.total_amount) {
@ -94,13 +99,12 @@
this.cartForm.product_type = this.merchantInfo.product_type; this.cartForm.product_type = this.merchantInfo.product_type;
this.cartForm.product_attr_unique = this.merchantInfo.sku[''].unique; this.cartForm.product_attr_unique = this.merchantInfo.sku[''].unique;
let that = this; let that = this;
addCart(this.cartForm).then(res => { addCart(this.cartForm).then(res => {
// ID // ID
this.checkForm.cart_id.push(res.data.cart_id); that.checkForm.cart_id.push(res.data.cart_id);
this.$util.Tips({ that.$util.Tips({
title: "添加购物车成功!" title: "操作成功!"
}, () => { }, () => {
orderCheck(that.checkForm).then(res => { orderCheck(that.checkForm).then(res => {
uni.navigateTo({ uni.navigateTo({
@ -112,7 +116,7 @@
}); });
}).catch(() => { }).catch(() => {
this.$util.Tips({ this.$util.Tips({
title: "添加购物车失败!" title: "操作失败!"
}) })
}) })
}, },
@ -124,12 +128,19 @@
}).then(res => { }).then(res => {
this.merchantInfo = res.data; this.merchantInfo = res.data;
}).catch((err) => { }).catch((err) => {
that.$util.Tips({ // #ifdef APP
title: err.message uni.navigateBack({
}); delta: 1
})
// #endif
// #ifndef APP
that.isEmpty = true;
// #endif
}) })
}, },
//
handleSavePic() { handleSavePic() {
// URL // URL
let imageUrl = this.qrcodeUrl; // 使 let imageUrl = this.qrcodeUrl; // 使
@ -175,11 +186,29 @@
} }
</script> </script>
<style lang="scss" scoped> <style lang="scss">
page { page {
background-color: #FCDFAD; 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 { .container {
position: relative; position: relative;
height: 100vh; height: 100vh;
@ -219,9 +248,9 @@
left: 50%; left: 50%;
transform: translateX(-50%); transform: translateX(-50%);
width: 710rpx; width: 710rpx;
height: 1166rpx; height: 680rpx;
background: linear-gradient(180deg, #FEB992 0%, #FFFFFF 31%, #FFFFFF 100%); background: linear-gradient(180deg, #FEB992 0%, #FFFFFF 31%, #FFFFFF 100%);
border-radius: 20rpx 20rpx 0rpx 0rpx; border-radius: 20rpx;
margin: 0 auto; margin: 0 auto;
box-shadow: 0 -4rpx 0px 0px #fff; box-shadow: 0 -4rpx 0px 0px #fff;
padding: 53rpx 30rpx 0 30rpx; padding: 53rpx 30rpx 0 30rpx;
@ -297,7 +326,7 @@
justify-content: center; justify-content: center;
align-items: center; align-items: center;
width: 100%; width: 100%;
height: 140rpx; height: 240rpx;
background-color: #FCDFAD; background-color: #FCDFAD;
.v-btn { .v-btn {

View File

@ -86,7 +86,7 @@
<view class='item acea-row row-between-wrapper'> <view class='item acea-row row-between-wrapper'>
<view>补贴抵扣</view> <view>补贴抵扣</view>
<block v-if="platformConsumption.length > 0"> <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-if="consumption_id">-{{consumption_money||'0.00'}}</text>
<text v-else>有补贴补贴未选</text> <text v-else>有补贴补贴未选</text>
<text class='iconfont icon-jiantou'></text> <text class='iconfont icon-jiantou'></text>
@ -143,15 +143,11 @@
import { import {
presellAgreement presellAgreement
} from '@/api/activity.js'; } from '@/api/activity.js';
import {
storeListApi
} from '@/api/store.js';
import { import {
CACHE_LONGITUDE, CACHE_LONGITUDE,
CACHE_LATITUDE CACHE_LATITUDE
} from '@/config/cache.js'; } from '@/config/cache.js';
import couponListWindow from '@/components/orderCoupon'; import couponListWindow from '@/components/orderCoupon';
import addressWindow from '@/components/addressWindow';
import orderGoods from '@/components/orderGoods'; import orderGoods from '@/components/orderGoods';
import checkDelivery from '@/components/checkDelivery/index.vue'; import checkDelivery from '@/components/checkDelivery/index.vue';
import discountDetails from '@/components/discountDetails/index.vue'; import discountDetails from '@/components/discountDetails/index.vue';
@ -178,7 +174,6 @@
export default { export default {
components: { components: {
couponListWindow, couponListWindow,
addressWindow,
orderGoods, orderGoods,
checkDelivery, checkDelivery,
addInvoicing, addInvoicing,
@ -257,31 +252,16 @@
couponId: 0, //id couponId: 0, //id
cartId: '', //id cartId: '', //id
userInfo: {}, // userInfo: {}, //
post: {},
coupon_price: 0, // coupon_price: 0, //
useIntegral: false, //使
integral_price: 0, //
integral: 0,
ChangePrice: 0, //使 ChangePrice: 0, //使
formIds: [], //formid formIds: [], //formid
status: 0, status: 0,
is_address: false, is_address: false,
toPay: false, // toPay: false, //
shippingType: 0,
system_store: {},
storePostage: 0,
contacts: '',
contactsTel: '',
mydata: {},
storeList: [],
store_self_mention: 0,
cartInfo: [], cartInfo: [],
priceGroup: {}, priceGroup: {},
animated: false, animated: false,
totalPrice: 0, totalPrice: 0,
use_integral: false,
pagesUrl: "",
orderKey: "",
offlinePostage: "", offlinePostage: "",
isAuto: false, // isAuto: false, //
isShowAuth: false, // isShowAuth: false, //
@ -302,13 +282,11 @@
couponData: {}, couponData: {},
orderPay: false, orderPay: false,
take: [], take: [],
open_integral: 0,
coupon_number: 0, coupon_number: 0,
store_coupon_number: 0, store_coupon_number: 0,
coupon_amount: 0, coupon_amount: 0,
store_coupon_amount: 0, store_coupon_amount: 0,
plant_coupon_amount: 0, plant_coupon_amount: 0,
integral_count: '',
pics: [], pics: [],
order_model: 2, order_model: 2,
order_extend: [], order_extend: [],
@ -355,7 +333,6 @@
this.payForm.money = options.money; this.payForm.money = options.money;
this.payForm.merName = options.merName; this.payForm.merName = options.merName;
// #ifdef H5 // #ifdef H5
this.from = this.$wechat.isWeixin() ? 'weixin' : 'h5' this.from = this.$wechat.isWeixin() ? 'weixin' : 'h5'
// #endif // #endif
@ -373,50 +350,15 @@
if (this.payType == 'weixin') { if (this.payType == 'weixin') {
this.payType = this.from this.payType = this.from
} }
let _this = this
uni.setStorage({
key: 'invoice_Data',
data: {},
success: function() {}
})
}, },
/** /**
* 生命周期函数--监听页面显示 * 生命周期函数--监听页面显示
*/ */
onShow: function() { onShow: function() {
this.getUserInfo() this.getUserInfo()
return;
let that = this;
if (this.isLogin && this.toPay == false && !this.orderPay) {
// this.getaddressInfo();
this.$nextTick(function() {
this.$refs.addressWindow.getAddressList();
})
}
}, },
methods: { 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() {
getUserInfo().then(res => { 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) { payItem: function(e) {
let that = this; let that = this;
let active = e; 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) { payment: function(data) {
let that = this; let that = this;
createOrder(data).then(res => { createOrder(data).then(res => {
let status = res.data.status, let status = res.data.status,
orderId = res.data.result.order_id, orderId = res.data.result.order_id,
// callback_key = res.data.result.pay_key,
jsConfig = res.data.result.config, jsConfig = res.data.result.config,
// //
goPages = '/pages/order_pay_status/index?order_id=' + orderId + '&msg=' + res.message + goPages = '/pages/order_pay_status/index?order_id=' + orderId + '&msg=' + res.message +
@ -585,15 +480,6 @@
}, },
complete: (res) => { complete: (res) => {
uni.hideLoading(); 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 // #endif
@ -659,49 +545,6 @@
}, 100); }, 100);
break; break;
// #endif // #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: default:
// //
let pages = '/pages/order_pay_status/index?order_id=' + let pages = '/pages/order_pay_status/index?order_id=' +
@ -732,8 +575,13 @@
if (!that.payType) return that.$util.Tips({ if (!that.payType) return that.$util.Tips({
title: '请选择支付方式' 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({ uni.showLoading({
title: '订单支付中', title: '订单支付中',
mask: true mask: true
@ -748,27 +596,12 @@
// #ifndef MP // #ifndef MP
that.payment(this.payForm); that.payment(this.payForm);
// #endif // #endif
},
//
closeAndSubOrder() {
this.closeTipsRef();
this.$nextTick(() => {
this.SubOrder();
})
} }
} }
} }
</script> </script>
<style lang="scss" scoped> <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 { .order-submission .line {
position: absolute; position: absolute;
left: 0; left: 0;