Merge branch 'master' of https://gitea.lihaink.cn/weipengfei/purchase-let
This commit is contained in:
commit
1a18dabe79
|
@ -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);
|
||||
}
|
27
api/user.js
27
api/user.js
|
@ -93,4 +93,31 @@ 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);
|
||||
}
|
||||
|
||||
|
||||
|
||||
export const getStoreByPhone = (data) => {
|
||||
return request.get('/store/Store/detail', data);
|
||||
}
|
||||
|
||||
|
||||
export const getStoreInfo = (data) => {
|
||||
return request.get('/config', data);
|
||||
}
|
|
@ -1,119 +1,374 @@
|
|||
<template>
|
||||
<view class="tabs">
|
||||
<text @click="currentTab=1" :class="{actText:currentTab==1}">开通行业会员</text>
|
||||
<text @click="currentTab=2" :class="{actText:currentTab==2}"> 已开通列表</text>
|
||||
<view class="lines" :class="{actLine:currentTab==2}" />
|
||||
<view class="" v-if="!STORE_INFO.id">
|
||||
<up-modal :show="showModa" title="选择门店" @confirm="confirmStore" confirmColor='#20B128'>
|
||||
<view class="slot-content">
|
||||
<up-input v-model="storePhone" border="none" prefixIcon="phone" placeholder="请输入门店手机号"
|
||||
:customStyle="{background:'#F3F3F3',padding:'20rpx','border-radius':'30rpx'}"
|
||||
:placeholderStyle="{color:'#444444'}" :prefixIconStyle="{'margin-right':'40rpx'}"></up-input>
|
||||
|
||||
</view>
|
||||
</up-modal>
|
||||
</view>
|
||||
|
||||
<!-- tabs1 -->
|
||||
<block v-if='currentTab==1'>
|
||||
<view class="card card1">
|
||||
<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="请输入姓名"
|
||||
: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="请输入电话号码"
|
||||
:customStyle="{background:'#F3F3F3',padding:'20rpx','border-radius':'30rpx'}"
|
||||
:placeholderStyle="{color:'#444444'}" :prefixIconStyle="{'margin-right':'40rpx'}"></up-input>
|
||||
</up-form-item>
|
||||
<view v-else>
|
||||
<view class="tabs">
|
||||
<text @click="currentTab=1" :class="{actText:currentTab==1}">开通行业会员</text>
|
||||
<text @click="currentTab=2,getCount(),getLists()" :class="{actText:currentTab==2}"> 已开通列表</text>
|
||||
<view class="lines" :class="{actLine:currentTab==2}" />
|
||||
</view>
|
||||
|
||||
<up-form-item label="" prop="userInfo.name" borderBottom>
|
||||
<view @click="showPop" 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'
|
||||
}" :placeholderStyle="{color:'#444444'}" :prefixIconStyle="{'margin-right':'40rpx'}"
|
||||
suffixIcon='arrow-down'></up-input>
|
||||
</view>
|
||||
</up-form-item>
|
||||
</up-form>
|
||||
<view class="store-info">
|
||||
报备人:{{STORE_INFO.detailed_address}}
|
||||
<!-- tabs1 -->
|
||||
<block v-if='currentTab==1'>
|
||||
<view class="card card1">
|
||||
<view class="card1-tit">
|
||||
行业会员开通报备
|
||||
</view>
|
||||
<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">
|
||||
<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">
|
||||
<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'
|
||||
}" :placeholderStyle="{color:'#444444'}" :prefixIconStyle="{'margin-right':'40rpx'}"
|
||||
suffixIcon='arrow-down'></up-input>
|
||||
</view>
|
||||
</up-form-item>
|
||||
</up-form>
|
||||
<view class="store-info">
|
||||
报备人:{{STORE_INFO.name}}
|
||||
</view>
|
||||
</view>
|
||||
<view class="submit-btn" @click="submit">
|
||||
<!-- <up-button text="完成并收款" size='large' :customStyle="{height:'100rpx',fontSize:'50rpx'}" @click="submit"
|
||||
shape="circle" color="#50C758"></up-button> -->
|
||||
<view
|
||||
style='width: 710rpx;height: 100rpx;text-align: center;line-height: 100rpx;text-align: center;color: white;background-color: #33B83A;border-radius: 50rpx;font-size:40rpx ;'>
|
||||
完成并收款
|
||||
</view>
|
||||
|
||||
</view>
|
||||
</block>
|
||||
|
||||
<!-- tabs2 -->
|
||||
<block v-else>
|
||||
<view class="vip-card">
|
||||
<text>当前已开通:</text>
|
||||
<up-count-to :startVal="0" :endVal="count"></up-count-to>
|
||||
<text>位行业会员</text>
|
||||
</view>
|
||||
|
||||
<view class="table">
|
||||
<uni-table stripe emptyText="暂无更多数据" width="100%">
|
||||
<!-- 表头行 -->
|
||||
<uni-tr>
|
||||
<uni-th width="20" align="center">序号</uni-th>
|
||||
<uni-th width="50" align="center">行业会员</uni-th>
|
||||
<uni-th width="50" align="center">经营资金</uni-th>
|
||||
<uni-th width="50" align="center">开通时间</uni-th>
|
||||
<uni-th width="50" align="center">状态</uni-th>
|
||||
</uni-tr>
|
||||
<!-- 表格数据行 -->
|
||||
<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>
|
||||
</view>
|
||||
|
||||
|
||||
|
||||
<!-- 地址选择器 -->
|
||||
<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>
|
||||
<view class="submit-btn">
|
||||
<up-button text="完成并收款" @click="submit" shape="circle" color="#50C758"></up-button>
|
||||
</view>
|
||||
</block>
|
||||
|
||||
<!-- tabs2 -->
|
||||
<block v-else>
|
||||
<view class="vip-card">
|
||||
<text>当前已开通:</text>
|
||||
<text class='num'>100</text>
|
||||
<text>位行业会员</text>
|
||||
</view>
|
||||
|
||||
<view class="table">
|
||||
<uni-table stripe emptyText="暂无更多数据" width="100%">
|
||||
<!-- 表头行 -->
|
||||
<uni-tr>
|
||||
<uni-th width="10" align="center">序号</uni-th>
|
||||
<uni-th width="25" align="center">行业会员</uni-th>
|
||||
<uni-th width="25" align="center">经营资金</uni-th>
|
||||
<uni-th width="30" align="center">开通时间</uni-th>
|
||||
<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>
|
||||
|
||||
|
||||
</uni-table>
|
||||
</view>
|
||||
</block>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
</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,
|
||||
getStoreByPhone
|
||||
} from "@/api/user.js"
|
||||
|
||||
import {
|
||||
onPullDownRefresh
|
||||
} from "@dcloudio/uni-app"
|
||||
|
||||
|
||||
const showModa = ref(true)
|
||||
const storePhone = ref('15699996666')
|
||||
const confirmStore = () => {
|
||||
getStoreByPhone({
|
||||
phone: storePhone.value
|
||||
}).then(res => {
|
||||
for (let key in res.data) {
|
||||
STORE_INFO[key] = res.data[key]
|
||||
}
|
||||
}).catch(err => {
|
||||
uni.$u.toast('未查到店铺信息,请检查手机号码')
|
||||
})
|
||||
|
||||
|
||||
}
|
||||
|
||||
// 用户选择的门店信息
|
||||
let STORE_INFO = uni.getStorageSync('STORE_INFO');
|
||||
if (STORE_INFO)
|
||||
STORE_INFO = JSON.parse(STORE_INFO)
|
||||
let STORE_INFO = reactive({
|
||||
id: ""
|
||||
})
|
||||
|
||||
|
||||
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: "",
|
||||
// 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('请填写电话号码');
|
||||
formData.store_id = STORE_INFO.id
|
||||
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
|
||||
formData.real_name = ''
|
||||
formData.mobile = ''
|
||||
formData.address = ''
|
||||
tabsList.forEach(item => {
|
||||
item.name = '请选择'
|
||||
})
|
||||
|
||||
})
|
||||
getCount()
|
||||
getLists()
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
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) => {
|
||||
updataOrderApi({
|
||||
order_no: item.order_id,
|
||||
recharge: 1
|
||||
})
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
onPullDownRefresh(() => {
|
||||
getCount()
|
||||
getLists()
|
||||
setTimeout(() => {
|
||||
uni.stopPullDownRefresh()
|
||||
}, 500)
|
||||
})
|
||||
</script>
|
||||
|
||||
<style lang='scss'>
|
||||
|
@ -176,6 +431,7 @@
|
|||
}
|
||||
|
||||
.submit-btn {
|
||||
/* height: 200rpx; */
|
||||
position: fixed;
|
||||
bottom: 50rpx;
|
||||
width: 710rpx;
|
||||
|
@ -207,9 +463,37 @@
|
|||
}
|
||||
|
||||
.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;
|
||||
}
|
||||
}
|
||||
|
||||
.uni-table-th {
|
||||
padding: 10rpx 0 !important;
|
||||
}
|
||||
|
||||
.uni-table-td {
|
||||
padding: 10rpx 0 !important;
|
||||
}
|
||||
</style>
|
|
@ -434,15 +434,6 @@
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
.shop-item:last-child {
|
||||
margin-bottom: 100px;
|
||||
background-color: red;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -21,15 +21,15 @@
|
|||
<view class="content">
|
||||
<up-navbar placeholder style="z-index: 10080;">
|
||||
<template #left>
|
||||
|
||||
<view class="store-info" @click="navgo('/multipleShop/index/index')">
|
||||
<view style="display: flex;font-size: 30rpx;font-weight: bold;">
|
||||
<text
|
||||
style="max-width: 400rpx;overflow: hidden;text-overflow: ellipsis;white-space: nowrap;">{{shareInfo.real_name?(shareInfo.real_name + '-' + STORE_INFO.name):STORE_INFO.name}}</text>
|
||||
<text v-if="userStore.userInfo.vip_name=='行业会员'"
|
||||
style="max-width: 400rpx;overflow: hidden;text-overflow: ellipsis;white-space: nowrap;">{{(shareInfo.real_name||userStore.userInfo.nickname + '的供销个人门店' )}}</text>
|
||||
<text v-else
|
||||
style="max-width: 400rpx;overflow: hidden;text-overflow: ellipsis;white-space: nowrap;">{{shareInfo.real_name?(shareInfo.real_name + '的' + STORE_INFO.name):STORE_INFO.store_name}}</text>
|
||||
<up-icon name="arrow-right"></up-icon>
|
||||
</view>
|
||||
<view style="display: flex;font-size: 24rpx;color:#777777 ;">
|
||||
{{STORE_INFO.detailed_address}}
|
||||
</view>
|
||||
</view>
|
||||
</template>
|
||||
</up-navbar>
|
||||
|
@ -226,7 +226,7 @@
|
|||
|
||||
const STORE_INFO = ref({
|
||||
name: '',
|
||||
id: '',
|
||||
id: 5,
|
||||
detailed_address: '',
|
||||
image: ''
|
||||
});
|
||||
|
@ -260,9 +260,11 @@
|
|||
})
|
||||
|
||||
const navgo = (url) => {
|
||||
uni.navigateTo({
|
||||
url
|
||||
})
|
||||
if (userStore.userInfo.vip_name) return
|
||||
|
||||
// uni.navigateTo({
|
||||
// url
|
||||
// })
|
||||
}
|
||||
|
||||
/*商品列表滚动隐藏头部导航 */
|
||||
|
@ -313,7 +315,7 @@
|
|||
cart_num: cart_num,
|
||||
is_new: 0, // 是否直接购买0否1是
|
||||
// goods_id: id,
|
||||
store_id: STORE_INFO.value.id,
|
||||
store_id: STORE_INFO.value.id || 5,
|
||||
product_id: product_id
|
||||
}).then(res => {
|
||||
getCartList();
|
||||
|
@ -341,7 +343,7 @@
|
|||
name: '',
|
||||
order: '',
|
||||
store_name: '',
|
||||
store_id: STORE_INFO.value.id || ''
|
||||
store_id: STORE_INFO.value.id || '5'
|
||||
})
|
||||
|
||||
const loading = ref(true);
|
||||
|
@ -390,7 +392,7 @@
|
|||
page_no: page_no,
|
||||
page_size: 30,
|
||||
level: three,
|
||||
store_id: STORE_INFO.value.id || '' // 店铺id,用于获取店铺分类列表,如果为空则获取全部分类列表,否则获取店铺分类列表。
|
||||
store_id: STORE_INFO.value.id || '5' // 店铺id,用于获取店铺分类列表,如果为空则获取全部分类列表,否则获取店铺分类列表。
|
||||
}).then(res => {
|
||||
if (pid == 0) { // 加载一级分类时设置全部分类
|
||||
if (!res.data?.lists?.length) return;
|
||||
|
@ -498,7 +500,7 @@
|
|||
productLogApi({
|
||||
product_id: item.product_id,
|
||||
cate_id: item.cate_id,
|
||||
store_id: STORE_INFO.value.id || ''
|
||||
store_id: STORE_INFO.value.id || '5'
|
||||
});
|
||||
};
|
||||
const changeGood = (data) => { // 确定选择商品重量
|
||||
|
@ -564,9 +566,9 @@
|
|||
onLoad(async (opt) => {
|
||||
// 店铺id
|
||||
if (opt.id) {
|
||||
where.value.store_id = opt.id;
|
||||
where.value.store_id = 5;
|
||||
const info = await shopDetailApi({
|
||||
store_id: opt.id
|
||||
store_id: 5
|
||||
});
|
||||
|
||||
STORE_INFO.value = info.data;
|
||||
|
@ -590,7 +592,7 @@
|
|||
const info = uni.getStorageSync('STORE_INFO');
|
||||
if (info) {
|
||||
STORE_INFO.value = JSON.parse(info);
|
||||
where.value.store_id = STORE_INFO.value.id;
|
||||
where.value.store_id = 5;
|
||||
}
|
||||
|
||||
// 分享信息
|
||||
|
@ -1054,6 +1056,6 @@
|
|||
|
||||
.store-info {
|
||||
margin: 0 0 20rpx 20rpx;
|
||||
margin-top: 80rpx;
|
||||
margin-top: 20rpx;
|
||||
}
|
||||
</style>
|
|
@ -16,6 +16,10 @@
|
|||
<up-button @click="weixinLogin" color="#20B128" size="large"><up-icon name="weixin-fill"
|
||||
color="#fff" size="28"></up-icon>微信快捷登录</up-button>
|
||||
</view>
|
||||
<view class="btn">
|
||||
<up-button @click="navgo('/pages/login/test')" color="#20B128" size="large"><up-icon
|
||||
name="weixin-fill" color="#fff" size="28"></up-icon>账号登录</up-button>
|
||||
</view>
|
||||
<!-- <view class="btn">
|
||||
<up-button @click="officialCode" color="#20B128" size="large"><up-icon name="weixin-fill" color="#fff"
|
||||
size="28"></up-icon>公众号授权</up-button>
|
||||
|
@ -86,7 +90,8 @@
|
|||
import {
|
||||
userLoginApi,
|
||||
userLoginWeixinApi,
|
||||
getMobileByMnpApi
|
||||
getMobileByMnpApi,
|
||||
getStoreInfo
|
||||
} from "@/api/user.js";
|
||||
import useUserStore from "@/store/user.js"
|
||||
import bindPhone from "@/components/bindPhone.vue"
|
||||
|
@ -151,6 +156,9 @@
|
|||
}).then(res => {
|
||||
uni.hideLoading();
|
||||
userStore.setToken(res.data.token);
|
||||
getStoreInfo().then(res => {
|
||||
uni.setStorageSync("STORE_INFO", JSON.stringify(res.data))
|
||||
})
|
||||
|
||||
if (!res.data.mobile) { //未绑定手机号
|
||||
return showBind.value = true;
|
||||
|
@ -176,7 +184,7 @@
|
|||
} else {
|
||||
// 直接选择门店
|
||||
uni.reLaunch({
|
||||
url: "/multipleShop/index/index"
|
||||
url: "/pages/index/index?id=" + storeInfo.id
|
||||
})
|
||||
}
|
||||
}
|
||||
|
@ -285,6 +293,11 @@
|
|||
return true;
|
||||
} else uni.navigateBack();
|
||||
}
|
||||
const navgo = (url) => {
|
||||
uni.navigateTo({
|
||||
url
|
||||
})
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="scss">
|
||||
|
|
|
@ -9,7 +9,8 @@
|
|||
<script setup>
|
||||
import {
|
||||
userLoginApi,
|
||||
userInfoApi
|
||||
userInfoApi,
|
||||
getStoreInfo
|
||||
} from "@/api/user.js";
|
||||
import {
|
||||
ref
|
||||
|
@ -25,6 +26,11 @@
|
|||
"terminal": 2,
|
||||
"scene": 1
|
||||
}).then(res => {
|
||||
|
||||
getStoreInfo().then(res => {
|
||||
uni.setStorageSync("STORE_INFO", JSON.stringify(res.data))
|
||||
})
|
||||
|
||||
uni.setStorageSync('token', res.data.token);
|
||||
userStore.setToken(res.data.token);
|
||||
console.log(res.data.token)
|
||||
|
|
|
@ -53,7 +53,12 @@
|
|||
</view>
|
||||
<view class="rest-item">
|
||||
<view class="rest-item-num">{{userInfo.return_money}}</view>
|
||||
<view class="rest-item-txt">待返还金额</view>
|
||||
<view class="rest-item-txt">返还金</view>
|
||||
</view>
|
||||
|
||||
<view class="rest-item">
|
||||
<view class="rest-item-num">{{userInfo.integral}}</view>
|
||||
<view class="rest-item-txt">礼品券</view>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
|
@ -172,6 +177,8 @@
|
|||
const logout = () => {
|
||||
userStore.setToken('');
|
||||
userStore.setUserInfo({});
|
||||
uni.setStorageSync("STORE_INFO", '')
|
||||
|
||||
uni.reLaunch({
|
||||
url: '/pages/login/login'
|
||||
})
|
||||
|
|
|
@ -64,12 +64,19 @@
|
|||
<view>运费</view>
|
||||
<view><text>¥</text>0<text>.00</text></view>
|
||||
</view>
|
||||
<view class="row" v-if="orderInfo.activities == 1" style="color: red;">
|
||||
<view class="row" v-if="[4,5,6].includes(userInfo.user_ship) ">
|
||||
<view>优惠减免</view>
|
||||
<view>
|
||||
<text>-¥</text>{{ c_price(orderInfo.preferential_amount, 0) }}<text>.{{ c_price(orderInfo.preferential_amount, 1) }}</text>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<!-- <view class="row" v-if="orderInfo.activities == 1" style="color: red;">
|
||||
<view>活动折扣 <text>{{ orderInfo.activity }}</text></view>
|
||||
<view>
|
||||
-¥<text>{{ orderInfo.activity_price }}</text>
|
||||
</view>
|
||||
</view>
|
||||
</view> -->
|
||||
</view>
|
||||
<view class="m-card good-info">
|
||||
<view class="head-title">支付方式</view>
|
||||
|
@ -182,6 +189,8 @@
|
|||
|
||||
const userInfo = useUserStore().userInfo;
|
||||
|
||||
console.log(userInfo)
|
||||
|
||||
// 用户选择的门店信息
|
||||
let STORE_INFO = uni.getStorageSync('STORE_INFO');
|
||||
if (STORE_INFO)
|
||||
|
|
156
utils/request.js
156
utils/request.js
|
@ -1,5 +1,5 @@
|
|||
import {
|
||||
config
|
||||
config
|
||||
} from '@/config/app';
|
||||
|
||||
import useUserStore from '@/store/user';
|
||||
|
@ -7,89 +7,89 @@ import useUserStore from '@/store/user';
|
|||
const userStore = useUserStore();
|
||||
|
||||
function baseRequest(url, method, data, {
|
||||
noAuth = false,
|
||||
noVerify = false,
|
||||
onReLogin = false
|
||||
noAuth = false,
|
||||
noVerify = false,
|
||||
onReLogin = false
|
||||
}) {
|
||||
let Url = config.HTTP_REQUEST_URL,
|
||||
header = config.HEADER;
|
||||
if (userStore.userInfo) {
|
||||
header.TOKEN = userStore.token
|
||||
}
|
||||
let Url = config.HTTP_REQUEST_URL,
|
||||
header = config.HEADER;
|
||||
if (userStore.userInfo) {
|
||||
header.TOKEN = userStore.token
|
||||
}
|
||||
|
||||
return new Promise((reslove, reject) => {
|
||||
uni.request({
|
||||
url: Url + '/api' + url,
|
||||
method: method || 'GET',
|
||||
header: {
|
||||
...header
|
||||
},
|
||||
data: method != 'GET' ? data || {} : {},
|
||||
params: method == 'GET' ? data : {},
|
||||
success: (res) => {
|
||||
// console.log(res, 'res')
|
||||
return new Promise((reslove, reject) => {
|
||||
uni.request({
|
||||
url: Url + '/api' + url,
|
||||
method: method || 'GET',
|
||||
header: {
|
||||
...header
|
||||
},
|
||||
data: method != 'GET' ? data || {} : {},
|
||||
params: method == 'GET' ? data : {},
|
||||
success: (res) => {
|
||||
// console.log(res, 'res')
|
||||
|
||||
if (res.data.show) {
|
||||
uni.showToast({
|
||||
title: res.data.msg || '操作成功',
|
||||
icon: 'none',
|
||||
})
|
||||
}
|
||||
if (noVerify)
|
||||
reslove(res.data);
|
||||
else if (res.data.code == -1) {
|
||||
if (res.data.msg == "登录超时,请重新登录" && !noAuth) {
|
||||
userStore.setToken('');
|
||||
userStore.setUserInfo({});
|
||||
uni.showModal({
|
||||
content: '您需要先登录才可使用该功能, 是否前去登录',
|
||||
success: (e) => {
|
||||
if (e.confirm) uni.navigateTo({
|
||||
url: '/pages/login/login'
|
||||
})
|
||||
}
|
||||
})
|
||||
}
|
||||
} else if (res.data.code == 0) {
|
||||
if (res.data.msg == "请求参数缺token" && !noAuth) {
|
||||
userStore.setToken('');
|
||||
userStore.setUserInfo({});
|
||||
uni.showModal({
|
||||
content: '您需要先登录才可使用该功能, 是否前去登录',
|
||||
success: (e) => {
|
||||
if (e.confirm) uni.navigateTo({
|
||||
url: '/pages/login/login'
|
||||
})
|
||||
}
|
||||
})
|
||||
}
|
||||
reject(res.data);
|
||||
} else if (res.data.code == 1) {
|
||||
reslove(res.data);
|
||||
} else if (res.data.code == 200) {
|
||||
reslove(res.data.data);
|
||||
} else if ([410000, 410001, 410002, 40000].indexOf(res.data.code) !== -1) {
|
||||
reject(res.data);
|
||||
} else if (res.data.code == 501) {
|
||||
reject(res.data);
|
||||
} else {
|
||||
reject(res.data.msg || '请检查网络');
|
||||
}
|
||||
},
|
||||
fail: (message) => {
|
||||
console.log(message, '错误信息')
|
||||
uni.showToast({
|
||||
title: '网络错误',
|
||||
icon: 'none'
|
||||
})
|
||||
reject('请求失败');
|
||||
}
|
||||
})
|
||||
});
|
||||
if (res.data.show) {
|
||||
uni.showToast({
|
||||
title: res.data.msg || '操作成功',
|
||||
icon: 'none',
|
||||
})
|
||||
}
|
||||
if (noVerify)
|
||||
reslove(res.data);
|
||||
else if (res.data.code == -1) {
|
||||
if (res.data.msg == "登录超时,请重新登录" && !noAuth) {
|
||||
userStore.setToken('');
|
||||
userStore.setUserInfo({});
|
||||
uni.showModal({
|
||||
content: '您需要先登录才可使用该功能, 是否前去登录',
|
||||
success: (e) => {
|
||||
if (e.confirm) uni.navigateTo({
|
||||
url: '/pages/login/login'
|
||||
})
|
||||
}
|
||||
})
|
||||
}
|
||||
} else if (res.data.code == 0) {
|
||||
if (res.data.msg == "请求参数缺token" && !noAuth) {
|
||||
userStore.setToken('');
|
||||
userStore.setUserInfo({});
|
||||
uni.showModal({
|
||||
content: '您需要先登录才可使用该功能, 是否前去登录',
|
||||
success: (e) => {
|
||||
if (e.confirm) uni.navigateTo({
|
||||
url: '/pages/login/login'
|
||||
})
|
||||
}
|
||||
})
|
||||
}
|
||||
reject(res.data);
|
||||
} else if (res.data.code == 1) {
|
||||
reslove(res.data);
|
||||
} else if (res.data.code == 200) {
|
||||
reslove(res.data.data);
|
||||
} else if ([410000, 410001, 410002, 40000].indexOf(res.data.code) !== -1) {
|
||||
reject(res.data);
|
||||
} else if (res.data.code == 501) {
|
||||
reject(res.data);
|
||||
} else {
|
||||
reject(res.data.msg || '请检查网络');
|
||||
}
|
||||
},
|
||||
fail: (message) => {
|
||||
console.log(message, '错误信息')
|
||||
uni.showToast({
|
||||
title: '网络错误',
|
||||
icon: 'none'
|
||||
})
|
||||
reject('请求失败');
|
||||
}
|
||||
})
|
||||
});
|
||||
}
|
||||
const syhttp = {};
|
||||
|
||||
['options', 'get', 'post', 'put', 'head', 'delete', 'trace', 'connect'].forEach((method) => {
|
||||
syhttp[method] = (api, data, opt) => baseRequest(api, method, data, opt || {})
|
||||
syhttp[method] = (api, data, opt) => baseRequest(api, method, data, opt || {})
|
||||
});
|
||||
export default syhttp;
|
Loading…
Reference in New Issue