1
This commit is contained in:
parent
91548ea26f
commit
6e5ffe0310
@ -1,6 +1,7 @@
|
||||
import upload from '@/utils/upload'
|
||||
import request from '@/utils/request'
|
||||
|
||||
//------------------名片-----------------------
|
||||
// 查询当前登录用户的名片
|
||||
export function getUserBusiCard() {
|
||||
return request({
|
||||
@ -8,6 +9,32 @@ export function getUserBusiCard() {
|
||||
method: 'get',
|
||||
})
|
||||
}
|
||||
// 获取博主名片详情
|
||||
export function getBusiCardById(params) {
|
||||
return request({
|
||||
url: '/member/busiCard/getBusiCardById',
|
||||
method: 'get',
|
||||
params:params
|
||||
})
|
||||
}
|
||||
//提交博主名片审核申请
|
||||
export function applyBusiCard(data) {
|
||||
return request({
|
||||
url: '/member/busiCard/toApply',
|
||||
method: 'post',
|
||||
data: data
|
||||
})
|
||||
}
|
||||
//删除名片信息
|
||||
export function removeBusiCard(params) {
|
||||
return request({
|
||||
url: '/member/busiCard/remove',
|
||||
method: 'delete',
|
||||
params:params
|
||||
})
|
||||
}
|
||||
|
||||
//------------------地址-----------------------
|
||||
// 查询当前登录用户的收货地址
|
||||
export function getUserAddress() {
|
||||
return request({
|
||||
@ -15,7 +42,13 @@ export function getUserAddress() {
|
||||
method: 'get',
|
||||
})
|
||||
}
|
||||
|
||||
// 博主地址选择器
|
||||
export function uniSelectList() {
|
||||
return request({
|
||||
url: '/member/address/uniSelectList',
|
||||
method: 'get',
|
||||
})
|
||||
}
|
||||
//保存地址信息
|
||||
export function saveAddress(data) {
|
||||
return request({
|
||||
@ -24,7 +57,6 @@ export function saveAddress(data) {
|
||||
data: data
|
||||
})
|
||||
}
|
||||
|
||||
// 设置默认收货地址
|
||||
export function setDefault(params) {
|
||||
return request({
|
||||
@ -33,7 +65,6 @@ export function setDefault(params) {
|
||||
params: params
|
||||
})
|
||||
}
|
||||
|
||||
// 删除地址
|
||||
export function removeAddress(params) {
|
||||
return request({
|
||||
@ -42,7 +73,6 @@ export function removeAddress(params) {
|
||||
params:params
|
||||
})
|
||||
}
|
||||
|
||||
// 获取地址详细信息
|
||||
export function getById(params) {
|
||||
return request({
|
||||
|
@ -18,3 +18,11 @@ export function getCatgByCode(params) {
|
||||
params:params
|
||||
})
|
||||
}
|
||||
// 根据code查分类值列表
|
||||
export function uniListByParentCode(params) {
|
||||
return request({
|
||||
url: '/base/category/uniListByParentCode',
|
||||
method: 'get',
|
||||
params:params
|
||||
})
|
||||
}
|
||||
|
@ -12,6 +12,22 @@
|
||||
:imgCode="dataObj.platformCode"></uni-data-select>
|
||||
</view>
|
||||
</view>
|
||||
<view class="item-field">
|
||||
<view class="item-lable is-required">
|
||||
<image src="@/static/mine/required.png" mode="aspectFit"></image>平台账号
|
||||
</view>
|
||||
<view class="item-value">
|
||||
<input class="uni-input" v-model="dataObj.accountNumber" type="text" placeholder="请输入" />
|
||||
</view>
|
||||
</view>
|
||||
<view class="item-field">
|
||||
<view class="item-lable is-required">
|
||||
<image src="@/static/mine/required.png" mode="aspectFit"></image>平台昵称
|
||||
</view>
|
||||
<view class="item-value">
|
||||
<input class="uni-input" v-model="dataObj.accountName" type="text" placeholder="请输入" />
|
||||
</view>
|
||||
</view>
|
||||
<view class="item-field">
|
||||
<view class="item-lable is-required">
|
||||
<image src="@/static/mine/required.png" mode="aspectFit"></image>粉丝数
|
||||
@ -33,7 +49,9 @@
|
||||
<image src="@/static/mine/required.png" mode="aspectFit"></image>收货地址
|
||||
</view>
|
||||
<view class="item-value">
|
||||
<view class="choose-add" @click="chooseAddr()">请选择收货地址</view>
|
||||
<uni-data-select v-model="dataObj.addrId" :localdata="addressList"
|
||||
@change="change($event,'addrId')" :clear="false"
|
||||
:imgCode="dataObj.addrId"></uni-data-select>
|
||||
</view>
|
||||
</view>
|
||||
<view class="item-field">
|
||||
@ -62,7 +80,7 @@
|
||||
</view>
|
||||
</view>
|
||||
<view class="item-field" style="align-items: center;">
|
||||
<view class="submit-box">提交</view>
|
||||
<view class="submit-box" @click="submitForm">提交</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
@ -70,49 +88,162 @@
|
||||
|
||||
<script>
|
||||
import config from '@/config'
|
||||
import upload from '@/utils/upload'
|
||||
import {toast} from '@/utils/common.js'
|
||||
import { getBusiCardById, applyBusiCard, uniSelectList} from '@/api/business/member.js'
|
||||
import { uniListByParentCode} from '@/api/system/config.js'
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
//所有可选的平台
|
||||
range: [{
|
||||
value: 'xiaohongshu',
|
||||
text: "小红书"
|
||||
},
|
||||
{
|
||||
value: 'douyin',
|
||||
text: "抖音"
|
||||
}
|
||||
],
|
||||
range: [],
|
||||
sizeType: ['compressed'],
|
||||
//图片数组
|
||||
fileList: [],
|
||||
//地址集合
|
||||
addressList:[],
|
||||
//名片数据对象
|
||||
dataObj: {
|
||||
platformCode: "xiaohongshu",
|
||||
accountName:null,
|
||||
accountNumber:null,
|
||||
fansNum: null,
|
||||
tel: null
|
||||
tel: null,
|
||||
addrId:null,
|
||||
price:null,
|
||||
content:null,
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
onLoad(options){
|
||||
this.initData(options.id)
|
||||
},
|
||||
onShow(){
|
||||
this.initAddress()
|
||||
this.initPlatForm()
|
||||
},
|
||||
|
||||
methods: {
|
||||
|
||||
/**初始化数据*/
|
||||
initData(id){
|
||||
if (id){
|
||||
getBusiCardById({id:id}).then(res => {
|
||||
console.log(res.data,133)
|
||||
this.dataObj = res.data
|
||||
}).catch((e) => {
|
||||
uni.showToast({
|
||||
icon: 'error',
|
||||
duration: 2000,
|
||||
title: e
|
||||
});
|
||||
})
|
||||
} else {
|
||||
this.dataObj = {
|
||||
platformCode: "xiaohongshu",
|
||||
accountName:null,
|
||||
accountNumber:null,
|
||||
fansNum: null,
|
||||
tel: null,
|
||||
addrId:null,
|
||||
price:null,
|
||||
content:null,
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
/**初始化分类*/
|
||||
initPlatForm(){
|
||||
uniListByParentCode({code:"dl_platform"}).then(res=>{
|
||||
this.range = res.data
|
||||
}).catch((e) => {
|
||||
uni.showToast({
|
||||
icon: 'error',
|
||||
duration: 2000,
|
||||
title: e
|
||||
});
|
||||
})
|
||||
},
|
||||
|
||||
/**查询当前登录用户的地址*/
|
||||
initAddress(){
|
||||
uniSelectList().then(res => {
|
||||
this.addressList = res.data
|
||||
}).catch((e) => {
|
||||
uni.showToast({
|
||||
icon: 'error',
|
||||
duration: 2000,
|
||||
title: e
|
||||
});
|
||||
})
|
||||
},
|
||||
|
||||
//改变选中值
|
||||
change(e, type) {},
|
||||
/**
|
||||
* 选择收货地址
|
||||
*/
|
||||
|
||||
/**选择收货地址*/
|
||||
chooseAddr() {
|
||||
|
||||
},
|
||||
|
||||
/**提交*/
|
||||
submitForm(){
|
||||
if (this.dataObj.platformCode == null || this.dataObj.platformCode == ""){
|
||||
toast("平台不能为空")
|
||||
return
|
||||
}
|
||||
if (this.dataObj.accountNumber == null || this.dataObj.accountNumber == ""){
|
||||
toast("平台账号不能为空")
|
||||
return
|
||||
}
|
||||
if (this.dataObj.accountName == null || this.dataObj.accountName == ""){
|
||||
toast("平台昵称不能为空")
|
||||
return
|
||||
}
|
||||
if (this.dataObj.fansNum == null || this.dataObj.fansNum == ""){
|
||||
toast("粉丝数不能为空")
|
||||
return
|
||||
}
|
||||
if (this.dataObj.tel == null || this.dataObj.tel == ""){
|
||||
toast("电话不能为空")
|
||||
return
|
||||
}
|
||||
if (this.dataObj.addrId == null || this.dataObj.addrId == ""){
|
||||
toast("收货地址不能为空")
|
||||
return
|
||||
}
|
||||
// console.log(this.fileList,'fileList')
|
||||
applyBusiCard(this.dataObj).then(res => {
|
||||
if (res.code == 200) {
|
||||
uni.showToast({
|
||||
icon: 'success',
|
||||
duration: 2000,
|
||||
title: '保存成功'
|
||||
});
|
||||
uni.navigateBack()
|
||||
}
|
||||
}).catch((e) => {
|
||||
uni.showToast({
|
||||
icon: 'error',
|
||||
duration: 2000,
|
||||
title: e
|
||||
});
|
||||
})
|
||||
},
|
||||
|
||||
afterRead(file) {
|
||||
|
||||
for (let i = 0; i < file.tempFilePaths.length; i++) {
|
||||
upload({
|
||||
url: '',
|
||||
filePath: file.tempFilePaths[i]
|
||||
}).then((res) => {
|
||||
console.log(res,'215')
|
||||
this.fileList.push({
|
||||
url: config.baseUrl + res.data
|
||||
})
|
||||
console.log(this.fileList)
|
||||
console.log(this.fileList,'fileList')
|
||||
})
|
||||
}
|
||||
},
|
||||
|
@ -31,21 +31,21 @@
|
||||
<view class="card-content">
|
||||
<view class="card-person-info">
|
||||
<view class="card-name">
|
||||
<view>{{ item.nickname }}</view>
|
||||
<view>{{ item.accountName }}</view>
|
||||
</view>
|
||||
<view class="detail-text">
|
||||
<view class="fans-dom">
|
||||
粉丝:{{ formatNumberWithUnits(item.fansNum) }}
|
||||
</view>
|
||||
<view class="nickname-dom">
|
||||
昵称:{{ item.accountName }}
|
||||
<!-- <view class="nickname-dom">-->
|
||||
<!-- 昵称:{{ item.accountName }}-->
|
||||
<!-- </view>-->
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<view v-if="ifEdit" @click="remove(item.id)" :class="['edit-dom',item.choosed.length>0?'':'no-choose']">删除
|
||||
</view>
|
||||
<view v-if="ifEdit" @click="del(item)" :class="['edit-dom',item.choosed.length>0?'':'no-choose']">删除
|
||||
</view>
|
||||
<view v-else :class="['edit-dom',item.choosed.length>0?'':'no-choose']" @click="edit(item)">编辑
|
||||
<view v-else :class="['edit-dom',item.choosed.length>0?'':'no-choose']" @click="edit(item.id)">编辑
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
@ -67,7 +67,7 @@
|
||||
formatNumberWithUnits
|
||||
} from '@/utils/common.js'
|
||||
import {
|
||||
getUserBusiCard
|
||||
getUserBusiCard,removeBusiCard
|
||||
} from '@/api/business/member.js'
|
||||
export default {
|
||||
data() {
|
||||
@ -92,7 +92,7 @@
|
||||
return this.busiCardList.filter((item) => item.choosed.length > 0).length
|
||||
}
|
||||
},
|
||||
onLoad() {
|
||||
onShow() {
|
||||
this.initData();
|
||||
},
|
||||
methods: {
|
||||
@ -105,6 +105,7 @@
|
||||
},
|
||||
//查询名片列表
|
||||
initData() {
|
||||
this.busiCardList = []
|
||||
getUserBusiCard().then(res => {
|
||||
if (res.data.length > 0) {
|
||||
res.data.map((item) => {
|
||||
@ -120,6 +121,24 @@
|
||||
});
|
||||
})
|
||||
},
|
||||
/**删除名片*/
|
||||
remove(id) {
|
||||
removeBusiCard({id:id}).then(res => {
|
||||
uni.showToast({
|
||||
icon: 'success',
|
||||
duration: 2000,
|
||||
title: '删除成功'
|
||||
});
|
||||
this.ifEdit = false
|
||||
this.initData()
|
||||
}).catch((e) => {
|
||||
uni.showToast({
|
||||
icon: 'error',
|
||||
duration: 2000,
|
||||
title: e
|
||||
});
|
||||
})
|
||||
},
|
||||
/**
|
||||
* 全选
|
||||
* @param {Object} e
|
||||
@ -145,8 +164,8 @@
|
||||
*/
|
||||
del(item) {},
|
||||
//名片编辑
|
||||
edit(item) {
|
||||
this.$tab.navigateTo('/pages/mine/card/card-detail')
|
||||
edit(id) {
|
||||
this.$tab.navigateTo('/pages/mine/card/card-detail?id='+id)
|
||||
},
|
||||
addCard() {
|
||||
this.$tab.navigateTo('/pages/mine/card/card-detail')
|
||||
|
Loading…
Reference in New Issue
Block a user