会员报备

This commit is contained in:
zmj 2024-06-17 15:29:52 +08:00
parent bb6210fd7a
commit 837e1319ca
4 changed files with 375 additions and 110 deletions

24
api/address.js Normal file
View File

@ -0,0 +1,24 @@
import request from '@/utils/request';
export const provinceListApi = (data) => {
return request.get('/province', data);
}
export const cityListApi = (data) => {
return request.get('/city', data);
}
export const areaListApi = (data) => {
return request.get('/area', data);
}
export const streetListApi = (data) => {
return request.get('/street', data);
}
export const villageListApi = (data) => {
return request.get('/village', data);
}
export const brigadeListApi = (data) => {
return request.get('/brigade', data);
}

View File

@ -94,3 +94,19 @@ export const capitalCountAPi = (data) => {
export const chargeListApi = (data) => {
return request.post('/user/user/capital_flow', data);
}
export const vipRechargeApi = (data) => {
return request.post('/store/store/recharge', data);
}
export const rechargeCountApi = (data) => {
return request.get('/store/store/recharge_count', data);
}
export const rechargeListsApi = (data) => {
return request.get('/user/UserRecharge/lists', data);
}
export const updataOrderApi = (data) => {
return request.get('/pay/wechatQuery', data);
}

View File

@ -11,20 +11,19 @@
<view class="card1-tit">
行业会员开通报备
</view>
<up-form labelPosition="left" :model="formData">
<up-form-item label="" prop="userInfo.name" borderBottom>
<up-input v-model="formData.name" border="none" prefixIcon="account" placeholder="请输入姓名"
<up-form labelPosition="left" :model="formData" :borderBottom='false'>
<up-form-item label="" prop="userInfo.name">
<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>
</up-form-item>
<up-form-item label="" prop="userInfo.name" borderBottom>
<up-input v-model="formData.phone" border="none" prefixIcon="account" placeholder="请输入电话号码"
<up-form-item label="" prop="userInfo.name">
<up-input v-model="formData.mobile" border="none" prefixIcon="account" placeholder="请输入电话号码"
:customStyle="{background:'#F3F3F3',padding:'20rpx','border-radius':'30rpx'}"
:placeholderStyle="{color:'#444444'}" :prefixIconStyle="{'margin-right':'40rpx'}"></up-input>
</up-form-item>
<up-form-item label="" prop="userInfo.name" borderBottom>
<view @click="showPop" style="width: 100%;">
<up-form-item label="" prop="userInfo.name">
<view @click="showPop=true" style="width: 100%;">
<up-input style="pointer-events: none" v-model="formData.address" border="none"
prefixIcon="account" readonly placeholder="请选择地址" :customStyle="{background:'#F3F3F3',padding:'20rpx',
'border-radius':'30rpx'
@ -46,7 +45,7 @@
<block v-else>
<view class="vip-card">
<text>当前已开通</text>
<text class='num'>100</text>
<up-count-to :startVal="0" :endVal="count"></up-count-to>
<text>位行业会员</text>
</view>
@ -61,31 +60,88 @@
<uni-th width="20" align="center">状态</uni-th>
</uni-tr>
<!-- 表格数据行 -->
<uni-tr v-for="item in 4">
<uni-td align="center">1</uni-td>
<uni-td style="font-size: 20rpx;" align="center">军哥</uni-td>
<uni-td style="font-size: 20rpx;" align="center">1000.00</uni-td>
<uni-td style="font-size: 20rpx;" align="center">2020-10-20</uni-td>
<uni-td style="font-size: 20rpx;" align="center">已开通</uni-td>
<uni-tr v-for="(item,index) in lists" :key="index">
<uni-td align="center">{{index+1}}</uni-td>
<uni-td style="font-size: 20rpx;" align="center">{{item.real_name}}</uni-td>
<uni-td style="font-size: 20rpx;" align="center">{{item.price}}</uni-td>
<uni-td style="font-size: 20rpx;" align="center">{{item.create_time}}</uni-td>
<uni-td style="font-size: 20rpx;" align="center">
<view v-if="item.paid ==1">已开通</view>
<view v-else @click="upadtaStatus(item)" style="color:#33B83A ;">未开通,查询</view>
</uni-td>
</uni-tr>
</uni-table>
</view>
</block>
<!-- 地址选择器 -->
<up-popup :show="showPop" @close="showPop=false" @open="showPop=true" :round="10">
<view style="padding: 20rpx;">
<up-tabs :list="tabsList" @change='addressTbasChange' :current='currentAddressIndex' lineColor='#20B128'
: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"
@click="addressLiClick(0, item)">
<text>{{item.city_name}}</text>
<up-icon name="arrow-right" :color="item.city_code==formData.city ?'#20B128':'#777777'" />
</view>
</view>
<view class="address-content" v-else-if='currentAddressIndex==1'>
<view class="address-li" v-for="item in addressList.area" @click="addressLiClick(1,item)"
:class='{act:item.area_code==formData.area}'>
<text>{{item.area_name}}</text>
<up-icon name="arrow-right" :color="item.area_code==formData.area ?'#20B128':'#777777'" />
</view>
</view>
<view class="address-content" v-else-if='currentAddressIndex==2'>
<view class="address-li" v-for="item in addressList.street" @click="addressLiClick(2,item)"
:class='{act:item.street_code==formData.street}'>
<text>{{item.street_name}}</text>
<up-icon name="arrow-right" :color="item.street_code==formData.street ?'#20B128':'#777777'" />
</view>
</view>
<view class="address-content" v-else-if='currentAddressIndex==3'>
<view class="address-li" v-for="item in addressList.village" @click="addressLiClick(3,item)"
: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'" />
</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"
@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>
</template>
<script setup>
import {
reactive,
ref
} from 'vue';
import {
provinceListApi,
cityListApi,
areaListApi,
streetListApi,
villageListApi,
brigadeListApi
} from "@/api/address.js"
import {
vipRechargeApi,
rechargeCountApi,
rechargeListsApi,
updataOrderApi
} from "@/api/user.js"
import {
onPullDownRefresh
} from "@dcloudio/uni-app"
//
let STORE_INFO = uni.getStorageSync('STORE_INFO');
@ -93,27 +149,176 @@
STORE_INFO = JSON.parse(STORE_INFO)
const currentTab = ref(1)
const formData = reactive({
name: "",
phone: "",
store_id: STORE_INFO.id,
mobile: "",
province: 510000,
city: '',
area: "",
street: "",
village: "",
brigade: "",
real_name: "",
auth_code: "130600111488101385",
// auth_code: "",
address: ""
})
const submit = () => {
//
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) => {
currentAddressIndex.value = e.index
}
const addressList = reactive({
city: [],
area: [],
street: [],
village: [],
brigade: []
})
const addressLiClick = async (i, item) => {
if (i == 0) {
formData.city = item.city_code
tabsList[0].name = item.city_name
let res = await areaListApi({
city_code: formData.city
})
addressList.area = res.data
}
if (i == 1) {
formData.area = item.area_code
tabsList[1].name = item.area_name
let res = await streetListApi({
area_code: formData.area
})
addressList.street = res.data
}
if (i == 2) {
formData.street = item.street_code
tabsList[2].name = item.street_name
let res = await villageListApi({
street_code: formData.street
})
addressList.village = res.data
}
if (i == 3) {
formData.village = item.village_code
tabsList[3].name = item.village_name
let res = await brigadeListApi({
village_code: formData.village
})
addressList.brigade = res.data
}
if (i == 4) {
formData.brigade = item.id
tabsList[4].name = item.brigade_name
formData.address = tabsList[0].name + tabsList[1].name + tabsList[2].name + tabsList[3].name +
tabsList[4].name
return showPop.value = false
}
formData.address = tabsList[0].name + tabsList[1].name + tabsList[2].name + tabsList[3].name + tabsList[4]
.name
return currentAddressIndex.value++
}
const getCityList = async () => {
let res = await cityListApi({
province_code: formData.province
})
addressList.city = res.data
}
getCityList()
const tabsList = reactive(
[{
name: "请选择"
},
{
name: '请选择',
disabled: false
},
{
name: '请选择',
disabled: false
},
{
name: '请选择',
disabled: false
},
{
name: '请选择',
disabled: false
},
]);
const submit = async () => {
if (!formData.real_name) return uni.$u.toast('请填写真实姓名');
if (!formData.mobile) return uni.$u.toast('请填写电话号码');
uni.scanCode({
success: function(res) {
console.log('条码类型:' + res.scanType);
console.log('条码内容:' + res.result);
formData.auth_code = res.result
vipRechargeApi(formData).then(res => {
uni.$u.toast('操作成功');
currentTab.value = 2
})
}
});
}
const showPop = () => {
console.log(4545)
//
const count = ref(0)
const getCount = async () => {
let res = await rechargeCountApi({
store_id: STORE_INFO.id
})
count.value = res.data.count
}
//
const lists = ref([])
const getLists = async () => {
let res = await rechargeListsApi({
store_id: STORE_INFO.id,
recharge_type: "INDUSTRYMEMBERS"
})
lists.value = res.data.lists
}
getCount()
getLists()
const upadtaStatus = (item) => {
console.log(item)
updataOrderApi({
order_no: item.order_id,
recharge: 1
})
}
onPullDownRefresh(() => {
getCount()
getLists()
setTimeout(() => {
uni.stopPullDownRefresh()
}, 500)
})
</script>
<style lang='scss'>
@ -207,9 +412,29 @@
}
.table {
padding: 20rpx;
width: 710rpx;
box-sizing: border-box;
font-size: 30rpx;
margin: 0 auto;
}
.address-content {
padding: 20rpx;
height: 50vh;
overflow-y: auto;
.address-li {
display: flex;
justify-content: space-between;
align-items: center;
font-size: 32rpx;
color: #777777;
margin: 30rpx 0;
}
.act {
color: #20B128;
}
}
</style>