web-africa-h5/pages/prefecture/part/upgrade.vue

365 lines
9.1 KiB
Vue

<template>
<view>
<view class="form-title redtitle">
<!-- 升级会员信息 -->
{{ $t('w_0243') }}
</view>
<view class="prefecture form-group mb20">
<!-- 升级编号 -->
<view class="form-item">
<view class="form-label">
<text class="domation mr10">*</text>
{{ $t('w_0095') }}
</view>
<input @blur="changeInput('upgradeMemberCode')" class="form-input" type="text"
v-model="form.upgradeMemberCode" :placeholder="$t('w_0097')" />
</view>
<!-- 升级姓名 -->
<view class="form-item">
<view class="form-label">
<text class="domation mr10">*</text>
{{ $t('w_0098') }}
</view>
<view class="disabled-input">{{ form.upgradeMemberName }}</view>
</view>
<view class="form-item">
<view class="form-label">
<text class="domation mr10">*</text>
{{$t('PER_DA_4')}}
</view>
<view class="flex-1 d-s-c">
<image class="queryimg mr10" mode="heightFix"
:src="pkSettleCountry>=0&&countryList[pkSettleCountry] ? countryList[pkSettleCountry].nationalFlag1 : ''">
</image>
<view class="flex-1">
{{pkSettleCountry>=0&&countryList[pkSettleCountry] ? countryList[pkSettleCountry].shortName : ''}}
</view>
</view>
<!-- <text class="icon iconfont icon-jiantou"></text> -->
</view>
<!-- 发货方式 -->
<view class="form-item" style="border-bottom: 1rpx solid #eee;" @click="opendeliveryShow"
v-if="deliveryList">
<view class="form-label">
<text class="domation mr10">*</text>
{{ $t('w_0061') }}
</view>
<view class="form-input">{{ deliveryIndex }}</view>
<text class="icon iconfont icon-jiantou" v-if="userCountry != 1"></text>
</view>
<u-picker :cancelText="$t('MN_F_31')" :confirmText="$t('MN_F_32')" @cancel="deliveryShow = false"
:show="deliveryShow" ref="deliveryList" :columns="[deliveryList]" @confirm="changeDelivery"
keyName="label"></u-picker>
<!-- 会员店铺 -->
<view class="form-item" style="border-bottom: 1rpx solid #eee;" @click="openStoreDialog" v-if="userCountry != 1 && form.deliveryWay != 2">
<view class="form-label">
<text class="domation mr10">*</text>
{{ $t('w_0100') }}
</view>
<view class="form-input">{{ storeIndex }}</view>
<text class="icon iconfont icon-jiantou" v-if="userCountry != 1"></text>
</view>
</view>
<view v-if="isQuery" @touchmove.stop.prevent="moveHandle">
<view class="pop-up-bg" @click="isQuery = false"></view>
<view class="pop-up">
<view class="d-e-c p20">
<view class="blue f28" @click="closeQuery">完成</view>
</view>
<picker-view :indicator-style="'height: 80px;'" @change="changeQuery" class="picker-view">
<picker-view-column>
<view class="item d-c d-c-c" v-for="(item, index) in countryList" :key="index">
<image style="height: 50px;" mode="heightFix" :src="item.nationalFlag1"></image>
<view class="f28 gray9 mt10">{{ item.name }}</view>
</view>
</picker-view-column>
</picker-view>
</view>
</view>
</view>
</template>
<script>
export default {
data() {
return {
deliveryIndex: '',
transportIndex: 0,
storeIndex: '',
storehouseIndex: '',
deliveryShow: false,
storeShow: false,
isQuery: false,
pkCountry: -1,
pkSettleCountry: -1,
poptype: '',
showStoreDialog: false,
filteredStores: [],
searchTerm: '',
storeData:{},
};
},
inject: ['form'],
props: ['deliveryList', 'transportType', 'userCountry', 'storeList', 'storehouse', 'countryList','storeLists'],
created() {
let self= this;
self.$fire.on('handleStoreData', function(n) {
console.log(n,'n');
self.handleStoreData(n)
})
},
watch: {
deliveryList: function(n, o) {
if (n != o && n != '') {
this.deliveryIndex = n[0].label;
this.form.deliveryWay = n[0].value;
}
},
countryList: function(n, o) {
let self = this;
if (n != o) {
let num = 0;
n.some((item, index) => {
if (item.pkId == self.userCountry) {
num = index;
return true;
}
});
self.pkSettleCountry = num;
self.pkCountry = num;
if (n) {
self.form.pkSettleCountry = n[self.pkSettleCountry].pkId;
// self.form.pkCountry = n[self.pkCountry].pkId;
}
}
},
},
methods: {
openStoreDialog() {
if(!this.form.upgradeMemberCode){
uni.showToast({
title: this.$t('w_0097'),
icon: 'none',
duration: 2000
});
return;
}
let url = '/pages/prefecture/part/memberStore?userCountry=' + this.userCountry;
uni.navigateTo({
url: url
});
},
handleStoreData(data) {
this.storeData = data; // 接收子页面传递的数据
this.storeIndex = this.storeData.storeName+'('+this.storeData.storeCode+')';
this.form.pkMemberStore = this.storeData.pkId;
},
opendeliveryShow() {
if (this.userCountry == 1) {
return;
}
this.deliveryShow = true;
},
changePkMemberStore(e) {
this.storeIndex = e.value[0].storeName;
if (this.storeList) {
this.form.pkMemberStore = e.value[0].pkId;
}
this.storeShow = false;
},
changeDelivery(e) {
// this.deliveryIndex = e.detail.value;
// this.form.deliveryWay = this.deliveryList[this.deliveryIndex].value;
this.deliveryIndex = e.value[0].label;
this.form.deliveryWay = e.value[0].value;
this.$emit('queryOrderPostage');
this.deliveryShow = false;
},
changeStore(e) {
this.storeIndex = e.detail.value;
if (this.storeList) {
this.form.pkMemberStore = this.storeList[this.storeIndex].pkId;
}
},
changeStorehouse(e) {
this.storehouseIndex = e.detail.value;
if (this.storehouse) {
this.form.pkStorehouse = this.storehouse[this.storehouseIndex].pkId;
}
},
changeInput(e) {
this.$emit('changeInput', e);
},
changeTransport(e) {
this.transportIndex = e.detail.value;
this.form.transType = this.transportType[this.transportIndex].value;
this.$emit('queryOrderPostage');
},
changeAccount(e) {
this.bank_index = e.detail.value;
console.log(this.bank_index);
this.form.pkBank = this.accountList[this.bank_index].value;
},
changeType(n) {
this.registType = n;
},
changePlaceDept(e) {
this.form.placeDept = e.detail.value + 1;
this.changeInput('placeDept');
},
closeQuery() {
this[this.poptype] = this.queryValue;
if (this.poptype == 'pkSettleCountry') {
this.form.pkSettleCountry = this.countryList[this.pkSettleCountry].pkId;
} else {
this.form.pkCountry = this.countryList[this.pkCountry].pkId;
}
this.isQuery = false;
},
changeQuery(e) {
this.queryValue = e.detail.value[0];
},
moveHandle() {
return false;
},
openCPop(name) {
this.poptype = name;
this.isQuery = true;
}
}
};
</script>
<style lang="scss">
.title-row {
display: flex;
justify-content: space-between;
padding: 20rpx 0rpx;
margin-left: 20rpx;
border-bottom: 1rpx solid #ccc;
font-weight: bold;
}
.title-row span {
flex: 1;
}
.fixed-rows {
padding: 0;
margin: 0;
list-style: none;
}
.data-item {
display: flex;
justify-content: space-between;
padding: 30rpx 0; /* 调整每个数据项的上下内边距 */
border-bottom: 1px solid #eee; /* 添加底部边框 */
margin-bottom: 10rpx;
}
.data-item view {
flex: 1; /* 均分每个数据项的宽度 */
white-space: nowrap; /* 不换行 */
overflow: hidden; /* 超出部分隐藏 */
text-overflow: ellipsis; /* 超出部分用省略号表示 */
margin-left: 10rpx;
}
.pop-up-bg {
position: fixed;
background-color: rgba(0, 0, 0, 0.6);
left: 0;
top: 0;
width: 100%;
height: 100vh;
z-index: 99;
}
.pop-up {
position: fixed;
bottom: 0;
left: 0;
width: 100%;
height: 50vh; /* 限制最大高度 */
overflow-y: auto; /* 当内容超出时,允许垂直滚动 */
background-color: #ffffff;
z-index: 100;
}
.picker-view {
width: 750rpx;
height: 600rpx;
margin-top: 20rpx;
}
.item {
width: 100%;
box-sizing: border-box;
display: flex;
justify-content: center;
align-items: center;
height: 80px;
align-items: center;
justify-content: center;
text-align: center;
}
.queryimg {
height: 60rpx;
flex-shrink: 0;
}
.form-title {
width: 750rpx;
height: 106rpx;
background: #fb3024;
padding-left: 44rpx;
padding-right: 25rpx;
position: relative;
box-sizing: border-box;
font-size: 28rpx;
color: #ffffff;
line-height: 106rpx;
font-weight: bold;
z-index: 1;
}
.form-title.redtitle {
width: 750rpx;
height: 106rpx;
background: #fb3024;
padding-left: 44rpx;
position: relative;
box-sizing: border-box;
font-size: 28rpx;
color: #fff;
line-height: 106rpx;
font-weight: bold;
z-index: 1;
}
.form-title::before {
content: '';
position: absolute;
top: 0;
bottom: 0;
margin: auto;
left: 25rpx;
width: 6rpx;
height: 24rpx;
background-color: #fb3024;
z-index: 1;
}
.redtitle.form-title::before {
content: '';
position: absolute;
top: 0;
bottom: 0;
margin: auto;
left: 25rpx;
width: 6rpx;
height: 24rpx;
background-color: #fff;
z-index: 1;
}
</style>