add
This commit is contained in:
parent
0f86686f8b
commit
e7aefe8bff
|
@ -17,7 +17,8 @@
|
|||
|
||||
<view v-else>
|
||||
<view class="tabs">
|
||||
<text @click="currentTab = 1" :class="{ actText: currentTab == 1 }">开通{{ Role == 1 ? '行业会员' : '商户' }} </text>
|
||||
<text @click="currentTab = 1" :class="{ actText: currentTab == 1 }">开通{{ Role == 1 ? '行业会员' : '商户' }}
|
||||
</text>
|
||||
<text @click="currentTab = 2, getCount(), getLists()" :class="{ actText: currentTab == 2 }"> 已开通列表</text>
|
||||
<view class="lines" :class="{ actLine: currentTab == 2 }" />
|
||||
</view>
|
||||
|
@ -31,17 +32,19 @@
|
|||
<up-form-item label="">
|
||||
<up-input v-model="formData.real_name" border="none" prefixIcon="account" placeholder="请输入真实姓名"
|
||||
:customStyle="{ background: '#F3F3F3', padding: '20rpx', 'border-radius': '30rpx' }"
|
||||
:placeholderStyle="{ color: '#444444' }" :prefixIconStyle="{ 'margin-right': '40rpx' }"></up-input>
|
||||
:placeholderStyle="{ color: '#444444' }"
|
||||
:prefixIconStyle="{ 'margin-right': '40rpx' }"></up-input>
|
||||
</up-form-item>
|
||||
<up-form-item label="">
|
||||
<up-input v-model="formData.mobile" border="none" prefixIcon="phone" placeholder="请输入电话号码"
|
||||
:customStyle="{ background: '#F3F3F3', padding: '20rpx', 'border-radius': '30rpx' }"
|
||||
:placeholderStyle="{ color: '#444444' }" :prefixIconStyle="{ 'margin-right': '40rpx' }"></up-input>
|
||||
:placeholderStyle="{ color: '#444444' }"
|
||||
:prefixIconStyle="{ 'margin-right': '40rpx' }"></up-input>
|
||||
</up-form-item>
|
||||
<up-form-item label="">
|
||||
<view @click="showPop = true" style="width: 100%;">
|
||||
<up-input style="pointer-events: none" v-model="formData.address" border="none" prefixIcon="map"
|
||||
readonly placeholder="点击选择地址" :customStyle="{
|
||||
<up-input style="pointer-events: none" v-model="formData.address" border="none"
|
||||
prefixIcon="map" readonly placeholder="点击选择地址" :customStyle="{
|
||||
background: '#F3F3F3', padding: '20rpx',
|
||||
'border-radius': '30rpx'
|
||||
}" :placeholderStyle="{ color: '#444444' }" :prefixIconStyle="{ 'margin-right': '40rpx' }"
|
||||
|
@ -114,7 +117,8 @@
|
|||
<uni-td align="center">{{ index + 1 }}</uni-td>
|
||||
<uni-td style="font-size: 20rpx;" align="center" v-if='Role == 1'>{{ item.real_name }}</uni-td>
|
||||
<uni-td style="font-size: 20rpx;" align="center" v-if='Role == 1'>{{ item.price }}</uni-td>
|
||||
<uni-td style="font-size: 20rpx;" align="center" v-if='Role == 4'>{{ item.create_time }}</uni-td>
|
||||
<uni-td style="font-size: 20rpx;" align="center"
|
||||
v-if='Role == 4'>{{ item.create_time }}</uni-td>
|
||||
<uni-td style="font-size: 20rpx;" align="center" v-if='Role == 4'>{{ item.nickname }}</uni-td>
|
||||
<uni-td style="font-size: 20rpx;" align="center" v-if='Role == 1'>{{ item.label_name }}</uni-td>
|
||||
<uni-td style="font-size: 20rpx;" align="center">
|
||||
|
@ -142,8 +146,8 @@
|
|||
:activeStyle="{ color: '#20B128' }"></up-tabs>
|
||||
<up-line style="margin-top:20rpx "></up-line>
|
||||
<view class="address-content" v-if='currentAddressIndex == 0'>
|
||||
<view class="address-li" :class='{ act: item.city_code == formData.city }' v-for="item in addressList.city"
|
||||
:key="item.city_code" @click="addressLiClick(0, item)">
|
||||
<view class="address-li" :class='{ act: item.city_code == formData.city }'
|
||||
v-for="item in addressList.city" :key="item.city_code" @click="addressLiClick(0, item)">
|
||||
<text>{{ item.city_name }}</text>
|
||||
<up-icon name="arrow-right" :color="item.city_code == formData.city ? '#20B128' : '#777777'" />
|
||||
</view>
|
||||
|
@ -166,36 +170,37 @@
|
|||
<view class="address-li" v-for="item in addressList.village" @click="addressLiClick(3, item)"
|
||||
:key="item.village_code" :class='{ act: item.village_code == formData.village }'>
|
||||
<text>{{ item.village_name }}</text>
|
||||
<up-icon name="arrow-right" :color="item.village_code == formData.village ? '#20B128' : '#777777'" />
|
||||
<up-icon name="arrow-right"
|
||||
:color="item.village_code == formData.village ? '#20B128' : '#777777'" />
|
||||
</view>
|
||||
</view>
|
||||
<view class="address-content" v-else-if='currentAddressIndex == 4'>
|
||||
<view class="address-li" :class='{ act: item.id == formData.brigade }' v-for="item in addressList.brigade"
|
||||
:key="item.id" @click="addressLiClick(4, item)">
|
||||
<view class="address-li" :class='{ act: item.id == formData.brigade }'
|
||||
v-for="item in addressList.brigade" :key="item.id" @click="addressLiClick(4, item)">
|
||||
<text>{{ item.brigade_name }}</text>
|
||||
<up-icon name="arrow-right" :color="item.id == formData.brigade ? '#20B128' : '#777777'" />
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</up-popup>
|
||||
<up-picker :show="showPop1" :columns="columns" @confirm='conformRole' @cancel='showPop1 = false' @close="showPop1 = false"
|
||||
@open="showPop1 = true" keyName='label_name' confirmColor='#33B83A'></up-picker>
|
||||
<up-picker :show="showPop1" :columns="columns" @confirm='conformRole' @cancel='showPop1 = false'
|
||||
@close="showPop1 = false" @open="showPop1 = true" keyName='label_name' confirmColor='#33B83A'></up-picker>
|
||||
</template>
|
||||
<script setup>
|
||||
import {
|
||||
import {
|
||||
reactive,
|
||||
ref
|
||||
} from 'vue';
|
||||
import useUserStore from "@/store/user";
|
||||
import {
|
||||
} from 'vue';
|
||||
import useUserStore from "@/store/user";
|
||||
import {
|
||||
provinceListApi,
|
||||
cityListApi,
|
||||
areaListApi,
|
||||
streetListApi,
|
||||
villageListApi,
|
||||
brigadeListApi
|
||||
} from "@/api/address.js"
|
||||
import {
|
||||
} from "@/api/address.js"
|
||||
import {
|
||||
vipRechargeApi,
|
||||
rechargeCountApi,
|
||||
reVipRechargeApi,
|
||||
|
@ -206,23 +211,23 @@ import {
|
|||
getUserShip,
|
||||
getCreateLists,
|
||||
getReportingSms
|
||||
} from "@/api/user.js"
|
||||
import Push from "@/utils/push.js"
|
||||
import {
|
||||
} from "@/api/user.js"
|
||||
import Push from "@/utils/push.js"
|
||||
import {
|
||||
onPullDownRefresh,
|
||||
onLoad
|
||||
} from "@dcloudio/uni-app"
|
||||
import {
|
||||
} from "@dcloudio/uni-app"
|
||||
import {
|
||||
config
|
||||
} from "@/config/app.js"
|
||||
} from "@/config/app.js"
|
||||
|
||||
const showPop1 = ref(false)
|
||||
const Role = ref('')
|
||||
const range = ref({})
|
||||
const columns = ref([])
|
||||
const showModa = ref(true)
|
||||
const storePhone = ref('')
|
||||
const confirmStore = () => {
|
||||
const showPop1 = ref(false)
|
||||
const Role = ref('')
|
||||
const range = ref({})
|
||||
const columns = ref([])
|
||||
const showModa = ref(true)
|
||||
const storePhone = ref('')
|
||||
const confirmStore = () => {
|
||||
getStoreByPhone({
|
||||
phone: storePhone.value
|
||||
}).then(res => {
|
||||
|
@ -233,15 +238,15 @@ const confirmStore = () => {
|
|||
}).catch(err => {
|
||||
uni.$u.toast('未查到店铺信息,请检查手机号码')
|
||||
})
|
||||
}
|
||||
// 用户选择的门店信息
|
||||
let STORE_INFO = reactive({
|
||||
}
|
||||
// 用户选择的门店信息
|
||||
let STORE_INFO = reactive({
|
||||
id: ""
|
||||
})
|
||||
})
|
||||
|
||||
|
||||
// 门店手机号保留一天
|
||||
const setPhoneOneDay = () => {
|
||||
// 门店手机号保留一天
|
||||
const setPhoneOneDay = () => {
|
||||
if (uni.getStorageSync('VIP_PHONE')) return;
|
||||
const currentDate = new Date();
|
||||
const nextDay = new Date(currentDate);
|
||||
|
@ -250,8 +255,8 @@ const setPhoneOneDay = () => {
|
|||
time: nextDay,
|
||||
phone: storePhone.value
|
||||
}));
|
||||
}
|
||||
const getPhoneOneDay = () => {
|
||||
}
|
||||
const getPhoneOneDay = () => {
|
||||
if (uni.getStorageSync('VIP_PHONE')) {
|
||||
let data = JSON.parse(uni.getStorageSync('VIP_PHONE'))
|
||||
if (new Date() > data.time) {
|
||||
|
@ -260,19 +265,19 @@ const getPhoneOneDay = () => {
|
|||
storePhone.value = data.phone
|
||||
}
|
||||
}
|
||||
}
|
||||
// 手机保留一天结束
|
||||
}
|
||||
// 手机保留一天结束
|
||||
|
||||
// 验证码
|
||||
const cutDown = ref(0)
|
||||
const flag = ref(true)
|
||||
const code = ref('')
|
||||
const checkPhone = (phone) => {
|
||||
// 验证码
|
||||
const cutDown = ref(0)
|
||||
const flag = ref(true)
|
||||
const code = ref('')
|
||||
const checkPhone = (phone) => {
|
||||
const regex = /^1[3-9]\d{9}$/;
|
||||
return regex.test(formData.mobile) ? true : false
|
||||
}
|
||||
}
|
||||
|
||||
const getCode = async () => {
|
||||
const getCode = async () => {
|
||||
if (!checkPhone(formData.mobile)) return uni.$u.toast('请输入正确的手机号')
|
||||
await getReportingSms({
|
||||
account: formData.mobile
|
||||
|
@ -283,11 +288,12 @@ const getCode = async () => {
|
|||
cutDown.value--
|
||||
if (cutDown.value <= 0) clearInterval(timer)
|
||||
}, 1000)
|
||||
}
|
||||
// 验证码结束
|
||||
}
|
||||
// 验证码结束
|
||||
|
||||
const currentTab = ref(1)
|
||||
const formData = reactive({
|
||||
|
||||
const currentTab = ref(1)
|
||||
const formData = reactive({
|
||||
store_id: STORE_INFO.id,
|
||||
mobile: "",
|
||||
province: 510000,
|
||||
|
@ -302,7 +308,7 @@ const formData = reactive({
|
|||
label_id: "",
|
||||
user_ship: '',
|
||||
code: '',
|
||||
|
||||
brigade: ""
|
||||
// store_id: STORE_INFO.id,
|
||||
// mobile: "19130550023",
|
||||
// province: 510000,
|
||||
|
@ -317,36 +323,47 @@ const formData = reactive({
|
|||
// label_id: "4",
|
||||
// user_ship: '1',
|
||||
// code: ''
|
||||
})
|
||||
})
|
||||
const resetFormData = () => {
|
||||
for (ket key in formData) {
|
||||
formData[key] = ''
|
||||
}
|
||||
tabsList.forEach(item => {
|
||||
item.name = '请选择'
|
||||
})
|
||||
formData.province = 510000
|
||||
cutDown.value = 0
|
||||
currentAddressIndex.value = 0
|
||||
}
|
||||
|
||||
const conformRole = (e) => {
|
||||
const conformRole = (e) => {
|
||||
formData.label_name = e.value[0].label_name
|
||||
formData.label_id = e.value[0].label_id
|
||||
showPop1.value = false
|
||||
}
|
||||
}
|
||||
|
||||
// 地址选择
|
||||
const showPop = ref(false)
|
||||
const currentAddressIndex = ref(0)
|
||||
const currentAddressList = () => {
|
||||
|
||||
// 地址选择
|
||||
const showPop = ref(false)
|
||||
const currentAddressIndex = ref(0)
|
||||
const currentAddressList = () => {
|
||||
if (!formData.city) return [0, 'city'];
|
||||
else if (formData.area) return [1, 'area'];
|
||||
else if (formData.street) return [2, 'street'];
|
||||
else if (formData.village) return [3, 'village'];
|
||||
else if (formData.brigade) return [4, 'brigade'];
|
||||
}
|
||||
|
||||
const addressTbasChange = (e) => {
|
||||
}
|
||||
const addressTbasChange = (e) => {
|
||||
currentAddressIndex.value = e.index
|
||||
}
|
||||
const addressList = reactive({
|
||||
}
|
||||
const addressList = reactive({
|
||||
city: [],
|
||||
area: [],
|
||||
street: [],
|
||||
village: [],
|
||||
brigade: []
|
||||
})
|
||||
const addressLiClick = async (i, item) => {
|
||||
})
|
||||
const addressLiClick = async (i, item) => {
|
||||
if (i == 0) {
|
||||
formData.city = item.city_code
|
||||
tabsList[0].name = item.city_name
|
||||
|
@ -391,15 +408,14 @@ const addressLiClick = async (i, item) => {
|
|||
formData.address = tabsList[0].name + tabsList[1].name + tabsList[2].name + tabsList[3].name + tabsList[4]
|
||||
.name
|
||||
return currentAddressIndex.value++
|
||||
}
|
||||
const getCityList = async () => {
|
||||
}
|
||||
const getCityList = async () => {
|
||||
let res = await cityListApi({
|
||||
province_code: formData.province
|
||||
})
|
||||
addressList.city = res.data
|
||||
}
|
||||
getCityList()
|
||||
const tabsList = reactive(
|
||||
}
|
||||
const tabsList = reactive(
|
||||
[{
|
||||
name: "请选择"
|
||||
},
|
||||
|
@ -423,24 +439,26 @@ const tabsList = reactive(
|
|||
|
||||
|
||||
|
||||
// 支付相关
|
||||
// scoket
|
||||
let timerInvol = null
|
||||
const userInfo = useUserStore().userInfo;
|
||||
const connection = new Push({
|
||||
let timerInvol = null
|
||||
|
||||
// 开起一个scoket监听用户知否支付成功
|
||||
const userInfo = useUserStore().userInfo;
|
||||
const connection = new Push({
|
||||
url: config.WSS_URL, // websocket地址
|
||||
app_key: '2ce3ce22329517213caa7dad261f5695',
|
||||
});
|
||||
|
||||
// 浏览器监听user-1
|
||||
const user_channel = connection.subscribe(`wechat_mmp_${userInfo.id}`);
|
||||
user_channel.on('message', function (data) {
|
||||
});
|
||||
const user_channel = connection.subscribe(`wechat_mmp_${userInfo.id}`);
|
||||
user_channel.on('message', function(data) {
|
||||
try {
|
||||
clearTimeout(timerInvol);
|
||||
paySuccessToTabs2()
|
||||
} catch (error) { }
|
||||
});
|
||||
const submit = async () => {
|
||||
} catch (error) {}
|
||||
});
|
||||
// 结束
|
||||
|
||||
|
||||
// 提交
|
||||
const submit = async () => {
|
||||
if (!formData.real_name) return uni.$u.toast('请填写真实姓名');
|
||||
if (!formData.mobile) return uni.$u.toast('请填写电话号码');
|
||||
if (!formData.code) return uni.$u.toast('请输入短信验证码');
|
||||
|
@ -453,7 +471,7 @@ const submit = async () => {
|
|||
// vipRechargeApi(formData).then(res => {})
|
||||
// return
|
||||
uni.scanCode({
|
||||
success: function (res) {
|
||||
success: function(res) {
|
||||
if (String(res.result.length) != 18) return uni.$u.toast('二维码未扫描完整');
|
||||
uni.showLoading({
|
||||
title: '支付中...'
|
||||
|
@ -477,30 +495,16 @@ const submit = async () => {
|
|||
vipRechargeApi(formData).then(res => {
|
||||
uni.$u.toast('操作成功');
|
||||
currentTab.value = 2
|
||||
formData.real_name = ''
|
||||
formData.mobile = ''
|
||||
formData.address = ''
|
||||
formData.label_name = ''
|
||||
formData.city = ''
|
||||
formData.area = ''
|
||||
formData.street = ''
|
||||
formData.village = ''
|
||||
formData.brigade = ''
|
||||
formData.code = ''
|
||||
currentAddressIndex.value = 0
|
||||
cutDown.value = 0
|
||||
tabsList.forEach(item => {
|
||||
item.name = '请选择'
|
||||
})
|
||||
resetFormData()
|
||||
getLists()
|
||||
getCount()
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
const rePay = (item) => {
|
||||
const rePay = (item) => {
|
||||
uni.scanCode({
|
||||
success: function (res) {
|
||||
success: function(res) {
|
||||
if (String(res.result.length) != 18) return uni.$u.toast('二维码未扫描完整');
|
||||
uni.showLoading({
|
||||
title: '支付中...'
|
||||
|
@ -516,52 +520,38 @@ const rePay = (item) => {
|
|||
})
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
// 支付成功后清除formData并且切换tabs2
|
||||
const paySuccessToTabs2 = () => {
|
||||
// 支付成功后清除formData并且切换tabs2
|
||||
const paySuccessToTabs2 = () => {
|
||||
uni.hideLoading()
|
||||
uni.showToast({
|
||||
title: '支付成功',
|
||||
duration: 2000,
|
||||
success() {
|
||||
currentTab.value = 2
|
||||
formData.real_name = ''
|
||||
formData.mobile = ''
|
||||
formData.address = ''
|
||||
formData.label_name = ''
|
||||
formData.city = ''
|
||||
formData.area = ''
|
||||
formData.street = ''
|
||||
formData.village = ''
|
||||
formData.brigade = ''
|
||||
formData.code = ''
|
||||
currentAddressIndex.value = 0
|
||||
cutDown.value = 0
|
||||
tabsList.forEach(item => {
|
||||
item.name = '请选择'
|
||||
})
|
||||
resetFormData()
|
||||
setTimeout(() => {
|
||||
getLists()
|
||||
getCount()
|
||||
}, 500); // 延迟1秒执行
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
// 邀请用户数
|
||||
const count = ref(0)
|
||||
const getCount = async () => {
|
||||
// 邀请用户数
|
||||
const count = ref(0)
|
||||
const getCount = async () => {
|
||||
if (Role.value == 4) return;
|
||||
let res = await rechargeCountApi({
|
||||
store_id: STORE_INFO.id
|
||||
})
|
||||
count.value = res.data.count
|
||||
}
|
||||
}
|
||||
|
||||
// 邀请列表
|
||||
const lists = ref([])
|
||||
const getLists = async () => {
|
||||
// 邀请列表
|
||||
const lists = ref([])
|
||||
const getLists = async () => {
|
||||
if (Role.value == 1) {
|
||||
let res = await rechargeListsApi({
|
||||
store_id: STORE_INFO.id,
|
||||
|
@ -576,13 +566,13 @@ const getLists = async () => {
|
|||
count.value = res.data.count
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
getCount()
|
||||
getLists()
|
||||
getCount()
|
||||
getLists()
|
||||
|
||||
|
||||
const upadtaStatus = (item) => {
|
||||
const upadtaStatus = (item) => {
|
||||
updataOrderApi({
|
||||
order_no: item.order_id,
|
||||
recharge: 1
|
||||
|
@ -591,9 +581,9 @@ const upadtaStatus = (item) => {
|
|||
getLists()
|
||||
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
onLoad(() => {
|
||||
onLoad(() => {
|
||||
getUserShip().then(res => {
|
||||
range.value = res.data.lists.map(item => {
|
||||
return {
|
||||
|
@ -606,19 +596,20 @@ onLoad(() => {
|
|||
columns.value = [res.data.lists]
|
||||
})
|
||||
getPhoneOneDay()
|
||||
})
|
||||
getCityList()
|
||||
})
|
||||
|
||||
onPullDownRefresh(() => {
|
||||
onPullDownRefresh(() => {
|
||||
getCount()
|
||||
getLists()
|
||||
setTimeout(() => {
|
||||
uni.stopPullDownRefresh()
|
||||
}, 500)
|
||||
})
|
||||
})
|
||||
</script>
|
||||
|
||||
<style lang='scss'>
|
||||
.tabs {
|
||||
.tabs {
|
||||
background-color: #fff;
|
||||
width: 100vw;
|
||||
box-sizing: border-box;
|
||||
|
@ -648,17 +639,17 @@ onPullDownRefresh(() => {
|
|||
.actLine {
|
||||
left: calc(75vw - 35rpx);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.card {
|
||||
.card {
|
||||
width: 710rpx;
|
||||
margin: 20rpx auto;
|
||||
background-color: #fff;
|
||||
box-sizing: border-box;
|
||||
border-radius: 10rpx;
|
||||
}
|
||||
}
|
||||
|
||||
.card1 {
|
||||
.card1 {
|
||||
padding: 52rpx 30rpx;
|
||||
|
||||
.card1-tit {
|
||||
|
@ -674,9 +665,9 @@ onPullDownRefresh(() => {
|
|||
text-align: center;
|
||||
margin-top: 30rpx;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.submit-btn {
|
||||
.submit-btn {
|
||||
/* height: 200rpx; */
|
||||
position: fixed;
|
||||
bottom: 50rpx;
|
||||
|
@ -684,10 +675,10 @@ onPullDownRefresh(() => {
|
|||
left: 50%;
|
||||
transform: translateX(-50%);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
.vip-card {
|
||||
.vip-card {
|
||||
width: 690rpx;
|
||||
height: 270rpx;
|
||||
background-image: url('https://lihai001.oss-cn-chengdu.aliyuncs.com/attach/4a92b202406162207212332.png');
|
||||
|
@ -706,17 +697,17 @@ onPullDownRefresh(() => {
|
|||
color: #7B5232;
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.table {
|
||||
.table {
|
||||
width: 710rpx;
|
||||
box-sizing: border-box;
|
||||
font-size: 30rpx;
|
||||
margin: 0 auto;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
.address-content {
|
||||
.address-content {
|
||||
padding: 20rpx;
|
||||
height: 50vh;
|
||||
overflow-y: auto;
|
||||
|
@ -733,26 +724,26 @@ onPullDownRefresh(() => {
|
|||
.act {
|
||||
color: #20B128;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.uni-table-th {
|
||||
.uni-table-th {
|
||||
padding: 10rpx 0 !important;
|
||||
}
|
||||
}
|
||||
|
||||
.uni-table-td {
|
||||
.uni-table-td {
|
||||
padding: 10rpx 0 !important;
|
||||
}
|
||||
}
|
||||
|
||||
.slot-content {
|
||||
.slot-content {
|
||||
padding-bottom: 50rpx;
|
||||
}
|
||||
}
|
||||
|
||||
.code-btn {
|
||||
.code-btn {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
}
|
||||
}
|
||||
|
||||
.btn-text {
|
||||
.btn-text {
|
||||
color: #20B128;
|
||||
}
|
||||
}
|
||||
</style>
|
Loading…
Reference in New Issue