diff --git a/api/business/member.js b/api/business/member.js index 746157f..3501a95 100644 --- a/api/business/member.js +++ b/api/business/member.js @@ -11,6 +11,14 @@ export function bloggerDetail(userId) { } +//------------------开通会员----------------------- +export function saveOrder(data) { + return request({ + url: '/member/order/uniSaveOrder', + method: 'post', + data: data + }) +} //------------------名片----------------------- // 查询当前登录用户的名片 export function getUserBusiCard() { diff --git a/config.js b/config.js index 5f07de0..f5f68c1 100644 --- a/config.js +++ b/config.js @@ -1,6 +1,6 @@ // 应用全局配置 module.exports = { - baseUrl: 'http://192.168.1.17:8080', + baseUrl: 'http://192.168.1.4:8080', // baseUrl: 'http://localhost:8080', // 应用信息 appInfo: { diff --git a/pages/mine/card/card-detail.vue b/pages/mine/card/card-detail.vue index cdf9f1a..2218f3c 100644 --- a/pages/mine/card/card-detail.vue +++ b/pages/mine/card/card-detail.vue @@ -108,11 +108,14 @@ }, data() { return { + uploadUrl: config.baseUrl+'/common/upload', + headers: {}, //所有可选的平台 range: [], sizeType: ['compressed'], //图片数组 fileList: [], + imageUrl:[], //地址集合 addressList: [], //名片数据对象 @@ -141,12 +144,23 @@ /**初始化数据*/ initData(id) { + this.fileList = [] + this.imageUrl = [] if (id) { getBusiCardById({ id: id }).then(res => { console.log(res.data, 133) this.dataObj = res.data + if (this.dataObj.image != null && this.dataObj.image != ''){ + console.log(this.dataObj.image,'this.dataObj.image') + this.imageUrl = this.dataObj.image.split(',') + this.imageUrl.map((item)=>{ + this.fileList.push({ + url:config.baseUrl + item + }) + }) + } }).catch((e) => { uni.showToast({ icon: 'error', @@ -230,7 +244,11 @@ toast("收货地址不能为空") return } - // console.log(this.fileList,'fileList') + if (this.fileList.length == 0) { + toast("证明材料不能为空") + return + } + this.dataObj.image = this.imageUrl.join(','); applyBusiCard(this.dataObj).then(res => { if (res.code == 200) { uni.showToast({ @@ -250,24 +268,29 @@ }, 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 + url: res.url }) - console.log(this.fileList, 'fileList') + this.imageUrl.push(res.fileName) }) } }, deleteFile(file, index) { console.log('删除文件'); this.fileList.splice(index, 1); + this.imageUrl.splice(index, 1); }, + uploadSuccess(res, file) { + console.log('上传成功', res); + }, + uploadFail(error, file) { + console.log('上传失败', error); + }, } } diff --git a/pages/mine/card/my-card.vue b/pages/mine/card/my-card.vue index 91a793a..970f3ad 100644 --- a/pages/mine/card/my-card.vue +++ b/pages/mine/card/my-card.vue @@ -55,123 +55,6 @@ - - - - - - - - - - {{item.platformName}}博主 - - 已审核 - 审核中 - 未通过 - - - - - - {{ item.accountName }} - - - - 粉丝:{{ formatNumberWithUnits(item.fansNum) }} - - - - - - - - 删除 - - 编辑 - - - - - - - - - - - - - {{item.platformName}}博主 - - 已审核 - 审核中 - 未通过 - - - - - - {{ item.accountName }} - - - - 粉丝:{{ formatNumberWithUnits(item.fansNum) }} - - - - - - - - 删除 - - 编辑 - - - - - - - - - - - - - {{item.platformName}}博主 - - 已审核 - 审核中 - 未通过 - - - - - - {{ item.accountName }} - - - - 粉丝:{{ formatNumberWithUnits(item.fansNum) }} - - - - - - - - 删除 - - 编辑 - - - diff --git a/pages/mine/member/member-card.vue b/pages/mine/member/member-card.vue index 9ab6f0e..ee0032e 100644 --- a/pages/mine/member/member-card.vue +++ b/pages/mine/member/member-card.vue @@ -28,7 +28,7 @@ - 立即开通 + 立即开通 开通即代表您已阅读并同意 import navigationBarVue from '@/components/navigation/navigationBar.vue'; - import { - baseCardList, - rightList - } from '@/api/business/base.js' - + import {baseCardList, rightList} from '@/api/business/base.js' + import {saveOrder} from '@/api/business/member.js' export default { components: { navigationBarVue @@ -162,19 +159,21 @@ }] } }, - onShow(){ - this.initData() + + onLoad(options){ + this.initData(options.userType); }, methods: { /**初始化*/ - initData(){ - this.getCardList(); - this.getRightsList(); + initData(userType){ + this.userType = userType + this.getCardList(userType); + this.getRightsList(userType); }, /**获取会员卡列表*/ - getCardList(){ - baseCardList({userType:this.userType}).then(res => { + getCardList(userType){ + baseCardList({userType:userType}).then(res => { this.memberCardList = res.data }).catch((e) => { uni.showToast({ @@ -185,8 +184,8 @@ }) }, /**权益列表*/ - getRightsList(){ - rightList({userType:this.userType}).then(res => { + getRightsList(userType){ + rightList({userType:userType}).then(res => { this.cardList = res.data.cardList this.rightsList = res.data.rightsList console.log(this.cardList,'cardList') @@ -221,6 +220,41 @@ handleUserAgrement(site) { this.$tab.navigateTo(`/pages/common/richview/index?title=${site.title}&code=${site.code}`) }, + /**生成订单*/ + toOrder(){ + let data = { + userType:this.userType, + orderType:'01', + goodsId:this.memberCardList[this.chooseCardIndex].id, + goodsNum:1, + goodsPrice:this.memberCardList[this.chooseCardIndex].priceList[this.choosePriceIndex].price, + } + if (this.memberCardList[this.chooseCardIndex].priceList[this.choosePriceIndex].title === '年付会员') { + data.goodsCycle = '03' + } + if (this.memberCardList[this.chooseCardIndex].priceList[this.choosePriceIndex].title === '季付会员') { + data.goodsCycle = '02' + } + if (this.memberCardList[this.chooseCardIndex].priceList[this.choosePriceIndex].title === '月付会员') { + data.goodsCycle = '01' + } + saveOrder(data).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 + }); + }) + }, } } diff --git a/pages/mine/mine-index.vue b/pages/mine/mine-index.vue index 52487d9..e47961f 100644 --- a/pages/mine/mine-index.vue +++ b/pages/mine/mine-index.vue @@ -281,7 +281,7 @@ this.$tab.navigateTo('/pages/mine/auth/auth-choose') }, goMemberCard() { - this.$tab.navigateTo('/pages/mine/member/member-card') + this.$tab.navigateTo('/pages/mine/member/member-card?userType='+this.localUserType) }, /** * 跳转编辑页 diff --git a/utils/upload.js b/utils/upload.js index 740387e..856aa8e 100644 --- a/utils/upload.js +++ b/utils/upload.js @@ -23,7 +23,7 @@ const upload = config => { return new Promise((resolve, reject) => { uni.uploadFile({ timeout: config.timeout || timeout, - url: baseUrl + config.url, + url: baseUrl + '/common/upload' + config.url, filePath: config.filePath, name: config.name || 'file', header: config.header,