消费者分销

This commit is contained in:
donqi 2022-07-20 16:19:20 +08:00
parent 53bf50ba3f
commit 12221e22fe
8 changed files with 892 additions and 392 deletions

View File

@ -4,214 +4,227 @@ export default {
// 异步接口拦截 // 异步接口拦截
addInterceptor() { addInterceptor() {
uni.addInterceptor('request', { uni.addInterceptor('request', {
invoke(args) { invoke(args) {
uni.showLoading({ uni.showLoading({
mask: true, mask: true,
title: '加载中' title: '加载中'
}) })
// request 触发前拼接 url // request 触发前拼接 url
args.url = 'https://www.opsoul.com' + args.url; // args.url = 'https://www.opsoul.com' + args.url;
// args.url = 'http://192.168.2.42:80' + args.url; // args.url = 'http://192.168.2.42:80' + args.url;
// args.url = 'http://127.0.0.1:80' + args.url; args.url = 'http://127.0.0.1:80' + args.url;
if (args.data) { if (args.data) {
args.data.deptId = globalData.deptId; args.data.deptId = globalData.deptId;
args.data.from = globalData.from; args.data.from = globalData.from;
} }
if (args.header) { if (args.header) {
args.header.deptId = globalData.deptId; args.header.deptId = globalData.deptId;
args.header.from = globalData.from; args.header.from = globalData.from;
} }
// console.log("停止触发"); // console.log("停止触发");
// return false; // return false;
}, },
success(res) { success(res) {
if (res.data.code !== 0) { if (res.data.code !== 0) {
uni.showToast({ uni.showToast({
title: '系统开小差啦T_T请稍后重试', title: '系统开小差啦T_T请稍后重试',
icon: 'error' icon: 'error'
}) })
} }
}, },
fail(err) { fail(err) {
uni.showToast({ uni.showToast({
title: '系统开小差啦T_T请稍后重试', title: '系统开小差啦T_T请稍后重试',
icon: 'error' icon: 'error'
}) })
}, },
complete(res) { complete(res) {
uni.hideLoading(); uni.hideLoading();
} }
}) })
}, },
checkAndAuth() { authAndGetLocation() {
let _this = this; let _this = this;
// 通过 wx.getSetting 先查询一下用户是否授权了 "scope.userInfo" 这个 scope // 通过 wx.getSetting 先查询一下用户是否授权了 "scope.userLocation" 这个 scope
wx.getSetting({ wx.getSetting({
success(res) { success(res) {
if (!res.authSetting['scope.userInfo']) { if (!res.authSetting['scope.userLocation']) {
// 用户授权 // 用户授权
wx.authorize({ wx.authorize({
scope: 'scope.userInfo', scope: 'scope.userLocation',
success() { success() {
// 用户已经同意, 后续调用此接口不会弹窗询问 // 用户已经同意, 后续调用此接口不会弹窗询问
_this.login(); _this.wxGetLocation();
}, },
fail() { fail() {
// 用户已经拒绝过授权 // 用户已经拒绝过授权
wx.openSetting({ wx.openSetting({
success(res) { success(res) {
if (res['scope.userInfo']) { if (res['scope.userLocation']) {
_this.checkAndAuth(); _this.wxGetLocation();
} }
} }
}) })
} }
}) })
} else { } else {
_this.login(); _this.wxGetLocation();
} }
} }
}) })
}, },
async login() { wxGetLocation() {
let userInfo = await wx.getUserProfile({ wx.getLocation({
desc: '用于小程序登录' type: 'gcj02',
}); success(res) {
// 获取微信登录凭证 const latitude = res.latitude
const wxLoginRes = await wx.login(); const longitude = res.longitude
// 获取openid console.log(res)
const wxAuthRes = await uni.request({ // uni.setStorageSync('userLocation', res);
url: '/wx/auth', },
header: { complete(res) {
code: wxLoginRes.code console.log(res)
} }
}) })
const openId = wxAuthRes[1].data.data.openid; },
// 第一次从服务端获取用户信息 async login() {
let wxGetUserRes = await this.qryUserInfo(openId); let userInfo = await wx.getUserProfile({
// 获取失败则获取微信信息再调用注册接口 desc: '用于小程序登录'
if (!wxGetUserRes.data) { });
// 注册完成后再次从服务端获取用户信息 // 获取微信登录凭证
let registerRes = await this.registerUser({ const wxLoginRes = await wx.login();
openId: openId, // 获取openid
name: userInfo.userInfo.nickName, const wxAuthRes = await uni.request({
customerLogoUrl: userInfo.userInfo.avatarUrl, url: '/wx/auth',
status: 0 header: {
}); code: wxLoginRes.code
if (registerRes.code === 0) { }
wxGetUserRes = await this.qryUserInfo(openId); })
} const openId = wxAuthRes[1].data.data.openid;
} // 第一次从服务端获取用户信息
if (!wxGetUserRes.data) { let wxGetUserRes = await this.qryUserInfo(openId);
userInfo = null; // 获取失败则获取微信信息再调用注册接口
} else { if (!wxGetUserRes.data) {
userInfo = { // 注册完成后再次从服务端获取用户信息
...wxGetUserRes.data, let registerRes = await this.registerUser({
wxLoginCode: wxLoginRes.code openId: openId,
} name: userInfo.userInfo.nickName,
} customerLogoUrl: userInfo.userInfo.avatarUrl,
if (!userInfo || userInfo.customerId == null || userInfo.customerId == undefined) { status: 0
uni.showToast({ });
icon: 'none', if (registerRes.code === 0) {
title: '微信用户信息获取失败,请退出小程序重试' wxGetUserRes = await this.qryUserInfo(openId);
}) }
return false; }
} if (!wxGetUserRes.data) {
// 页面存储用户登录有效信息,以便其他页面调用 userInfo = null;
uni.setStorageSync('userProfile', userInfo); } else {
userInfo = {
...wxGetUserRes.data,
wxLoginCode: wxLoginRes.code
}
}
if (!userInfo || userInfo.customerId == null || userInfo.customerId == undefined) {
uni.showToast({
icon: 'none',
title: '微信用户信息获取失败,请退出小程序重试'
})
return false;
}
// 页面存储用户登录有效信息,以便其他页面调用
uni.setStorageSync('userProfile', userInfo);
return true; return true;
}, },
async storageExistUser() { async storageExistUser() {
uni.clearStorageSync('userProfile'); uni.clearStorageSync('userProfile');
// 获取微信登录凭证 // 获取微信登录凭证
const wxLoginRes = await wx.login(); const wxLoginRes = await wx.login();
// 获取openid // 获取openid
const wxAuthRes = await uni.request({ const wxAuthRes = await uni.request({
url: '/wx/auth', url: '/wx/auth',
header: { header: {
code: wxLoginRes.code code: wxLoginRes.code
} }
}) })
const openId = wxAuthRes[1].data.data.openid; const openId = wxAuthRes[1].data.data.openid;
// 从服务端获取用户信息 // 从服务端获取用户信息
let wxGetUserRes = await this.qryUserInfo(openId); let wxGetUserRes = await this.qryUserInfo(openId);
let userInfo = null; let userInfo = null;
if (wxGetUserRes.data) { if (wxGetUserRes.data) {
userInfo = { userInfo = {
...wxGetUserRes.data, ...wxGetUserRes.data,
wxLoginCode: wxLoginRes.code wxLoginCode: wxLoginRes.code
} }
} }
uni.setStorageSync('userProfile', userInfo); uni.setStorageSync('userProfile', userInfo);
}, },
async registerUser(params = {}) { async registerUser(params = {}) {
let res = await uni.request({ let res = await uni.request({
url: '/wx/addUser', url: '/wx/addUser',
method: 'POST', method: 'POST',
data: params data: params
}) })
return res[1].data; return res[1].data;
}, },
async qryUserInfo(openId) { async qryUserInfo(openId) {
let res = await uni.request({ let res = await uni.request({
url: '/wx/getUserInfo', url: '/wx/getUserInfo',
method: 'POST', method: 'POST',
data: { data: {
openId: openId openId: openId
} }
}) })
return res[1].data; return res[1].data;
}, },
async qryUserPhone(code) { async qryUserPhone(code) {
let res = await uni.request({ let res = await uni.request({
url: '/wx/auth/phone', url: '/wx/auth/phone',
method: 'GET', method: 'GET',
header: { header: {
code: code code: code
} }
}) })
return res[1].data; return res[1].data;
}, },
async updateUser(params = {}) { async updateUser(params = {}) {
let res = await uni.request({ let res = await uni.request({
url: '/customer/update', url: '/customer/update',
method: 'POST', method: 'POST',
data: params data: params
}) })
// 更新用户信息的方法顺便更新本地缓存 // 更新用户信息的方法顺便更新本地缓存
if (res[1].data.code === 0) { if (res[1].data.code === 0) {
let userInfo = this.getCurUserInfo(); let userInfo = this.getCurUserInfo();
let wxGetUserRes = await this.qryUserInfo(userInfo.openId); let wxGetUserRes = await this.qryUserInfo(userInfo.openId);
let newUserInfo; let newUserInfo;
if (wxGetUserRes.data) { if (wxGetUserRes.data) {
newUserInfo = { newUserInfo = {
...wxGetUserRes.data, ...wxGetUserRes.data,
wxLoginCode: userInfo.wxLoginCode wxLoginCode: userInfo.wxLoginCode
} }
} }
console.log(newUserInfo) uni.setStorageSync('userProfile', newUserInfo);
uni.setStorageSync('userProfile', newUserInfo); }
} return res[1].data;
return res[1].data; },
}, async storagePhoneIntoUserInfo(code) {
async storagePhoneIntoUserInfo(code) { let phoneRes = await this.qryUserPhone(code);
let phoneRes = await this.qryUserPhone(code); if (phoneRes && phoneRes.msg === '获取手机号码异常') {
if (phoneRes && phoneRes.msg === '获取手机号码异常') { uni.showToast({
uni.showToast({ icon: 'none',
icon: 'none', title: '请先确认登录微信号是否已绑定手机号'
title: '请先确认登录微信号是否已绑定手机号' })
}) return false;
return false; }
} if (phoneRes && phoneRes.data) {
if (phoneRes && phoneRes.data) { let userInfo = this.getCurUserInfo();
let userInfo = this.getCurUserInfo(); await this.updateUser({
await this.updateUser({ customerId: userInfo.customerId,
customerId: userInfo.customerId, account: phoneRes.data,
account: phoneRes.data, phone: phoneRes.data
phone: phoneRes.data })
}) return true;
return true; }
}
}, },
wxLogin() { wxLogin() {
return wx.login(); return wx.login();
@ -219,19 +232,19 @@ export default {
getCurUserInfo() { getCurUserInfo() {
let userProfile = uni.getStorageSync('userProfile'); let userProfile = uni.getStorageSync('userProfile');
return userProfile; return userProfile;
}, },
async getCurUserNoCache() { async getCurUserNoCache() {
let userInfo = this.getCurUserInfo(); let userInfo = this.getCurUserInfo();
let wxGetUserRes = await this.qryUserInfo(userInfo.openId); let wxGetUserRes = await this.qryUserInfo(userInfo.openId);
if (!wxGetUserRes.data) { if (!wxGetUserRes.data) {
userInfo = null; userInfo = null;
} else { } else {
userInfo = { userInfo = {
...wxGetUserRes.data, ...wxGetUserRes.data,
wxLoginCode: userInfo.wxLoginCode wxLoginCode: userInfo.wxLoginCode
} }
} }
return userInfo; return userInfo;
}, },
getProductCategories(params = {}) { getProductCategories(params = {}) {
return uni.request({ return uni.request({
@ -256,200 +269,204 @@ export default {
url: '/order/server/app', url: '/order/server/app',
method: 'POST', method: 'POST',
data: params data: params
}) })
return res[1].data; return res[1].data;
}, },
async getWxPayParams(params = {}) { async getWxPayParams(params = {}) {
let res = await uni.request({ let res = await uni.request({
url: '/pay/wx/lite', url: '/pay/wx/lite',
method: 'POST', method: 'POST',
header: { header: {
code: params.code, code: params.code,
orderMasterCode: params.orderMasterCode orderMasterCode: params.orderMasterCode
} }
}) })
return res[1].data;
},
async getAddressList(params = {}) {
let res = await uni.request({
url: '/customer/address/list',
method: 'POST',
data: params
})
return res[1].data;
},
async addAddressList(params = {}) {
let res = await uni.request({
url: '/customer/address/insert',
method: 'POST',
data: params
})
return res[1].data;
},
async editAddressList(params = {}) {
let res = await uni.request({
url: '/customer/address/update',
method: 'POST',
data: params
})
return res[1].data;
},
async delAddressList(customerAddressId) {
let res = await uni.request({
url: '/customer/address/delete',
method: 'POST',
data: {
customerAddressId: customerAddressId
},
header: {
'content-type': 'application/x-www-form-urlencoded'
}
})
return res[1].data;
},
async areaListByStep(params = {
parentCode: null
}) {
let res = await uni.request({
url: '/system/area/app/list',
method: 'POST',
data: params
})
return res[1].data;
},
async listByStep(params = {
goodsCategoryId: null
}) {
let res = await uni.request({
url: '/goods/deptcategory/listByStep',
method: 'POST',
data: params
})
return res[1].data;
},
async uploadFile(filePath) {
let res = await uni.uploadFile({
url: this.address + '/tool/qiniu/upload',
filePath: filePath,
name: 'uploadFile'
})
let resStr = res[1].data;
let resObj = {};
if (resStr != null && resStr.length > 0) {
resObj = JSON.parse(resStr);
}
return resObj;
},
// async qryOrderGoodsPage(params = {}) {
// let res = await uni.request({
// url: '/order/goods/list',
// method: 'POST',
// data: params,
// header: {
// pageNum: params.pageNum,
// pageSize: params.pageSize
// }
// })
// return res[1].data;
// },
async bindBankCard(params) {
let res = await uni.request({
url: '/customer/bankcard/bind',
method: 'POST',
data: params
})
return res[1].data;
},
async getBindBankCardByCustomerId(params) {
let res = await uni.request({
url: '/customer/bankcard/getByCustomerId',
method: 'POST',
data: params
})
return res[1].data;
},
async getGoodsDetail(params) {
let res = await uni.request({
url: '/goods/goods/getDetail',
method: 'POST',
data: params
})
return res[1].data.data;
},
async qryFinancialCount(params = {}) {
let res = await uni.request({
url: '/financial/detail/count',
method: 'POST',
data: params
})
return res[1].data;
},
async qryFinancialDetail(params = {}) {
let res = await uni.request({
url: '/financial/detail/app/list',
method: 'POST',
data: params
})
return res[1].data;
},
async qryOrderPage(params = {}) {
let res = await uni.request({
url: '/order/master/app/list',
method: 'POST',
data: params,
header: {
pageNum: params.pageNum,
pageSize: params.pageSize
}
})
return res[1].data;
},
async updateOrder(params = {}) {
let res = await uni.request({
url: '/order/master/editOrderMaster',
method: 'POST',
data: params
})
return res[1].data;
},
async getHotGoods(params = {}) {
let res = await uni.request({
url: '/goods/goods/hot/list',
method: 'POST',
data: params,
header: {
pageNum: params.pageNum,
pageSize: params.pageSize
}
})
return res[1].data;
},
async getOrderMasterDetail(params = {}) {
let res = await uni.request({
url: '/order/master/app/detail',
method: 'POST',
data: params
})
return res[1].data;
},
async getWorkerList(params = {}) {
let res = await uni.request({
url: '/worker/app/list',
method: 'POST',
data: params
})
return res[1].data;
},
async getWorkerAllDetailById(params = {}) {
let res = await uni.request({
url: '/worker/getDetailById',
method: 'POST',
data: params
})
return res[1].data;
},
async getUnlimitedWxacode(params = {}) {
let res = await uni.request({
url: '/wx/unlimited/wxacode',
method: 'POST',
data: params
})
return res[1].data; return res[1].data;
},
async getAddressList(params = {}) {
let res = await uni.request({
url: '/customer/address/list',
method: 'POST',
data: params
})
return res[1].data;
},
async addAddressList(params = {}) {
let res = await uni.request({
url: '/customer/address/insert',
method: 'POST',
data: params
})
return res[1].data;
},
async editAddressList(params = {}) {
let res = await uni.request({
url: '/customer/address/update',
method: 'POST',
data: params
})
return res[1].data;
},
async delAddressList(customerAddressId) {
let res = await uni.request({
url: '/customer/address/delete',
method: 'POST',
data: {
customerAddressId: customerAddressId
},
header: {
'content-type': 'application/x-www-form-urlencoded'
}
})
return res[1].data;
},
async areaListByStep(params = { parentCode: null }) {
let res = await uni.request({
url: '/system/area/app/list',
method: 'POST',
data: params
})
return res[1].data;
},
async listByStep(params = {goodsCategoryId : null}) {
let res = await uni.request({
url: '/goods/deptcategory/listByStep',
method: 'POST',
data: params
})
return res[1].data;
},
async uploadFile(filePath) {
let res = await uni.uploadFile({
url: this.address + '/tool/qiniu/upload',
filePath: filePath,
name: 'uploadFile'
})
let resStr = res[1].data;
let resObj = {};
if (resStr != null && resStr.length > 0) {
resObj = JSON.parse(resStr);
}
return resObj;
},
// async qryOrderGoodsPage(params = {}) {
// let res = await uni.request({
// url: '/order/goods/list',
// method: 'POST',
// data: params,
// header: {
// pageNum: params.pageNum,
// pageSize: params.pageSize
// }
// })
// return res[1].data;
// },
async bindBankCard(params) {
let res = await uni.request({
url: '/customer/bankcard/bind',
method: 'POST',
data: params
})
return res[1].data;
},
async getBindBankCardByCustomerId(params) {
let res = await uni.request({
url: '/customer/bankcard/getByCustomerId',
method: 'POST',
data: params
})
return res[1].data;
},
async getGoodsDetail(params) {
let res = await uni.request({
url: '/goods/goods/getDetail',
method: 'POST',
data: params
})
return res[1].data.data;
},
async qryFinancialCount(params = {}) {
let res = await uni.request({
url: '/financial/detail/count',
method: 'POST',
data: params
})
return res[1].data;
},
async qryFinancialDetail(params = {}) {
let res = await uni.request({
url: '/financial/detail/app/list',
method: 'POST',
data: params
})
return res[1].data;
},
async qryOrderPage(params = {}) {
let res = await uni.request({
url: '/order/master/app/list',
method: 'POST',
data: params,
header: {
pageNum: params.pageNum,
pageSize: params.pageSize
}
})
return res[1].data;
},
async updateOrder(params = {}) {
let res = await uni.request({
url: '/order/master/editOrderMaster',
method: 'POST',
data: params
})
return res[1].data;
},
async getHotGoods(params = {}) {
let res = await uni.request({
url: '/goods/goods/hot/list',
method: 'POST',
data: params,
header: {
pageNum: params.pageNum,
pageSize: params.pageSize
}
})
return res[1].data;
},
async getOrderMasterDetail(params = {}) {
let res = await uni.request({
url: '/order/master/app/detail',
method: 'POST',
data: params
})
return res[1].data;
},
async getWorkerList(params = {}) {
let res = await uni.request({
url: '/worker/app/list',
method: 'POST',
data: params
})
return res[1].data;
},
async getWorkerAllDetailById(params = {}) {
let res = await uni.request({
url: '/worker/getDetailById',
method: 'POST',
data: params
})
return res[1].data;
},
async getUnlimitedWxacode(params = {}) {
let res = await uni.request({
url: '/wx/unlimited/wxacode',
method: 'POST',
data: params
})
return res[1].data;
} }
} }

View File

@ -0,0 +1,281 @@
<template>
<view class="uni-combox" :class="border ? '' : 'uni-combox__no-border'">
<view v-if="label" class="uni-combox__label" :style="labelStyle">
<text>{{label}}</text>
</view>
<view class="uni-combox__input-box">
<input class="uni-combox__input" type="text" :placeholder="placeholder" @click="toggleSelector" disabled
placeholder-class="uni-combox__input-plac" v-model="inputVal[showField]" @input="onInput" @focus="onFocus"
@blur="onBlur" />
<uni-icons :type="showSelector? 'top' : 'bottom'" size="14" color="#999" @click="toggleSelector">
</uni-icons>
</view>
<view class="uni-combox__selector" v-if="showSelector">
<view class="uni-popper__arrow"></view>
<scroll-view scroll-y="true" class="uni-combox__selector-scroll">
<view class="uni-combox__selector-empty" v-if="filterCandidatesLength === 0">
<text>{{emptyTips}}</text>
</view>
<view class="uni-combox__selector-item" v-for="(item,index) in filterCandidates" :key="index"
@click="onSelectorClick(index)">
<text>{{item[showField]}}</text>
</view>
</scroll-view>
</view>
</view>
</template>
<script>
/**
* Combox 组合输入框
* @description 组合输入框一般用于既可以输入也可以选择的场景
* @tutorial https://ext.dcloud.net.cn/plugin?id=1261
* @property {String} label 左侧文字
* @property {String} labelWidth 左侧内容宽度
* @property {String} placeholder 输入框占位符
* @property {Array} candidates 候选项列表
* @property {String} emptyTips 筛选结果为空时显示的文字
* @property {String} value 组合框的值
*/
export default {
name: 'myUniCombox',
emits: ['input', 'update:modelValue'],
props: {
border: {
type: Boolean,
default: true
},
label: {
type: String,
default: ''
},
labelWidth: {
type: String,
default: 'auto'
},
placeholder: {
type: String,
default: ''
},
candidates: {
type: Array,
default () {
return []
}
},
showField: {
type: String,
default: 'name'
},
emptyTips: {
type: String,
default: '无匹配项'
},
// #ifndef VUE3
value: {
type: [Object, String, Number],
default: ''
},
// #endif
// #ifdef VUE3
modelValue: {
type: [Object, String, Number],
default: ''
},
// #endif
},
data() {
return {
showSelector: false,
inputVal: ''
}
},
computed: {
labelStyle() {
if (this.labelWidth === 'auto') {
return ""
}
return `width: ${this.labelWidth}`
},
filterCandidates() {
return this.candidates
//
// .filter((item) => {
// return item.toString().indexOf(this.inputVal) > -1
// })
},
filterCandidatesLength() {
return this.filterCandidates.length
}
},
watch: {
// #ifndef VUE3
value: {
handler(newVal) {
this.inputVal = newVal
},
immediate: true
},
// #endif
// #ifdef VUE3
modelValue: {
handler(newVal) {
this.inputVal = newVal
},
immediate: true
},
// #endif
},
methods: {
toggleSelector() {
this.showSelector = !this.showSelector
},
onFocus() {
this.showSelector = true
},
onBlur() {
setTimeout(() => {
this.showSelector = false
}, 153)
},
onSelectorClick(index) {
this.inputVal = this.filterCandidates[index]
this.showSelector = false
this.$emit('input', this.inputVal)
this.$emit('update:modelValue', this.inputVal[this.showField])
},
onInput() {
setTimeout(() => {
this.$emit('input', this.inputVal)
this.$emit('update:modelValue', this.inputVal)
})
}
}
}
</script>
<style lang="scss" >
.uni-combox {
font-size: 14px;
border: 1px solid #DCDFE6;
border-radius: 4px;
padding: 6px 10px;
position: relative;
/* #ifndef APP-NVUE */
display: flex;
/* #endif */
// height: 40px;
flex-direction: row;
align-items: center;
// border-bottom: solid 1px #DDDDDD;
}
.uni-combox__label {
font-size: 16px;
line-height: 22px;
padding-right: 10px;
color: #999999;
}
.uni-combox__input-box {
position: relative;
/* #ifndef APP-NVUE */
display: flex;
/* #endif */
flex: 1;
flex-direction: row;
align-items: center;
}
.uni-combox__input {
flex: 1;
font-size: 28rpx;
height: 22px;
line-height: 22px;
}
.uni-combox__input-plac {
font-size: 28rpx;
// color: #999;
}
.uni-combox__selector {
/* #ifndef APP-NVUE */
box-sizing: border-box;
/* #endif */
position: absolute;
top: calc(100% + 12px);
left: 0;
width: 100%;
background-color: #FFFFFF;
border: 1px solid #EBEEF5;
border-radius: 6px;
box-shadow: 0 2px 12px 0 rgba(0, 0, 0, 0.1);
z-index: 3;
padding: 4px 0;
}
.uni-combox__selector-scroll {
/* #ifndef APP-NVUE */
max-height: 200px;
box-sizing: border-box;
/* #endif */
}
.uni-combox__selector-empty,
.uni-combox__selector-item {
/* #ifndef APP-NVUE */
display: flex;
cursor: pointer;
/* #endif */
line-height: 36px;
font-size: 28rpx;
text-align: center;
// border-bottom: solid 1px #DDDDDD;
padding: 0px 10px;
}
.uni-combox__selector-item:hover {
background-color: #f9f9f9;
}
.uni-combox__selector-empty:last-child,
.uni-combox__selector-item:last-child {
/* #ifndef APP-NVUE */
border-bottom: none;
/* #endif */
}
// picker
.uni-popper__arrow,
.uni-popper__arrow::after {
position: absolute;
display: block;
width: 0;
height: 0;
border-color: transparent;
border-style: solid;
border-width: 6px;
}
.uni-popper__arrow {
filter: drop-shadow(0 2px 12px rgba(0, 0, 0, 0.03));
top: -6px;
left: 10%;
margin-right: 3px;
border-top-width: 0;
border-bottom-color: #EBEEF5;
}
.uni-popper__arrow::after {
content: " ";
top: 1px;
margin-left: -6px;
border-top-width: 0;
border-bottom-color: #fff;
}
.uni-combox__no-border {
border: none;
}
</style>

View File

@ -56,6 +56,10 @@
"es6" : false "es6" : false
}, },
"usingComponents" : true, "usingComponents" : true,
"permission" : {} "permission" : {
"scope.userLocation" : {
"desc" : "因涉及上门家政服务,需获取地理位置"
}
}
} }
} }

View File

@ -47,6 +47,10 @@
"path": "serv-detail" "path": "serv-detail"
}, { }, {
"path": "statement-desc" "path": "statement-desc"
}, {
"path": "withdraw"
}, {
"path": "b-account-bind"
}] }]
}, { }, {
"root":"pages/publish/", "root":"pages/publish/",

View File

@ -104,6 +104,9 @@
} }
this.inParam = option; this.inParam = option;
this.loadData(option); this.loadData(option);
},
onShow() {
this.$request.authAndGetLocation();
}, },
onShareAppMessage(e) { onShareAppMessage(e) {
let shareInfo = null; let shareInfo = null;

View File

@ -213,10 +213,10 @@
<view class="cuIcon-qr_code text-green"></view> <view class="cuIcon-qr_code text-green"></view>
<text>二维码分享</text> <text>二维码分享</text>
</view> </view>
<!-- <view class="cu-item"> <view class="cu-item" v-if="curUserInfo.placeStatus == 2" @click="showPage('/pages/my/withdraw')">
<view class="cuIcon-moneybagfill text-cyan"></view> <view class="cuIcon-moneybagfill text-cyan"></view>
<text>钱包</text> <text>钱包</text>
</view> --> </view>
<!-- <view class="cu-item"> <!-- <view class="cu-item">
<view class="cuIcon-friendaddfill text-blue"></view> <view class="cuIcon-friendaddfill text-blue"></view>
<text>加盟项目</text> <text>加盟项目</text>
@ -372,11 +372,41 @@
}) })
}, },
async showAppInviteQrcode() { async showAppInviteQrcode() {
let res = await this.$request.getUnlimitedWxacode({ //
scene: "distributor=" + this.curUserInfo.customerId if (this.curUserInfo.placeStatus == 1) {
}); uni.showToast({
this.appQrcode = res.data; icon: 'none',
this.appShareQrcodeModal = true; title: '审核中'
})
} else if (this.curUserInfo.placeStatus != 2) {
await this.$request.updateUser({
customerId: this.curUserInfo.customerId,
placeStatus: 1
});
this.curUserInfo = this.$request.getCurUserInfo();
uni.showToast({
icon: 'none',
title: '已提交进行分销审核'
})
} else {
//
let res = await this.$request.getBindBankCardByCustomerId({
customerId: this.curUserInfo.customerId
});
let bindBankCardInfo = res.data;
if (bindBankCardInfo && bindBankCardInfo.bankNum) {
//
let res = await this.$request.getUnlimitedWxacode({
scene: "distributor=" + this.curUserInfo.customerId
});
this.appQrcode = res.data;
this.appShareQrcodeModal = true;
} else {
uni.navigateTo({
url: '/pages/my/withdraw'
})
}
}
}, },
showPage(pageUrl) { showPage(pageUrl) {
if (pageUrl) { if (pageUrl) {

View File

@ -6,12 +6,12 @@
<block slot="content">帐号绑定/修改</block> <block slot="content">帐号绑定/修改</block>
</cu-custom> </cu-custom>
<view class="margin-lr-sm margin-tb-lg shadow-warp"> <view class="margin-lr-sm margin-tb-lg shadow-warp">
<!-- <view class="bg-gray flex justify-start align-center text-xl padding-lr padding-top-xs"> <view class="bg-gray flex justify-start align-center text-xl padding-lr padding-top-xs">
<view class="padding-lr padding-tb-sm" :class="curAccountType === '0' ? 'curTab' : ''" data-type="0" @click="changAccountType">支付宝</view> <view class="padding-lr padding-tb-sm" :class="curAccountType === '0' ? 'curTab' : ''" data-type="0" @click="changAccountType">支付宝</view>
<view class="padding-lr padding-tb-sm" :class="curAccountType === '1' ? 'curTab' : ''" data-type="1" @click="changAccountType">银行卡</view> <view class="padding-lr padding-tb-sm" :class="curAccountType === '1' ? 'curTab' : ''" data-type="1" @click="changAccountType">银行卡</view>
</view> --> </view>
<!-- 支付宝 --> <!-- 支付宝 -->
<!-- <view v-if="curAccountType == '0'" class="bg-white padding text-lg"> <view v-if="curAccountType == '0'" class="bg-white padding text-lg">
<view> <view>
<view class="margin-bottom-sm">开户人姓名</view> <view class="margin-bottom-sm">开户人姓名</view>
<input type="digit" placeholder="请输入开户人姓名" placeholder-style="color:#989898" v-model="formData.name"> <input type="digit" placeholder="请输入开户人姓名" placeholder-style="color:#989898" v-model="formData.name">
@ -20,9 +20,9 @@
<view class="margin-bottom-sm">支付宝账户</view> <view class="margin-bottom-sm">支付宝账户</view>
<input type="digit" placeholder="请输入支付宝账户" placeholder-style="color:#989898" v-model="formData.account"> <input type="digit" placeholder="请输入支付宝账户" placeholder-style="color:#989898" v-model="formData.account">
</view> </view>
</view> --> </view>
<!-- 银行卡 --> <!-- 银行卡 -->
<!-- <view v-else-if="curAccountType === '1'" class="bg-white padding text-lg"> <view v-else-if="curAccountType === '1'" class="bg-white padding text-lg">
<view> <view>
<view class="margin-bottom-sm">开户人姓名</view> <view class="margin-bottom-sm">开户人姓名</view>
<input type="text" placeholder="请输入开户人姓名" placeholder-style="color:#989898" v-model="formData.name"> <input type="text" placeholder="请输入开户人姓名" placeholder-style="color:#989898" v-model="formData.name">
@ -39,22 +39,32 @@
<view class="margin-bottom-sm">银行卡号</view> <view class="margin-bottom-sm">银行卡号</view>
<input type="text" placeholder="请输入银行卡号" placeholder-style="color:#989898" v-model="formData.bankNum"> <input type="text" placeholder="请输入银行卡号" placeholder-style="color:#989898" v-model="formData.bankNum">
</view> </view>
</view> --> <!-- <view class="margin-top">
<view class="margin-bottom-sm">银行卡号开户城市</view>
<view class="flex">
<my-uni-combox class="flex-sub margin-right-xs" :candidates="provinceList"
:showField="'areaName'" placeholder="选择省份" v-model="formData.provinceObj"
@input="chooseRegion($event)"></my-uni-combox>
<my-uni-combox class="flex-sub margin-right-xs" :candidates="cityList"
:showField="'areaName'" placeholder="选择城市" v-model="formData.cityObj"></my-uni-combox>
</view>
</view> -->
</view>
</view> </view>
<!-- 操作按钮 --> <!-- 操作按钮 -->
<!-- <view class="margin-lr"> <view class="margin-lr">
<button class="cu-btn lg bg-main-color long-btn shadow-blur" @click="submit">提交</button> <button class="cu-btn lg bg-main-color long-btn shadow-blur" @click="submit">提交</button>
</view> --> </view>
</view> </view>
</template> </template>
<script> <script>
// import myUniCombox from '@/components/uni-combox/my-uni-combox.vue'; import myUniCombox from '@/components/uni-combox/my-uni-combox.vue';
export default { export default {
// components: { components: {
// myUniCombox myUniCombox
// }, },
data() { data() {
return { return {
curAccountType: '0', curAccountType: '0',
@ -67,7 +77,7 @@
curUserInfo: {} curUserInfo: {}
} }
}, },
onLoad() { onLoad(options) {
this.loadData(); this.loadData();
}, },
methods: { methods: {

151
pages/my/withdraw.vue Normal file
View File

@ -0,0 +1,151 @@
<template>
<view>
<!-- 顶部操作条 -->
<cu-custom :bgColor="'bg-main-color'" :isBack="true">
<block slot="backText">返回</block>
<block slot="content">提现账户</block>
</cu-custom>
<!-- <view class="margin-lr-sm margin-tb-lg shadow-warp">
<view @click="bindAccount">
<view v-if="bindBankCard && bindBankCard.bankNum" class="bg-gray flex justify-between align-center text-xl padding">
<view>
<text class="cu-tag bg-main-color light margin-right-sm">已绑定</text>
<text>{{bindBankCard.encodeBankNum}}</text>
</view>
<view>帐号另绑<text class="cuIcon-right"></text></view>
</view>
<view v-else class="bg-gray flex justify-between align-center text-xl padding">
<view>提现帐号绑定</view>
<view><text class="cuIcon-right"></text></view>
</view>
</view>
<view class="bg-white padding solid-bottom">
<view class="text-right text-lg">
<text>可提现金额:</text>
<text class="text-red text-price">{{balance}}</text>
</view>
<view class="text-lg margin-bottom-sm">提现金额</view>
<view class="text-xxl solid-bottom flex justify-start align-baseline">
<text class="margin-right-xs text-bold"></text>
<input type="digit" placeholder="请输入金额" placeholder-style="color:#989898" style="height: 80rpx;">
</view>
</view>
<view class="bg-white padding">
<view class="text-lg margin-bottom-sm">发票凭证电子票</view>
<view class="grid col-3 grid-square flex-sub">
<view class="bg-img" v-for="(item,index) in imgList" :key="index"
@tap="viewImage($event)" :data-url="item">
<image :src="item" mode="aspectFill"></image>
<view class="cu-tag bg-red" @tap.stop="delImg($event)" :data-index="index">
<text class='cuIcon-close'></text>
</view>
</view>
<view class="solids" @tap="chooseImage" v-if="imgList.length < 9">
<text class='cuIcon-cameraadd'></text>
</view>
</view>
</view>
</view> -->
<view class="margin-sm shadow-warp">
<view class="padding-tb-lg padding-lr bg-gradual-color light" v-if="bindBankCard && bindBankCard.bankNum">
<view>提现账户</view>
<view class="flex justify-between margin-top-sm">
<!-- <text class="cu-tag bg-white radius margin-right-sm">已绑定</text> -->
<text class="text-xxl">{{bindBankCard.encodeBankNum}}</text>
<view class="cu-btn bg-white radius" @click="bindAccount">帐号另绑</view>
</view>
</view>
<view class="padding-tb-lg padding-lr bg-gradual-color light" v-else>
<view class="padding-bottom">提现帐号未绑定</view>
<view class="cu-btn bg-white radius" @click="bindAccount">前往绑定</view>
</view>
<view class="padding bg-white flex justify-between">
</view>
</view>
<!-- 操作按钮 -->
<!-- <view class="margin-lr">
<button class="cu-btn lg bg-main-color long-btn shadow-blur" @click="withdraw">提现</button>
</view> -->
</view>
</template>
<script>
export default {
data() {
return {
balance: '0.00',
imgList: [],
curUserInfo: {},
bindBankCard: null
}
},
onLoad() {
this.loadData();
},
onShow() {
this.reloadData();
},
methods: {
async loadData() {
this.curUserInfo = this.$request.getCurUserInfo();
this.loadBindBankCard();
},
async reloadData() {
this.loadBindBankCard();
},
async loadBindBankCard() {
let res = await this.$request.getBindBankCardByCustomerId({
customerId: this.curUserInfo.customerId
});
this.bindBankCard = res.data;
if (this.bindBankCard && this.bindBankCard.bankNum) {
this.bindBankCard.encodeBankNum = '****' + this.bindBankCard.bankNum.substring(this.bindBankCard.bankNum.length - 4);
}
},
bindAccount() {
uni.navigateTo({
url: '/pages/my/b-account-bind'
})
},
chooseImage(e) {
uni.chooseImage({
count: 9, //9
sizeType: ['original', 'compressed'], //
sourceType: ['album'], //
success: (res) => {
if (this.imgList.length != 0) {
this.imgList = this.imgList.concat(res.tempFilePaths)
} else {
this.imgList = res.tempFilePaths
}
}
});
},
viewImage(e) {
uni.previewImage({
urls: this.imgList,
current: e.currentTarget.dataset.url
});
},
delImg(e) {
uni.showModal({
title: '',
content: '确定要删除这张图片吗?',
cancelText: '取消',
confirmText: '确定',
success: res => {
if (res.confirm) {
this.imgList.splice(e.currentTarget.dataset.index, 1)
}
}
})
},
withdraw() {
}
},
}
</script>
<style>
</style>