This commit is contained in:
2025-10-27 15:55:29 +08:00
commit 6632080b83
513 changed files with 117442 additions and 0 deletions

View File

@@ -0,0 +1,987 @@
.conteiner {
width: 100vw;
height: 100vh;
display: flex;
flex-direction: column;
.point-scroll-view {
flex: 1;
height: 0;
}
}
.point-navbar {
width: 100vw;
padding-bottom: 20rpx;
display: flex;
align-items: center;
position: fixed;
left: 0;
top: 0;
z-index: 100;
background-image: linear-gradient(360deg, #F8F8F8 0%, #E74A32 100%);
background-size: 100% 400rpx;
background-position-y: top;
background-repeat: no-repeat;
.nav-wrap {
height: 100%;
display: flex;
padding: 0 24rpx;
box-sizing: border-box;
}
.back {
background: rgba(255, 255, 255, .4);
display: flex;
align-items: center;
justify-content: center;
border-radius: 50%;
.iconfont {
color: #222222;
font-size: 36rpx;
font-weight: bold;
}
}
.search {
flex: 1;
background: #fff;
margin: 0 15rpx;
border-radius: 30rpx;
display: flex;
align-items: center;
box-sizing: border-box;
padding: 20rpx;
.tips {
color: #4A4A4A;
font-size: 24rpx;
margin-left: 20rpx;
}
}
.sign {
image {
width: 100%;
height: 100%;
}
}
}
.point-navbar-block {
padding-bottom: 20rpx;
}
.point-wrap {
background-image: linear-gradient(360deg, #F8F8F8 0%, #E74A32 100%);
background-size: 100% 380rpx;
background-repeat: no-repeat;
// #ifndef MP-WEIXIN
padding-top: 20rpx
// #endif
}
/* 说明弹框 */
.tips-layer {
background: #fff;
z-index: 999;
height: 40%;
width: 100%;
.head {
position: relative;
}
.title {
height: 80rpx;
line-height: 80rpx;
text-align: center;
font-size: $font-size-toolbar;
font-weight: 700;
}
text {
position: absolute;
top: 8rpx;
right: 22px;
font-size: $font-size-toolbar;
font-weight: 500;
}
.body {
width: 100%;
height: calc(100% - 80rpx);
overflow-y: scroll;
.detail {
padding: 20rpx;
.font-size-base {
margin-bottom: 10rpx;
}
}
}
}
.lineheight-clear {
line-height: 1!important;
}
// 商品列表双列样式
.goods-list.double-column {
display: flex;
flex-wrap: wrap;
margin-top: 20rpx;
.goods-item {
flex: 1;
position: relative;
background-color: #fff;
flex-basis: 48%;
max-width: calc((100% - 24rpx) / 2);
margin-right: 24rpx;
margin-bottom: 24rpx;
border-radius: 18rpx;
&:nth-child(2n) {
margin-right: 0;
}
.goods-img {
position: relative;
overflow: hidden;
padding-top: 100%;
border-top-left-radius: 18rpx;
border-top-right-radius: 18rpx;
image {
width: 100%;
position: absolute;
top: 50%;
left: 0;
transform: translateY(-50%);
}
}
.goods-tag{
color: #fff;
line-height: 1;
padding: 8rpx 16rpx;
position: absolute;
border-bottom-right-radius: $border-radius;
top: 0;
left: 0;
font-size: $font-size-goods-tag;
}
.goods-tag-img {
position: absolute;
border-top-left-radius: $border-radius;
width: 80rpx;
height: 80rpx;
top: 0;
left: 0;
z-index: 5;
overflow: hidden;
image {
width: 100%;
height: 100%;
}
}
.info-wrap {
padding: 0 20rpx 24rpx 20rpx;
}
.goods-name {
line-height: 1.3;
overflow: hidden;
text-overflow: ellipsis;
display: -webkit-box;
-webkit-line-clamp: 2;
-webkit-box-orient: vertical;
margin-top: 20rpx;
font-size: 26rpx;
color: #333;
font-weight: 600;
}
.discount-price {
display: flex;
flex-wrap: wrap;
align-items: center;
font-weight: bold;
line-height: 1;
margin-top: 16rpx;
color: var(--price-color);
overflow: hidden;
flex: 1;
width: 0;
margin-right: 20rpx;
view{
line-height: 1;
color: var(--price-color);
}
.unit {
margin-right: 6rpx;
}
.point{
font-size: 32rpx;
}
}
.pro-info {
display: flex;
margin-top: 16rpx;
justify-content: flex-start;
& > view {
line-height: 1;
display: flex;
align-items: center;
button {
padding: 0 16rpx;
line-height: 2;
}
&:nth-child(2) {
&:before{
content: ' ';
width: 2rpx;
background-color: #D8D8D8;
height: 20rpx;
margin: 0 16rpx;
}
}
}
}
.member-price-tag {
display: inline-block;
width: 60rpx;
line-height: 1;
margin-left: 6rpx;
image {
width: 100%;
}
}
.lineheight-clear {
display: flex;
justify-content: space-between;
align-items: center;
flex-wrap: wrap;
.btn {
width: 96rpx;
height: 50rpx;
line-height: 50rpx;
background: #FF6C24;
border-radius: 50rpx;
text-align: center;
color: #fff;
font-size: 26rpx;
margin-top: 20rpx;
}
}
}
}
.head-wrap {
width: 100vw;
line-height: 1;
position: relative;
height: 270rpx;
& > image {
width: 100%;
}
.wrap {
width: 100%;
height: 100%;
position: absolute;
z-index: 5;
top: 0;
left: 0;
}
.member-wrap {
height: 190rpx;
padding: 50rpx 30rpx 30rpx 30rpx;
display: flex;
align-items: center;
box-sizing: border-box;
.headimg {
width: 100rpx;
height: 100rpx;
background: #fff;
border: 2px solid #fff;
border-radius: 50%;
overflow: hidden;
image {
width: 100%;
height: 100%;
}
}
.point {
margin-left: 30rpx;
color: var(--btn-text-color);
font-size: 36rpx;
}
.point-name {
font-size: $font-size-tag;
color: var(--btn-text-color);
margin-left: 4rpx;
margin-top: 5rpx;
}
.rule {
flex: 1;
text-align: right;
color: var(--btn-text-color);
}
.icon-wenhao {
font-size: 24rpx;
color: var(--btn-text-color);
margin-right: 6rpx;
}
}
.action-wrap {
// margin: 0 30rpx;
display: flex;
justify-content: space-between;
align-items: center;
height: 80rpx;
background-color: rgba(255, 255, 255, .1);
view {
line-height: 1;
text-align: center;
width: calc((100vw - 1rpx) / 2);
color: var(--btn-text-color);
text {
font-size: $font-size-tag;
margin-left: 8rpx;
}
// &:first-child {
// margin-right: 30rpx;
// }
&.split {
width: 1rpx;
height: 50rpx;
background-color: rgba(238, 238, 238, .3);
flex-shrink: 0;
}
image {
width: 100%;
}
}
}
.no-login {
display: flex;
align-items: center;
justify-content: center;
text-align: center;
text {
color: #fff;
}
.login-btn {
display: inline-block;
height: 70rpx;
line-height: 70rpx;
width: 200rpx;
border: 1px solid #fff;
border-radius: $border-radius;
margin-bottom: 20rpx;
}
}
}
.ns-adv {
margin: 0;
border-radius: 0;
overflow: hidden;
line-height: 1;
image {
width: 100%;
border-radius: 0!important;
}
}
.body-wrap {
margin-top: 20rpx;
&.no-login{
margin-top: 20rpx;
}
.point-exchange-wrap {
padding: 0 24rpx;
margin-top: 30rpx;
}
.type-wrap {
display: flex;
align-items: center;
.type-name {
font-size: 30rpx;
color: $color-title;
line-height: 1;
}
>view {
width: 2rpx;
height: 23rpx;
background-color: $color-tip;
margin: 0 20rpx;
}
.type-sub {
font-size: $font-size-tag;
color: $color-tip;
line-height: 1;
}
}
.list-wrap {
width: 100%;
.list-wrap-scroll {
width: 100%;
flex-direction: row;
// white-space: nowrap;
line-height: 1;
}
.list-wrap-item {
display: inline-block;
width: 330rpx;
overflow: hidden;
margin-right: 30rpx;
margin-top: 20rpx;
position: relative;
&.coupon-list-wrap-item {
// height: 170rpx;
}
&.hongbao-list-wrap-item {
height: 141rpx;
}
&:nth-child(2n+2){
margin-right: 0;
}
.img-box {
width: 100%;
height: 100%;
position: absolute;
top: 0;
left: 0;
image {
width: 100%;
height: 100%;
}
}
.content {
position: relative;
z-index: 9;
//优惠券样式
.coupon{
// background-color: #FFEAEA;
background-size: 100% 100%;
background-repeat: no-repeat;
border-radius: $border-radius;
display: flex;
padding:$margin-updown 0;
.coupon_right{
position:relative;
width:156rpx;
max-width: 156rpx;
.coupon_btn{
margin: 10rpx auto 0;
width:80rpx;
height:40rpx;
line-height: 40rpx;
font-size: $font-size-tag;
text-align: center;
border-radius: 10rpx;
border-width: 1px;
border-style: solid;
background: #FF3D3D;
color: #fff;
}
.coupon_num {
margin-top:10rpx;
text-align: center;
color: #FF3D3D;
}
&::after{
position :absolute;
top:50%;
margin-left: 0;
content:"";
width:0;
height:96%;
border-left: 2px dashed #FD463E;
transform: translateY(-50%);
}
}
.coupon_left{
flex:1;
width: 0;
text-align: left;
padding:0 $padding;
display: flex;
align-items: center;
.price{
margin-top: 0 !important;
padding:0;
font-weight: 600;
flex: 1;
width: 0;
overflow: hidden;
white-space: nowrap;
text-overflow: ellipsis;
color: #FD463E;
font-size: 56rpx;
text{
font-size: $font-size-tag;
color: #FD463E;
}
}
.coupon-info {
flex:1;
width: 0;
display: flex;
flex-direction: column;
align-items: flex-start;
justify-content: space-between;
height: 80%;
}
.coupon_condition{
line-height: 1;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
font-size: 26rpx;
font-weight: bold;
color: #FD463E;
}
.coupon_type {
color: #FD463E;
font-size: 24rpx;
}
}
}
.hongbao {
.coupon_left {
.price, .coupon_condition {
color: #FFFFFF;
}
}
.coupon_right {
.coupon_num {
color: #FFFFFF;
}
.coupon_btn {
color: #fff;
border-color: #fff;
}
&::after{
position :absolute;
top:0;
margin-left: 0;
content:"";
width:0;
height:100%;
border-left:0 ;
opacity: 0.2;
}
}
}
.coupon-price-wrap {
width: 100%;
height: 105rpx;
display: flex;
justify-content: space-between;
.coupon-price {
font-size: 48rpx;
margin-top: 10rpx;
margin-left: 20rpx;
text {
font-size: $font-size-tag;
}
}
}
.coupon-point {
.coupon-point-num {
width: 160rpx;
height: 44rpx;
position: relative;
image {
width: 100%;
height: 100%;
position: absolute;
}
text {
position: relative;
z-index: 9;
color: #FFFFFF;
font-size: 24rpx;
display: inline-block;
width: 100%;
line-height: 44rpx;
text-align: center;
vertical-align: top;
}
}
.coupon-conditions {
font-size: $font-size-activity-tag;
color: $color-tip;
line-height: 1;
margin-top: $font-size-tag;
}
}
.coupon-name {
font-size: $font-size-tag;
color: $color-title;
margin-top: 23rpx;
line-height: 1;
padding: 0 22rpx;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}
// 红包
&.hongbao-content {
background-color: #FFFFFF;
border-radius: 20rpx;
padding-bottom: 30rpx;
}
.hongbao-img {
height: 330rpx;
image {
width: 100%;
height: 100%;
}
}
.price {
font-size: $font-size-base;
color: $color-title;
line-height: 1;
padding-left: 26rpx;
margin-top: 20rpx;
}
.point {
font-size: $font-size-toolbar;
padding-left: 26rpx;
margin-top: 17rpx;
line-height: 1;
text {
font-size: $font-size-tag;
}
}
.stock {
font-size: $font-size-activity-tag;
color: $color-tip;
line-height: 1;
padding-left: 26rpx;
margin-top: 20rpx;
}
}
}
}
}
.exchange-coupon {
.list-wrap {
width: 100%;
overflow-x: scroll;
.list-wrap-scroll {
flex-direction: column;
display: flex;
max-height: 388rpx;
flex-wrap: wrap;
&.single-row {
max-height: 192rpx;
}
}
.list-wrap-item {
width: 424rpx;
margin-right: 16rpx;
margin-top: 18rpx;
}
}
}
.type-wrap-box {
display: flex;
justify-content: space-between;
.more {
color: #ff5251;
cursor: pointer;
}
}
.card-category-title{
display: flex;
align-items: center;
justify-content: center;
font-size: 30rpx;
color: #222;
padding: 0;
font-weight: bold;
.before-line,.after-line{
width: 30rpx;
height: 4rpx;
margin: 0 10rpx;
background-color: #222;
}
}
.head-box{
display: flex;
flex-direction: column;
background-color: #FFFFFF;
border-radius: 16rpx;
padding: 24rpx;
box-sizing: border-box;
width: calc(100% - 48rpx);
margin: 0 24rpx 20rpx 24rpx;
position: relative;
.account-content{
display: flex;
justify-content: space-between;
align-items: center;
.left{
display: flex;
align-items: center;
image{
width: 88rpx;
height: 88rpx;
}
view{
font-size: 32rpx;
font-weight: bold;
margin-left: 25rpx;
}
}
.right{
display: flex;
align-items: baseline;
.point{
font-weight: bold!important;
font-size: 38rpx;
color: #FF002D ;
}
.text{
font-size: 28rpx;
font-weight: bold;
margin: 0 10rpx;
}
}
}
.remark{
display: flex;
align-items: center;
margin-top: 30rpx;
padding: 25rpx 0 0;
border-top: 2rpx solid #F2F2F2;
.label{
border-radius: 4rpx;
border: 2rpx solid #FE172E;
color: #FE172E;
padding: 2rpx 8rpx;
font-size: 22rpx;
line-height: 1;
font-weight: bold;
}
.text{
font-size: 24rpx;
font-weight: bold;
margin-left: 30rpx;
line-height: 1;
}
}
}
.menu-wrap {
background: #fff;
border-radius: 24rpx;
margin: 20rpx 24rpx;
padding: 40rpx 0 30rpx 0;
.menu-list {
display: flex;
.menu-item {
flex: 1;
display: flex;
flex-direction: column;
align-items: center;
position: relative;
.menu-tag {
position: absolute;
z-index: 2;
right: 0;
width: 58rpx;
height: 26rpx;
}
.menu-img {
width: 86rpx;
height: 86rpx;
}
.title {
margin-top: 16rpx;
font-size: 26rpx;
color: #222;
}
}
}
}
.poster-wrap {
margin: 20rpx 24rpx;
display: flex;
.poster-item {
flex: 1;
border-radius: 16rpx;
overflow: hidden;
line-height: 1;
image {
width: 100%;
height: auto;
will-change: transform;
line-height: 1;
}
&:last-child {
margin-left: 20rpx;
}
}
}
.recharge-list-wrap {
margin: 20rpx 24rpx;
display: flex;
.item-wrap {
overflow: hidden;
background: linear-gradient(321deg, #F4402B 0%, #FD7C40 100%);
border-radius: 16rpx;
position: relative;
padding-top: 40rpx;
width: calc((100% - 60rpx) / 4);
margin-right: 20rpx;
text-align: center;
&:nth-child(4) {
margin-right: 0;
}
&:before {
content: " ";
display: block;
position: absolute;
left: 50%;
top: 0;
transform: translate(-50%, -50%);
background: #f8f8f8;
width: 30rpx;
height: 30rpx;
border-radius: 50%;
}
.recharge {
font-size: 26rpx;
color: #FFF20C;
white-space: nowrap;
padding: 0 10rpx;
overflow: hidden;
}
.point {
font-size: 20rpx;
color: #fff;
white-space: nowrap;
padding: 0 10rpx;
overflow: hidden;
}
.btn {
margin-top: 30rpx;
line-height: 60rpx;
font-size: 24rpx;
font-weight: 600;
color: #FFFFFF;
border-top: 2rpx dashed #fff;
}
}
}
.exchange-hongbao {
.coupon_left {
.price text {
color: #fff!important;
}
}
.coupon_right {
width: 120rpx!important;
max-width: 120rpx;
}
}

View File

@@ -0,0 +1,581 @@
export default {
data() {
return {
isIphoneX: false,
orderCreateData: {
member_address: {
name: '',
mobile: ''
}
},
orderPaymentData: {
exchange_info: {
type: 0
},
delivery: {
delivery_type: '',
express_type: [],
member_address: {
name: '',
mobile: ''
},
local: {
info: {
start_time: 0,
end_time: 0,
time_week: []
}
},
},
},
isSub: false,
tempData: null,
// 门店信息
storeInfo: {
storeList: [], //门店列表
currStore: {} //当前选择门店
},
// 自提地址
member_address: {
name: '',
mobile: ''
},
// 当前时间
timeInfo: {
week: 0,
start_time: 0,
end_time: 0,
showTime: false,
showTimeBar: false
},
deliveryWeek: "",
// 选择自提、配送防重判断
judge: true,
menuButtonBounding: {}
};
},
methods: {
// 显示弹出层
openPopup(ref) {
this.$refs[ref].open();
},
// 关闭弹出层
closePopup(ref) {
if (this.tempData) {
Object.assign(this.orderCreateData, this.tempData);
Object.assign(this.orderPaymentData, this.tempData);
this.tempData = null;
this.$forceUpdate();
}
this.$refs[ref].close();
},
// 选择收货地址
selectAddress() {
var params = {
back: '/pages_promotion/point/payment',
local: 0,
type: 1
}
// 外卖配送需要定位地址
if (this.orderPaymentData.delivery.delivery_type == 'local') {
params.local = 1;
params.type = 2;
}
this.$util.redirectTo('/pages_tool/member/address', params);
},
// 获取订单初始化数据
getOrderPaymentData() {
this.orderCreateData = uni.getStorageSync('exchangeOrderCreateData');
var pay_flag = uni.getStorageSync("pay_flag"); // 支付中标识,防止返回时,提示,跳转错误
if (!this.orderCreateData) {
if (pay_flag == 1) {
uni.removeStorageSync("pay_flag");
} else {
this.$util.showToast({
title: '未获取到创建订单所需数据!'
});
setTimeout(() => {
this.$util.redirectTo('/pages/index/index');
}, 1500);
}
return;
}
// 获取经纬度
if (this.location) {
this.orderCreateData.latitude = this.location.latitude;
this.orderCreateData.longitude = this.location.longitude;
}
this.$api.sendRequest({
url: '/pointexchange/api/ordercreate/payment',
data: this.orderCreateData,
success: res => {
if (res.code >= 0) {
this.orderPaymentData = res.data;
this.orderPaymentData.timestamp = res.timestamp;
this.handlePaymentData();
if (this.$refs.loadingCover) this.$refs.loadingCover.hide();
} else {
this.$util.showToast({
title: '未获取到创建订单所需数据!'
});
setTimeout(() => {
this.$util.redirectTo('/pages/index/index');
}, 1500);
}
},
fail: res => {
if (this.$refs.loadingCover) this.$refs.loadingCover.hide();
}
})
},
// 处理结算订单数据
handlePaymentData() {
this.orderCreateData.delivery = {};
this.orderCreateData.buyer_message = '';
var data = JSON.parse(JSON.stringify(this.orderPaymentData));
this.orderCreateData.order_key = data.order_key;
this.orderCreateData.delivery.store_id = 0;
this.orderCreateData.member_address = data.delivery.member_address;
// 店铺配送方式
if (data.delivery.express_type != undefined && data.delivery.express_type[0] != undefined) {
let deliveryStorage = uni.getStorageSync('delivery');
let delivery = data.delivery.express_type[0];
data.delivery.express_type.forEach(item => {
if (deliveryStorage && item.name == deliveryStorage.delivery_type) {
delivery = item;
}
});
this.selectDeliveryType(delivery);
}
if (this.orderPaymentData.is_virtual) this.orderCreateData.member_address = {
mobile: data.member_account.mobile != '' ? data.member_account.mobile : ''
};
// Object.assign(this.orderPaymentData, this.orderCreateData);
this.orderCalculate();
},
// 转化时间字符串
getTimeStr(val) {
var h = parseInt(val / 3600).toString();
var m = parseInt((val % 3600) / 60).toString();
if (m.length == 1) {
m = '0' + m;
}
if (h.length == 1) {
h = '0' + h;
}
return h + ':' + m;
},
// 订单计算
orderCalculate() {
var data = this.$util.deepClone(this.orderCreateData);
data.delivery = JSON.stringify(data.delivery);
if (this.orderCreateData.delivery.delivery_type == 'store') {
data.member_address = JSON.stringify(this.member_address);
} else {
data.member_address = JSON.stringify(data.member_address);
}
this.$api.sendRequest({
url: '/pointexchange/api/ordercreate/calculate',
data,
success: res => {
if (res.code >= 0) {
this.orderPaymentData.member_address = res.data.member_address;
this.orderPaymentData.delivery_money = res.data.delivery_money;
this.orderPaymentData.order_money = res.data.order_money;
Object.assign(this.orderPaymentData.delivery, res.data.delivery);
if (res.data.local_config) this.orderPaymentData.local_config = res.data
.config.local;
//时间选择判断
if (res.data.delivery.delivery_store_info) {
this.orderPaymentData.delivery_store_info = JSON.parse(res.data.delivery.delivery_store_info);
if (this.judge) {
if (this.orderPaymentData.delivery.delivery_type == "store") {
this.storetime('no');
} else if (this.orderPaymentData.delivery.delivery_type == 'local') {
this.localtime('no');
}
this.judge = false;
}
}
this.createBtn();
this.$forceUpdate();
} else {
this.$util.showToast({
title: res.message
});
}
},
})
},
/**
* 订单创建验证
*/
createBtn() {
if (this.orderPaymentData.delivery &&
this.orderPaymentData.delivery.delivery_type == 'local' &&
this.orderPaymentData.delivery &&
this.orderPaymentData.delivery.error &&
this.orderPaymentData.delivery.start_money > this.orderPaymentData.price) {
return false;
}
if (this.orderPaymentData.delivery &&
this.orderPaymentData.delivery.delivery_type == 'local' &&
this.orderPaymentData.delivery &&
this.orderPaymentData.delivery.error &&
this.orderPaymentData.delivery.error !== '') {
return false;
}
return true;
},
// 订单创建
orderCreate() {
if (this.verify()) {
if (this.isSub) return;
this.isSub = true;
uni.setStorageSync('paySource', 'pointexchange');
var data = this.$util.deepClone(this.orderCreateData);
data.delivery = JSON.stringify(data.delivery);
if (this.orderCreateData.delivery.delivery_type == 'store') {
data.member_address = JSON.stringify(this.member_address);
} else {
data.member_address = JSON.stringify(data.member_address);
}
this.$api.sendRequest({
url: '/pointexchange/api/ordercreate/create',
data,
success: res => {
uni.hideLoading();
if (res.code >= 0) {
if (this.orderPaymentData.exchange_info.type == 1 && this.orderPaymentData.order_money != '0.00') {
let orderCreateData = uni.getStorageSync('exchangeOrderCreateData');
orderCreateData.out_trade_no = res.data;
uni.setStorageSync('exchangeOrderCreateData', orderCreateData);
this.$refs.choosePaymentPopup.getPayInfo(res.data);
this.isSub = false;
} else {
this.$util.redirectTo('/pages_promotion/point/result', {}, 'redirectTo');
}
} else {
this.isSub = false;
if (res.data.error_code == 10 || res.data.error_code == 12) {
uni.showModal({
title: '订单未创建',
content: res.message,
confirmText: '去设置',
success: res => {
if (res.confirm) {
this.selectAddress();
}
}
})
} else {
this.$util.showToast({
title: res.message
});
}
}
},
fail: res => {
uni.hideLoading();
this.isSub = false;
}
})
}
},
// 订单验证
verify() {
if (this.orderPaymentData.exchange_info.type == 1) {
if (this.orderPaymentData.is_virtual == 1) {
if (!this.orderCreateData.member_address.mobile.length) {
this.$util.showToast({
title: '请输入您的手机号码'
});
return false;
}
if (!this.$util.verifyMobile(this.orderCreateData.member_address.mobile)) {
this.$util.showToast({
title: '请输入正确的手机号码'
});
return false;
}
}
if (this.orderPaymentData.is_virtual == 0) {
if (!this.orderCreateData.delivery || !this.orderCreateData.delivery.delivery_type) {
this.$util.showToast({
title: '商家未设置配送方式'
});
return false;
}
if (this.orderCreateData.delivery.delivery_type != 'store') {
if (!this.orderCreateData.member_address) {
this.$util.showToast({
title: '请先选择您的收货地址'
});
return false;
}
}
if (this.orderCreateData.delivery.delivery_type == 'store') {
if (!this.orderCreateData.delivery.store_id) {
this.$util.showToast({
title: '没有可提货的门店,请选择其他配送方式'
});
return false;
}
if (!this.member_address.mobile) {
this.$util.showToast({
title: '请输入预留手机'
});
return false;
}
if (!this.$util.verifyMobile(this.member_address.mobile)) {
this.$util.showToast({
title: '请输入正确的预留手机'
});
return false;
}
if (!this.orderCreateData.delivery.buyer_ask_delivery_time.start_date || !this.orderCreateData.delivery.buyer_ask_delivery_time.end_date) {
this.$util.showToast({
title: '请选择自提时间'
});
return false;
}
}
if (this.orderCreateData.delivery.delivery_type == 'local') {
if (!this.orderCreateData.delivery.store_id) {
this.$util.showToast({
title: '没有可配送的门店,请选择其他配送方式'
});
return false;
}
if (this.orderPaymentData.config.local.is_use && this.orderPaymentData.delivery.local.info && this.orderPaymentData.delivery.local.info.time_is_open == 1 && (!this.orderCreateData.delivery.buyer_ask_delivery_time.start_date || !this.orderCreateData.delivery.buyer_ask_delivery_time.end_date)) {
this.$util.showToast({
title: '请选择配送时间'
});
return false;
}
}
}
}
return true;
},
// 显示店铺配送信息
openSiteDelivery() {
this.tempData = {
delivery: this.$util.deepClone(this.orderPaymentData.delivery)
};
this.$refs.deliveryPopup.open();
},
// 选择配送方式
selectDeliveryType(data) {
uni.setStorageSync('delivery', {
delivery_type: data.name,
delivery_type_name: data.title
});
this.orderCreateData.delivery.delivery_type = data.name;
this.orderCreateData.delivery.delivery_type_name = data.title;
// 如果是门店配送
if (data.name == 'store') {
this.storeSelected(data);
this.member_address.name = this.orderPaymentData.member_account.nickname;
if (!this.member_address.mobile) this.member_address.mobile = this.orderPaymentData.member_account.mobile != '' ? this.orderPaymentData.member_account.mobile : '';
}
if (data.name == 'local') {
this.storeSelected(data);
}
// Object.assign(this.orderPaymentData, this.orderCreateData);
this.judge = true;
this.orderCalculate();
this.$forceUpdate();
},
// 切换到门店
storeSelected(data) {
// 门店列表
this.storeInfo.storeList = data.store_list;
let store = data.store_list[0] ? data.store_list[0] : null;
this.selectPickupPoint(store);
},
// 选择自提点
selectPickupPoint(store_item) {
if (store_item) {
this.orderCreateData.delivery.store_id = store_item.store_id;
this.storeInfo.currStore = store_item;
// 存储所选门店
let delivery = uni.getStorageSync('delivery') || {
name: this.orderCreateData.delivery.delivery_type,
title: this.orderCreateData.delivery.delivery_type_name
};
delivery.store_id = store_item.store_id;
uni.setStorageSync('delivery', delivery)
} else {
this.orderCreateData.delivery.store_id = 0;
this.storeInfo.currStore = {};
}
this.orderCreateData.delivery.buyer_ask_delivery_time = {
start_date: '',
end_date: ''
};
this.orderCreateData.buyer_ask_delivery_title = '';
// Object.assign(this.orderPaymentData, this.orderCreateData);
this.orderCalculate();
this.$forceUpdate();
this.$refs['deliveryPopup'].close();
},
imageError() {
let imageUrl = ''
if (this.orderPaymentData.exchange_info.type == 1) {
imageUrl = this.$util.img('public/uniapp/point/gift.png');
} else if (this.orderPaymentData.exchange_info.type == 2) {
imageUrl = this.$util.img('public/uniapp/point/coupon.png');
} else if (this.orderPaymentData.exchange_info.type == 3) {
imageUrl = this.$util.img('public/uniapp/point/hongbao.png');
} else {
imageUrl = this.$util.getDefaultImage().goods;
}
this.orderPaymentData.exchange_info.image = imageUrl;
this.$forceUpdate();
},
// 获取时间
getTime() {
// 必须是字符串,跟后端一致
let weeks = ['0', '1', '2', '3', '4', '5', '6'];
let week = new Date().getDay();
this.timeInfo.week = weeks[week];
},
navigateTo(sku_id) {
this.$util.redirectTo('/pages/goods/detail', {
sku_id
});
},
// 显示选择支付方式弹框
openChoosePayment() {
if (this.verify() && this.orderPaymentData.exchange_info.type == 1 && this.orderPaymentData.order_money != '0.00') this.$refs.choosePaymentPopup.open();
else this.orderCreate();
},
/**
* 同城配送数据处理
*/
localtime(type = '') {
let data = this.$util.deepClone(this.orderPaymentData.delivery.local.info);
if (data.delivery_time) {
data.end_time = data.delivery_time[(data.delivery_time.length - 1)].end_time;
}
let obj = {
delivery: this.orderCreateData.delivery,
dataTime: data
}
this.$refs.TimePopup.open(obj, type);
},
/**
* 门店自提数据处理
*/
storetime(type = '') {
if (this.orderPaymentData.delivery.delivery_store_info) {
let data = this.$util.deepClone(this.storeInfo.currStore);
data.delivery_time = typeof data.delivery_time == 'string' && data.delivery_time ? JSON.parse(data
.delivery_time) : data.delivery_time;
if (!data.delivery_time || data.delivery_time.length == undefined && !data.delivery_time.length) {
data.delivery_time = [{
start_time: data.start_time,
end_time: data.end_time
}]
}
let obj = {
delivery: this.orderCreateData.delivery,
dataTime: data
}
this.$refs.TimePopup.open(obj, type);
this.$forceUpdate();
}
},
/**
* 弹窗返回数据
*/
selectTime(data) {
if (data.data && data.data.month) {
this.orderCreateData.delivery.buyer_ask_delivery_time = {
start_date:data.data.start_date,
end_date:data.data.end_date
};
if (data.data.title == '今天' || data.data.title == '明天') {
this.orderCreateData.buyer_ask_delivery_title = data.data.title + '(' + data.data.time + ')'
} else {
this.orderCreateData.buyer_ask_delivery_title = data.data.month + '(' + data.data.time + ')'
}
this.orderCalculate();
this.$forceUpdate();
}
},
back() {
uni.navigateBack({
delta: 1
});
}
},
onShow() {
if (uni.getStorageSync('addressBack')) {
uni.removeStorageSync('addressBack');
}
// 判断登录
if (!this.storeToken) {
this.$util.redirectTo('/pages_tool/login/login');
} else {
this.getOrderPaymentData();
}
this.judge = true;
this.getTime();
this.isIphoneX = this.$util.uniappIsIPhoneX()
},
onHide() {
if (this.$refs.loadingCover) this.$refs.loadingCover.show();
},
onLoad() {
if (!this.location) this.$util.getLocation();
// #ifdef MP
this.menuButtonBounding = uni.getMenuButtonBoundingClientRect();
// #endif
},
watch: {
location: function(nVal) {
if (nVal) {
this.getOrderPaymentData();
}
}
},
filters: {
// 金额格式化输出
moneyFormat(money) {
return parseFloat(money).toFixed(2);
}
}
}