From 89de2bbaf2e81ab3fa7a8c2aad3b76bc81033d3d Mon Sep 17 00:00:00 2001 From: xuxueyang <xuxy@fengyuntec.com> Date: 星期二, 23 七月 2024 18:44:27 +0800 Subject: [PATCH] update 订单功能(花店端) --- pages/login/supplier-login.vue | 14 pages/home/components/home-price.vue | 91 sub_pages/customer/shopping/shopping.vue | 361 +++++ sub_pages/supplier/flower-manage/flower-add.vue | 4 sub_pages/customer/self/follow.vue | 29 sub_pages/customer/self/collect.vue | 150 ++ pages.json | 483 ++++--- mixin/mixin.js | 928 +++++++------- pages/login/supplier-reg.vue | 4 sub_pages/customer/shopping/confirm.vue | 103 + store/index.js | 791 ++++++------ sub_pages/customer/trade/detail.vue | 607 +++++---- 12 files changed, 2,121 insertions(+), 1,444 deletions(-) diff --git a/mixin/mixin.js b/mixin/mixin.js index a2ac9ad..f197668 100644 --- a/mixin/mixin.js +++ b/mixin/mixin.js @@ -1,496 +1,506 @@ import { - mapState + mapState } from 'vuex' import store from "../store"; import environments from '@/environments' const mixinsCommon = { - computed: { - ...mapState({ - hasLogin: state => { - // console.log('computed hasLogin',state.hasLogin,state) - return state.hasLogin || false - }, - selftype: state => { - return (state.currentInfo || {}).type || '' - }, - currentInfo: state => { - return state.currentInfo || {} - }, - cache_address: state => { - return state.cache_address || {} - }, - cache_user: state => { - return state.currentInfo || {} - }, - sign: state => { - return state.sign || {} - }, - // currentEnId: state=>{ - // // console.log('currentEnId',state.currentInfo.enId,state.currentInfo) - // return state.currentInfo.enId || '' - // } - }), - }, - data() { - return { - list: [], - query: {}, - page: { - size: 10, - current: 1, - total: 0, - }, - style: { - 'color': '#fff' - }, - listApi: '', - regUserName: '用户-' + this.getRandomName(Math.floor(Math.random() * (6 - 2) + 3)), - regAvatarUrl: 'https://youzhen123.oss-cn-huhehaote.aliyuncs.com/WechatOwnerProperty/images/mrtx.png', + computed: { + ...mapState({ + hasLogin: state => { + // console.log('computed hasLogin',state.hasLogin,state) + return state.hasLogin || false + }, + selftype: state => { + return (state.currentInfo || {}).type || '' + }, + currentInfo: state => { + return state.currentInfo || {} + }, + cache_address: state => { + return state.cache_address || {} + }, + cache_user: state => { + return state.currentInfo || {} + }, + sign: state => { + return state.sign || {} + }, + // currentEnId: state=>{ + // // console.log('currentEnId',state.currentInfo.enId,state.currentInfo) + // return state.currentInfo.enId || '' + // } + }), + }, + data() { + return { + list: [], + query: {}, + page: { + size: 10, + current: 1, + total: 0, + }, + style: { + 'color': '#fff' + }, + listApi: '', + regUserName: '用户-' + this.getRandomName(Math.floor(Math.random() * (6 - 2) + 3)), + regAvatarUrl: 'https://youzhen123.oss-cn-huhehaote.aliyuncs.com/WechatOwnerProperty/images/mrtx.png', - } - }, - methods: { - onChooseavatar(e) { - let self = this; - let { - avatarUrl - } = e.detail; - this.regAvatarUrl = avatarUrl - console.log('avatarUrl', this.regAvatarUrl) - }, - onBindblur(e) { - this.regUserName = e.detail.value; // 获取微信昵称 - }, - onBindinput(e) { - this.regUserName = e.detail.value; // 获取微信昵称 - }, - randomAccess(min, max) { - return Math.floor(Math.random() * (min - max) + max) - }, - getRandomName(NameLength) { - let name = "" - for (let i = 0; i < NameLength; i++) { - let unicodeNum = "" - unicodeNum = this.randomAccess(0x4e00, 0x9fa5).toString(16) - name += this.decodeUnicode(unicodeNum) - } - return name - }, - decodeUnicode(str) { - //Unicode显示方式是\u4e00 - str = "\\u" + str - str = str.replace(/\\/g, "%"); - //转换中文 - str = unescape(str); - //将其他受影响的转换回原来 - str = str.replace(/%/g, "\\"); - return str; - }, - async onWxCheckSubmit() { - if (this.regUserName == '微信用户') { - this.$message.showToast('昵称不合规,不可以叫做:微信用户哈~') - return - } - //保存一下 - //先上传图片 - if (this.regAvatarUrl === - 'https://youzhen123.oss-cn-huhehaote.aliyuncs.com/WechatOwnerProperty/images/mrtx.png') { - var picture = this.regAvatarUrl - //更新接口 - this.$message.showLoading() - const { - code - } = await this.$http.request('post', "/api/current/user/update", { - data: { - ...this.dto, - nickName: this.regUserName, - picture: picture - } - }) + } + }, + methods: { + onChooseavatar(e) { + let self = this; + let { + avatarUrl + } = e.detail; + this.regAvatarUrl = avatarUrl + console.log('avatarUrl', this.regAvatarUrl) + }, + onBindblur(e) { + this.regUserName = e.detail.value; // 获取微信昵称 + }, + onBindinput(e) { + this.regUserName = e.detail.value; // 获取微信昵称 + }, + randomAccess(min, max) { + return Math.floor(Math.random() * (min - max) + max) + }, + getRandomName(NameLength) { + let name = "" + for (let i = 0; i < NameLength; i++) { + let unicodeNum = "" + unicodeNum = this.randomAccess(0x4e00, 0x9fa5).toString(16) + name += this.decodeUnicode(unicodeNum) + } + return name + }, + decodeUnicode(str) { + //Unicode显示方式是\u4e00 + str = "\\u" + str + str = str.replace(/\\/g, "%"); + //转换中文 + str = unescape(str); + //将其他受影响的转换回原来 + str = str.replace(/%/g, "\\"); + return str; + }, + async onWxCheckSubmit() { + if (this.regUserName == '微信用户') { + this.$message.showToast('昵称不合规,不可以叫做:微信用户哈~') + return + } + //保存一下 + //先上传图片 + if (this.regAvatarUrl === + 'https://youzhen123.oss-cn-huhehaote.aliyuncs.com/WechatOwnerProperty/images/mrtx.png') { + var picture = this.regAvatarUrl + //更新接口 + this.$message.showLoading() + const { + code + } = await this.$http.request('post', "/api/current/user/update", { + data: { + ...this.dto, + nickName: this.regUserName, + picture: picture + } + }) - this.$message.hideLoading() - this.$forceUpdate() - if (code == 0) { - this.$refs.popup_info.close() - this.$message.showToast('设置成功') - this.currentInfo.picture = picture - this.currentInfo.nickName = this.regUserName - } else { + this.$message.hideLoading() + this.$forceUpdate() + if (code == 0) { + this.$refs.popup_info.close() + this.$message.showToast('设置成功') + this.currentInfo.picture = picture + this.currentInfo.nickName = this.regUserName + } else { - } - } else { - this.$http.upload(this.regAvatarUrl).then(async res => { - var picture = res.data && res.data.length > 0 && res.data[0].url || '' - //更新接口 - this.$message.showLoading() - const { - code - } = await this.$http.request('post', "/api/current/user/update", { - data: { - ...this.currentInfo, - nickName: this.regUserName, - picture: picture - } - }) + } + } else { + this.$http.upload(this.regAvatarUrl).then(async res => { + var picture = res.data && res.data.length > 0 && res.data[0].url || '' + //更新接口 + this.$message.showLoading() + const { + code + } = await this.$http.request('post', "/api/current/user/update", { + data: { + ...this.currentInfo, + nickName: this.regUserName, + picture: picture + } + }) - this.$message.hideLoading() - this.$forceUpdate() - if (code == 0) { - this.$refs.popup_info.close() - this.$message.showToast('设置成功') - this.currentInfo.picture = picture - this.currentInfo.nickName = this.regUserName - } else { + this.$message.hideLoading() + this.$forceUpdate() + if (code == 0) { + this.$refs.popup_info.close() + this.$message.showToast('设置成功') + this.currentInfo.picture = picture + this.currentInfo.nickName = this.regUserName + } else { - } - }) - } - }, + } + }) + } + }, - async getUserProfile(e) { - this.$message.showLoading() - const res = await wx.getUserProfile({ - desc: '用于完善会员资料', - }); - console.log(res); - this.$message.hideLoading() - this.login_Wx(res.userInfo.avatarUrl, res.userInfo.nickName) - }, - login_Wx(imgurl, nickname) { - //获取openId - // /wx/jscode2session - let inviter = this.$storage.getItem('inviter') || '' - let inviterName = this.$storage.getItem('inviterName') || '' - //有效24小时 - if (inviter) { - var inviterTime = this.$storage.getItem('inviterTime') - if (new Date().getTime() > parseInt(inviterTime) + 1000 * 3600 * 24) { - inviter = '' - inviterName = '' - this.$storage.removeItem('inviter') - this.$storage.removeItem('inviterTime') - this.$storage.removeItem('inviterName') - } - } + async getUserProfile(e) { + this.$message.showLoading() + const res = await wx.getUserProfile({ + desc: '用于完善会员资料', + }); + console.log(res); + this.$message.hideLoading() + this.login_Wx(res.userInfo.avatarUrl, res.userInfo.nickName) + }, + login_Wx(imgurl, nickname) { + //获取openId + // /wx/jscode2session + let inviter = this.$storage.getItem('inviter') || '' + let inviterName = this.$storage.getItem('inviterName') || '' + //有效24小时 + if (inviter) { + var inviterTime = this.$storage.getItem('inviterTime') + if (new Date().getTime() > parseInt(inviterTime) + 1000 * 3600 * 24) { + inviter = '' + inviterName = '' + this.$storage.removeItem('inviter') + this.$storage.removeItem('inviterTime') + this.$storage.removeItem('inviterName') + } + } - const tmp = this; - this.$message.showLoading() - this.openid = this.$storage.getItem('openid'); - this.tel = this.$storage.getItem('tel'); - console.log('info,info,info,info,info,info', this.openid, this.tel); - if (!!this.openid && !!this.tel) { - // this.login = true; - } else { - // this.login = false; - console.log('wx.login'); - wx.login({ - success: async res => { - if (res.code) { - //微信登录成功 已拿到code - // tmp.login = true; - // tmp.jsCode = res.code; //保存获取到的code - console.log('abcd', res.code); - // this.$http.request('post',`/api/login/wechat`,{data:{code:tmp.jsCode}}) - this.$storage.setItem('jsCode', res.code); - const res2 = await wx.getUserInfo(); - console.log('res', res2); - this.tcode = res.code || '' - // if (nickname == '微信用户' || true) { - // //跳出弹出框,获取具体用户信息 - // tmp.$message.hideLoading() + const tmp = this; + this.$message.showLoading() + this.openid = this.$storage.getItem('openid'); + this.tel = this.$storage.getItem('tel'); + console.log('info,info,info,info,info,info', this.openid, this.tel); + if (!!this.openid && !!this.tel) { + // this.login = true; + } else { + // this.login = false; + console.log('wx.login'); + wx.login({ + success: async res => { + if (res.code) { + //微信登录成功 已拿到code + // tmp.login = true; + // tmp.jsCode = res.code; //保存获取到的code + console.log('abcd', res.code); + // this.$http.request('post',`/api/login/wechat`,{data:{code:tmp.jsCode}}) + this.$storage.setItem('jsCode', res.code); + const res2 = await wx.getUserInfo(); + console.log('res', res2); + this.tcode = res.code || '' + // if (nickname == '微信用户' || true) { + // //跳出弹出框,获取具体用户信息 + // tmp.$message.hideLoading() - // this.$refs.popup_info.open() + // this.$refs.popup_info.open() - // } else { - await this.$store.dispatch('loginwx', { - code: res.code, - imgurl: imgurl, - nickname: nickname, - inviter: inviter - }); - tmp.$message.hideLoading() - this.$forceUpdate() - //延迟,如果用户昵称是微信用户的话? - - setTimeout(() => { - if (tmp.currentInfo && tmp.currentInfo.id) { - if (tmp.currentInfo.nickName == '微信用户') { - tmp.$refs.popup_info && tmp.$refs.popup_info.open() - } - } - }, 500) - // } + // } else { + await this.$store.dispatch('loginwx', { + code: res.code, + imgurl: imgurl, + nickname: nickname, + inviter: inviter + }); + tmp.$message.hideLoading() + this.$forceUpdate() + //延迟,如果用户昵称是微信用户的话? - } else { - tmp.$message.hideLoading() - tmp.$message.showToast('微信登录失败'); + setTimeout(() => { + if (tmp.currentInfo && tmp.currentInfo.id) { + if (tmp.currentInfo.nickName == '微信用户') { + tmp.$refs.popup_info && tmp.$refs.popup_info.open() + } + } + }, 500) + // } - } - }, - error: res => { - console.log('wx.login error', res); - tmp.$message.hideLoading() + } else { + tmp.$message.hideLoading() + tmp.$message.showToast('微信登录失败'); - tmp.$message.showToast('微信授权失败'); - } - }); - } - }, + } + }, + error: res => { + console.log('wx.login error', res); + tmp.$message.hideLoading() - previewImg(url) { - if (url) { - uni.previewImage({ - urls: [url] - }) - } - }, - checkFormValues(dto, keys) { - if (keys) { - for (var key of keys) { - if (!dto[key]) { - return false - } - } - } - return true - }, - async refreshList(){ - this.page.current = 1 - await this.getList() - }, - async getList(type='get') { - if (this.listApi) { - this.$message.showLoading() - const { - data - } = await this.$http.request(type, this.listApi, { - params: { - ...this.query, - ...this.page - }, - data:{ - ...this.query, - ...this.page - } - }) - if (data) { - if (this.page.current == 1) { - this.list = data.records || [] - } else { - //根据id去重正常 - var ids = [] - for (var item of this.list) { - ids.push(item.id) - } - for (var item of data.records) { - if (ids.indexOf(item.id) < 0) { - this.list.push(item) - } - } + tmp.$message.showToast('微信授权失败'); + } + }); + } + }, - } - this.page.total = data.total || 0 - } - this.$message.hideLoading() - } + previewImg(url) { + if (url) { + uni.previewImage({ + urls: [url] + }) + } + }, + checkFormValues(dto, keys) { + if (keys) { + for (var key of keys) { + if (!dto[key]) { + return false + } + } + } + return true + }, + async refreshList() { + this.page.current = 1 + await this.getList() + }, + async getList(type = 'get') { + if (this.listApi) { + this.$message.showLoading() + const { + data + } = await this.$http.request(type, this.listApi, { + params: { + ...this.query, + ...this.page + }, + data: { + ...this.query, + ...this.page + } + }) + if (data) { + if (this.page.current == 1) { + this.list = data.records || [] + } else { + //根据id去重正常 + var ids = [] + for (var item of this.list) { + ids.push(item.id) + } + for (var item of data.records) { + if (ids.indexOf(item.id) < 0) { + this.list.push(item) + } + } - }, - async getMore(type='get') { - if (this.page.total > this.page.current * this.page.size) { - this.page.current += 1 - await this.getList(type) - } - }, - backHome() { - uni.reLaunch({ - url: '/pages/home/home' - }) - }, - goto(url, check = false) { - if (check) { - console.log('currentInfo', this.currentInfo) - if (!this.currentInfo.id) { - this.$message.showToast('请先登陆') - return - } + } + this.page.total = data.total || 0 + } + this.$message.hideLoading() + } - } - uni.navigateTo({ - url - }) - }, - backpage() { - // this.$router.go(-1) - uni.navigateBack() - } - // #ifdef APP || H5 - , - async appdownload(url, name = '') { - await this.$message.confirm('确定下载此文件吗') - let _this = this - if (url) { - // var url2 = environments.httpBaseUri + `/api/download/file?fileName=${name}&filePath=` + url - // uni.downloadFile({ - // url: url2, - // success: (res) => { - // if (res.statusCode === 200) { - // _this.$message.showToast('下载成功') - // } else { - // console.log(res) - // _this.$message.showToast('下载失败') - // } - // }, - // fail: (res) => { - // console.log(res) - // _this.$message.showToast('下载失败') - // } - // }); - _this.$message.showLoading() + }, + async getMore(type = 'get') { + if (this.page.total > this.page.current * this.page.size) { + this.page.current += 1 + await this.getList(type) + } + }, + backHome() { + uni.reLaunch({ + url: '/pages/home/home' + }) + }, + goto(url, check = false) { + if (check) { + console.log('currentInfo', this.currentInfo) + if (!this.currentInfo.id) { + this.$message.showToast('请先登陆') + return + } - uni.downloadFile({ - url: url, //下载地址接口返回 - success: (data) => { - _this.$message.hideLoading() - console.log('success', data) - if (data.statusCode === 200) { - //文件保存到本地 - uni.saveFile({ - tempFilePath: data.tempFilePath, //临时路径 - success: function(res) { - uni.showToast({ - icon: 'none', - mask: true, - title: '文件已保存:' + res - .savedFilePath, //保存路径 - duration: 2000, - }); - setTimeout(() => { - //打开文档查看 - uni.openDocument({ - filePath: res.savedFilePath, - success: function(res) { - // console.log('打开文档成功'); - } - }); - }, 2000) - }, - fail: (err) => { + } + uni.navigateTo({ + url + }) + }, + backpage() { + // this.$router.go(-1) + uni.navigateBack() + } + // #ifdef APP || H5 + , + async appdownload(url, name = '') { + await this.$message.confirm('确定下载此文件吗') + let _this = this + if (url) { + // var url2 = environments.httpBaseUri + `/api/download/file?fileName=${name}&filePath=` + url + // uni.downloadFile({ + // url: url2, + // success: (res) => { + // if (res.statusCode === 200) { + // _this.$message.showToast('下载成功') + // } else { + // console.log(res) + // _this.$message.showToast('下载失败') + // } + // }, + // fail: (res) => { + // console.log(res) + // _this.$message.showToast('下载失败') + // } + // }); + _this.$message.showLoading() - console.log(err); - uni.showToast({ - icon: 'none', - mask: true, - title: '下载成功保存失败', - }); - }, - }); - } - }, - fail: (err) => { - _this.$message.hideLoading() + uni.downloadFile({ + url: url, //下载地址接口返回 + success: (data) => { + _this.$message.hideLoading() + console.log('success', data) + if (data.statusCode === 200) { + //文件保存到本地 + uni.saveFile({ + tempFilePath: data.tempFilePath, //临时路径 + success: function (res) { + uni.showToast({ + icon: 'none', + mask: true, + title: '文件已保存:' + res + .savedFilePath, //保存路径 + duration: 2000, + }); + setTimeout(() => { + //打开文档查看 + uni.openDocument({ + filePath: res.savedFilePath, + success: function (res) { + // console.log('打开文档成功'); + } + }); + }, 2000) + }, + fail: (err) => { - console.log(err); - uni.showToast({ - icon: 'none', - mask: true, - title: '失败请重新下载', - }); - }, - }); - } - } - // #endif - // #ifdef MP - , - async wxdownload(url, name = '') { - await this.$message.confirm('是否要下载此文件') - var url2 = environments.httpBaseUri + `/api/download/file?fileName=${name}&filePath=` + url + console.log(err); + uni.showToast({ + icon: 'none', + mask: true, + title: '下载成功保存失败', + }); + }, + }); + } + }, + fail: (err) => { + _this.$message.hideLoading() - let that = this - that.$message.showLoading() - // wx.sa - // wx.downloadFile({ - // url: url2, - // success: res => { - // that.$message.showToast('下载成功') + console.log(err); + uni.showToast({ + icon: 'none', + mask: true, + title: '失败请重新下载', + }); + }, + }); + } + } + // #endif + // #ifdef MP + , + async wxdownload(url, name = '') { + await this.$message.confirm('是否要下载此文件') + var url2 = environments.httpBaseUri + `/api/download/file?fileName=${name}&filePath=` + url - // }, - // fail: res => { - // that.$message.showToast('下载失败') + let that = this + that.$message.showLoading() + // wx.sa + // wx.downloadFile({ + // url: url2, + // success: res => { + // that.$message.showToast('下载成功') - // }, - // complete: res => { - // that.$message.hideLoading() - // } - // }) - wx.downloadFile({ - url: url, - timeout: 120000, - success(res) { - that.$message.hideLoading() - console.log('res', res) - if (res.statusCode === 200) { - const filePath = res.tempFilePath - if (filePath.endsWith('.jpg') || - filePath.endsWith('.jpeg') || - filePath.endsWith('.png') || - filePath.endsWith('.jpg')) { - wx.saveImageToPhotosAlbum({ - filePath: filePath, - success: function(res) { - that.$message.showToast('保存图片成功') - }, - fail: function(res) { - that.$message.showToast('打开文档失败,非支持的类型') - } - }) + // }, + // fail: res => { + // that.$message.showToast('下载失败') - } else if (filePath.endsWith('.mp4') || - filePath.endsWith('.flv') || - filePath.endsWith('.avi') || - filePath.endsWith('.wmv') || - filePath.endsWith('.mpeg')) { - wx.saveVideoToPhotosAlbum({ - filePath: filePath, - success: function(res) { - that.$message.showToast('保存视频成功') - }, - fail: function(res) { - that.$message.showToast('打开文档失败,非支持的类型') - } - }) + // }, + // complete: res => { + // that.$message.hideLoading() + // } + // }) + wx.downloadFile({ + url: url, + timeout: 120000, + success(res) { + that.$message.hideLoading() + console.log('res', res) + if (res.statusCode === 200) { + const filePath = res.tempFilePath + if (filePath.endsWith('.jpg') || + filePath.endsWith('.jpeg') || + filePath.endsWith('.png') || + filePath.endsWith('.jpg')) { + wx.saveImageToPhotosAlbum({ + filePath: filePath, + success: function (res) { + that.$message.showToast('保存图片成功') + }, + fail: function (res) { + that.$message.showToast('打开文档失败,非支持的类型') + } + }) - } else { - wx.openDocument({ - filePath: filePath, - showMenu: true, //关键点 - success: function(res) { - console.log('打开文档成功') - }, - fail: function(res) { - that.$message.showToast('打开文档失败,非支持的类型') - } - }) - } - } else { - that.$message.showToast('下载失败,服务器内部错误') + } else if (filePath.endsWith('.mp4') || + filePath.endsWith('.flv') || + filePath.endsWith('.avi') || + filePath.endsWith('.wmv') || + filePath.endsWith('.mpeg')) { + wx.saveVideoToPhotosAlbum({ + filePath: filePath, + success: function (res) { + that.$message.showToast('保存视频成功') + }, + fail: function (res) { + that.$message.showToast('打开文档失败,非支持的类型') + } + }) - } - }, - fail: res => { - that.$message.hideLoading() - that.$message.showToast('下载失败') - }, - complete: res => { + } else { + wx.openDocument({ + filePath: filePath, + showMenu: true, //关键点 + success: function (res) { + console.log('打开文档成功') + }, + fail: function (res) { + that.$message.showToast('打开文档失败,非支持的类型') + } + }) + } + } else { + that.$message.showToast('下载失败,服务器内部错误') - } - }) - } - // #endif - } + } + }, + fail: res => { + that.$message.hideLoading() + that.$message.showToast('下载失败') + }, + complete: res => { + + } + }) + } + // #endif + + // #ifdef PUB_CUSTOMER + , + async submitShopping(dto) { + //提交到购物车中 + this.$message.showLoading() + await this.$store.dispatch('submitShopping',dto); + this.$message.hideLoading() + } + // #endif + } } export default mixinsCommon \ No newline at end of file diff --git a/pages.json b/pages.json index d289514..4accc4b 100644 --- a/pages.json +++ b/pages.json @@ -1,240 +1,255 @@ { - // 如果您是通过uni_modules形式引入uView,可以忽略此配置 - "easycom": { - "^u-(.*)": "uview-ui/components/u-$1/u-$1.vue" - }, - "pages": [{ - "path": "pages/login/supplier-login", - "style": { - "navigationBarTitleText": "登录", - "enablePullDownRefresh": false, - "navigationStyle": "custom" - } - }, { - "path": "pages/home/supplier-home", - "style": { - "navigationBarTitleText": "首页", - "enablePullDownRefresh": true, - "navigationStyle": "custom" - } + // 如果您是通过uni_modules形式引入uView,可以忽略此配置 + "easycom": { + "^u-(.*)": "uview-ui/components/u-$1/u-$1.vue" + }, + "pages": [ + { + "path": "pages/login/supplier-login", + "style": { + "navigationBarTitleText": "登录", + "enablePullDownRefresh": false, + "navigationStyle": "custom" + } + }, + { + "path": "pages/home/supplier-home", + "style": { + "navigationBarTitleText": "首页", + "enablePullDownRefresh": true, + "navigationStyle": "custom" + } + }, + // #ifdef PUB_CUSTOMER + { + "path": "pages/home/home", + "style": { + "navigationBarTitleText": "首页", + "enablePullDownRefresh": true, + "navigationStyle": "custom" + } + }, + { + "path": "pages/user/address/address", + "style": { + "navigationBarTitleText": "收货地址", + "enablePullDownRefresh": false + } + }, + // #endif - }, - // #ifdef PUB_CUSTOMER - { - "path": "pages/home/home", - "style": { - "navigationBarTitleText": "首页", - "enablePullDownRefresh": true, - "navigationStyle": "custom" - } + // #ifdef PUB_SUPPLIER + { + "path": "pages/login/supplier-reg", + "style": { + "navigationBarTitleText": "申请入驻", + "navigationStyle": "custom" + } + }, + // #endif - }, - { - "path": "pages/user/address/address", - "style": { - "navigationBarTitleText": "收货地址", - "enablePullDownRefresh": false - } - }, - // #endif - - // #ifdef PUB_SUPPLIER - { - "path": "pages/login/supplier-reg", - "style": { - "navigationBarTitleText": "申请入驻", - "navigationStyle": "custom" - } - }, - // #endif - - // #ifdef PUB_PARTNER - { - "path": "pages/login/supplier-reg", - "style": { - "navigationBarTitleText": "申请入驻" - } - }, - // #endif - { - "path": "pages/user/supplier-user", - "style": { - "navigationBarTitleText": "我的", - "enablePullDownRefresh": true, - "navigationStyle": "custom" - } - }, - { - "path": "pages/user/user-info/user-info", - "style": { - "navigationBarTitleText": "我的信息", - "enablePullDownRefresh": false - } - }, - { - "path": "pages/notice/notice", - "style": { - "navigationBarTitleText": "通知公告", - "enablePullDownRefresh": false - } - }, - { - "path": "pages/notice/list", - "style": { - "navigationBarTitleText": "通知公告", - "enablePullDownRefresh": true - } - }, - { - "path": "pages/user/user-pwd/user-pwd", - "style": { - "navigationBarTitleText": "修改密码", - "enablePullDownRefresh": false - } - } - - ], - - "subPackages": [{ - "root": "sub_pages/supplier", - "pages": [ - // #ifdef PUB_SUPPLIER - { - "path": "supplier-info/supplier-info", - "style": { - "navigationBarTitleText": "信息维护", - "enablePullDownRefresh": false - } - }, - { - "path": "flower-manage/flower-manage", - "style": { - "navigationBarTitleText": "商品管理", - "enablePullDownRefresh": true - } - }, - { - "path": "flower-manage/flower-add", - "style": { - "navigationBarTitleText": "", - "enablePullDownRefresh": false - } - }, - // #endif - { - "path": "order-settlement/order-settlement", - "style": { - "navigationBarTitleText": "账单结算", - "enablePullDownRefresh": true - } - }, - - { - "path": "order-sale/order-sale", - "style": { - "navigationBarTitleText": "售后理赔", - "enablePullDownRefresh": true - } - }, - { - "path": "order-records/order-records", - "style": { - "navigationBarTitleText": "扣款记录", - "enablePullDownRefresh": true, - "navigationBarBackgroundColor": "#E6F2EB" - - } - }, - - { - "path": "protocol", - "style": { - "navigationBarTitleText": "协议", - "enablePullDownRefresh": false - } - } - ] + // #ifdef PUB_PARTNER + { + "path": "pages/login/supplier-reg", + "style": { + "navigationBarTitleText": "申请入驻" + } + }, + // #endif + { + "path": "pages/user/supplier-user", + "style": { + "navigationBarTitleText": "我的", + "enablePullDownRefresh": true, + "navigationStyle": "custom" + } + }, + { + "path": "pages/user/user-info/user-info", + "style": { + "navigationBarTitleText": "我的信息", + "enablePullDownRefresh": false + } + }, + { + "path": "pages/notice/notice", + "style": { + "navigationBarTitleText": "通知公告", + "enablePullDownRefresh": false + } + }, + { + "path": "pages/notice/list", + "style": { + "navigationBarTitleText": "通知公告", + "enablePullDownRefresh": true + } + }, + { + "path": "pages/user/user-pwd/user-pwd", + "style": { + "navigationBarTitleText": "修改密码", + "enablePullDownRefresh": false + } + } + ], + "subPackages": [ + { + "root": "sub_pages/supplier", + "pages": [ + // #ifdef PUB_SUPPLIER + { + "path": "supplier-info/supplier-info", + "style": { + "navigationBarTitleText": "信息维护", + "enablePullDownRefresh": false + } + }, + { + "path": "flower-manage/flower-manage", + "style": { + "navigationBarTitleText": "商品管理", + "enablePullDownRefresh": true + } + }, + { + "path": "flower-manage/flower-add", + "style": { + "navigationBarTitleText": "", + "enablePullDownRefresh": false + } + }, + // #endif + { + "path": "order-settlement/order-settlement", + "style": { + "navigationBarTitleText": "账单结算", + "enablePullDownRefresh": true + } + }, + { + "path": "order-sale/order-sale", + "style": { + "navigationBarTitleText": "售后理赔", + "enablePullDownRefresh": true + } + }, + { + "path": "order-records/order-records", + "style": { + "navigationBarTitleText": "扣款记录", + "enablePullDownRefresh": true, + "navigationBarBackgroundColor": "#E6F2EB" + } + }, + { + "path": "protocol", + "style": { + "navigationBarTitleText": "协议", + "enablePullDownRefresh": false + } + } + ] + }, + { + "root": "sub_pages/partner", + "pages": [ + // #ifdef PUB_PARTNER + { + "path": "partner-info/partner-info", + "style": { + "navigationBarTitleText": "信息维护", + "enablePullDownRefresh": false + } + }, + { + "path": "order-manage/order-manage", + "style": { + "navigationBarTitleText": "订单管理", + "enablePullDownRefresh": true + } + }, + { + "path": "markup-config/markup-config", + "style": { + "navigationBarTitleText": "加价配置", + "enablePullDownRefresh": true + } + } + // #endif + ] + }, + { + "root": "sub_pages/customer", + "pages": [ + // #ifdef PUB_CUSTOMER - }, { - "root": "sub_pages/partner", - "pages": [ - // #ifdef PUB_PARTNER - { - "path": "partner-info/partner-info", - "style": { - "navigationBarTitleText": "信息维护", - "enablePullDownRefresh": false - } - }, - - { - "path": "order-manage/order-manage", - "style": { - "navigationBarTitleText": "订单管理", - "enablePullDownRefresh": true - } - }, - { - "path": "markup-config/markup-config", - "style": { - "navigationBarTitleText": "加价配置", - "enablePullDownRefresh": true - } - } - // #endif - ] - }, { - "root": "sub_pages/customer", - "pages": [ - // #ifdef PUB_CUSTOMER - - - { - "path": "trade/trade", - "style": { - "navigationBarTitleText": "交易大厅", - "enablePullDownRefresh": true - } - }, - { - "path": "shopping/shopping", - "style": { - "navigationBarTitleText": "购物车", - "enablePullDownRefresh": true - } - }, - { - "path": "trade/list", - "style": { - "navigationBarTitleText": "商品列表", - "enablePullDownRefresh": true - } - }, - { - "path": "trade/detail", - "style": { - "navigationBarTitleText": "商品详情", - "enablePullDownRefresh": false - - } - }, - { - "path": "shop/shop", - "style": { - "navigationBarTitleText": "商家主页" - } - } - // #endif - ] - }], - "globalStyle": { - "navigationBarTextStyle": "black", - "navigationBarTitleText": "花满芫", - "navigationBarBackgroundColor": "#F8F8F8", - "backgroundColor": "#F8F8F8", - "app-plus": { - "background": "#efeff4" - } - } + { + "path": "trade/trade", + "style": { + "navigationBarTitleText": "交易大厅", + "enablePullDownRefresh": true + } + }, + { + "path": "shopping/shopping", + "style": { + "navigationBarTitleText": "购物车", + "enablePullDownRefresh": true + } + }, + { + "path": "shopping/confirm", + "style": { + "navigationBarTitleText": "订单详情" + } + }, + { + "path": "trade/list", + "style": { + "navigationBarTitleText": "商品列表", + "enablePullDownRefresh": true + } + }, + { + "path": "trade/detail", + "style": { + "navigationBarTitleText": "商品详情", + "enablePullDownRefresh": false + } + }, + { + "path": "shop/shop", + "style": { + "navigationBarTitleText": "商家主页" + } + }, + { + "path": "self/follow", + "style": { + "navigationBarTitleText": "我的关注", + "enablePullDownRefresh": true + } + }, + { + "path": "self/collect", + "style": { + "navigationBarTitleText": "我的收藏", + "enablePullDownRefresh": true + } + } + // #endif + ] + } + ], + "globalStyle": { + "navigationBarTextStyle": "black", + "navigationBarTitleText": "花满芫", + "navigationBarBackgroundColor": "#F8F8F8", + "backgroundColor": "#F8F8F8", + "app-plus": { + "background": "#efeff4" + } + } } \ No newline at end of file diff --git a/pages/home/components/home-price.vue b/pages/home/components/home-price.vue index 4065062..b96ad7d 100644 --- a/pages/home/components/home-price.vue +++ b/pages/home/components/home-price.vue @@ -1,84 +1,80 @@ <template> <view class="home-price"> <view class="flex t1"> - <view>2024-06-03 09:20:19 花满芜成交均价</view> + <view>2024-06-03 09:20:19 花满芫成交均价</view> <uni-icons class="m-l-a m-r-0" type="right"></uni-icons> </view> <view class="items" style="border-top: 2rpx solid #EEEEEE;"> <view class="flex" style="border-bottom: 2rpx solid #EEEEEE;padding-top: 24rpx;"> <view class="item flex1"> - <view class="title">单头玫瑰</view> + <view class="title">{{list1[0]&&list1[0].name||''}}</view> <view class="price"> - 19.66 + {{list1[0]&&list1[0].avePrice||''}} </view> - <view class="flex desc"> - <view class="m-l-a m-r-a">+0.76</view> - <view class="m-l-a m-r-a text-right">+4.02%</view> + <view class="flex desc" v-if="list1[0]"> + <view class="m-l-a m-r-a">{{list1[0]&&list1[0].avePriceDifference<0?'-':'+'}}{{list1[0]&&list1[0].avePriceDifference||''}}</view> + <view class="m-l-a m-r-a text-right">{{list1[0]&&list1[0].avePriceDifferenceRate<0?'-':'+'}}{{list1[0]&&list1[0].avePriceDifferenceRate*100||''}}%</view> </view> </view> <view class="line"></view> <view class="item flex1"> - <view class="title">单头玫瑰</view> + <view class="title">{{list1[1]&&list1[1].name||''}}</view> <view class="price"> - 19.66 - + {{list1[1]&&list1[1].avePrice||''}} </view> - <view class="flex desc"> - <view class="m-l-a m-r-a">+0.76</view> - <view class="m-l-a m-r-a text-right">+4.02%</view> + <view class="flex desc" v-if="list1[1]"> + <view class="m-l-a m-r-a">{{list1[1]&&list1[1].avePriceDifference<0?'-':'+'}}{{list1[1]&&list1[1].avePriceDifference||''}}</view> + <view class="m-l-a m-r-a text-right">{{list1[1]&&list1[1].avePriceDifferenceRate<0?'-':'+'}}{{list1[1]&&list1[1].avePriceDifferenceRate*100||''}}%</view> </view> </view> <view class="line"></view> - <view class="item flex1"> - <view class="title">单头玫瑰</view> + <view class="title">{{list1[2]&&list1[2].name||''}}</view> <view class="price"> - 19.66 + {{list1[2]&&list1[2].avePrice||''}} </view> - <view class="flex desc"> - <view class="m-l-a m-r-a">+0.76</view> - <view class="m-l-a m-r-a text-right">+4.02%</view> + <view class="flex desc" v-if="list1[2]"> + <view class="m-l-a m-r-a">{{list1[2]&&list1[2].avePriceDifference<0?'-':'+'}}{{list1[2]&&list1[2].avePriceDifference||''}}</view> + <view class="m-l-a m-r-a text-right">{{list1[2]&&list1[2].avePriceDifferenceRate<0?'-':'+'}}{{list1[2]&&list1[2].avePriceDifferenceRate*100||''}}%</view> </view> </view> </view> <!-- <u-divider></u-divider> --> - <view class="flex" style="padding-top: 24rpx;"> + <view class="flex" style="padding-top: 24rpx;" v-if="list2.length>0"> <view class="item flex1"> - <view class="title">单头玫瑰</view> + <view class="title">{{list2[0]&&list2[0].name||''}}</view> <view class="price"> - 19.66 + {{list2[0]&&list2[0].avePrice||''}} </view> - <view class="flex desc"> - <view class="m-l-a m-r-a">+0.76</view> - <view class="m-l-a m-r-a text-right">+4.02%</view> + <view class="flex desc" v-if="list2[0]"> + <view class="m-l-a m-r-a">{{list2[0]&&list2[0].avePriceDifference<0?'-':'+'}}{{list2[0]&&list2[0].avePriceDifference||''}}</view> + <view class="m-l-a m-r-a text-right">{{list2[0]&&list2[0].avePriceDifferenceRate<0?'-':'+'}}{{list2[0]&&list2[0].avePriceDifferenceRate*100||''}}%</view> </view> </view> <view class="line"></view> <view class="item flex1"> - <view class="title">单头玫瑰</view> + <view class="title">{{list2[1]&&list2[1].name||''}}</view> <view class="price"> - 19.66 - + {{list2[1]&&list2[1].avePrice||''}} </view> - <view class="flex desc"> - <view class="m-l-a m-r-a">+0.76</view> - <view class="m-l-a m-r-a text-right">+4.02%</view> + <view class="flex desc" v-if="list2[1]"> + <view class="m-l-a m-r-a">{{list2[1]&&list2[1].avePriceDifference<0?'-':'+'}}{{list2[1]&&list2[1].avePriceDifference||''}}</view> + <view class="m-l-a m-r-a text-right">{{list2[1]&&list2[1].avePriceDifferenceRate<0?'-':'+'}}{{list2[1]&&list2[1].avePriceDifferenceRate*100||''}}%</view> </view> </view> <view class="line"></view> - <view class="item flex1"> - <view class="title">单头玫瑰</view> + <view class="title">{{list2[2]&&list2[2].name||''}}</view> <view class="price"> - 19.66 + {{list2[2]&&list2[2].avePrice||''}} </view> - <view class="flex desc"> - <view class="m-l-a m-r-a">+0.76</view> - <view class="m-l-a m-r-a text-right">+4.02%</view> + <view class="flex desc" v-if="list2[2]"> + <view class="m-l-a m-r-a">{{list2[2]&&list2[2].avePriceDifference<0?'-':'+'}}{{list2[2]&&list2[2].avePriceDifference||''}}</view> + <view class="m-l-a m-r-a text-right">{{list2[2]&&list2[2].avePriceDifferenceRate<0?'-':'+'}}{{list2[2]&&list2[2].avePriceDifferenceRate*100||''}}%</view> </view> </view> </view> - + </view> </view> </template> @@ -87,8 +83,27 @@ export default { data() { return { - + list1: [], + list2: [], }; + }, + mounted() { + + const { + data + } = await this.$http.request('get', '/api/pub/customer/home', { + size: 6, + }) + var list = data && data.records || [] + this.list1 = [] + this.list2 = [] + for (var i = 0; i < list.length && i < 3; i++) { + this.list1.push(list[i]) + } + for (var i = 3; i < list.length && i < 6; i++) { + this.list2.push(list[i]) + } + } } </script> diff --git a/pages/login/supplier-login.vue b/pages/login/supplier-login.vue index eca449d..427b37b 100644 --- a/pages/login/supplier-login.vue +++ b/pages/login/supplier-login.vue @@ -11,13 +11,13 @@ <form class="cl"> <view class="t-a titles-top"> <view class="title-1">HELLO</view> - <view class="title-2">欢迎登录<span class="title-3">花满芜</span> - <!-- #ifdef PUB_SUPPLIER --> - <span>供应商管理平台</span> - <!-- #endif --> - <!-- #ifdef PUB_PARTNER --> - <span>合伙人管理平台</span> - <!-- #endif --> + <view class="title-2">欢迎登录<span class="title-3">花满芫</span> + <!-- #ifdef PUB_SUPPLIER --> + <span>供应商管理平台</span> + <!-- #endif --> + <!-- #ifdef PUB_PARTNER --> + <span>合伙人管理平台</span> + <!-- #endif --> </view> </view> <view class="t-a input form-input" v-if="loginType=='pwd'"> diff --git a/pages/login/supplier-reg.vue b/pages/login/supplier-reg.vue index 0ede898..0038663 100644 --- a/pages/login/supplier-reg.vue +++ b/pages/login/supplier-reg.vue @@ -31,7 +31,7 @@ <form class="cl"> <view class="t-a titles-top"> <view class="title-1">HELLO</view> - <view class="title-2">欢迎入驻<span class="title-3">花满芜</span></view> + <view class="title-2">欢迎入驻<span class="title-3">花满芫</span></view> </view> @@ -75,7 +75,7 @@ @click="protocal=!protocal" class="component-radio" :class="[protocal?'cur':'']"> </view> - <view class="topic-gray" @click="toProtocol">请仔细阅读《花满芜合伙人供应商入口小程序隐私保护指引》如您同意该指引,请勾选开始使用本小程序 + <view class="topic-gray" @click="toProtocol">请仔细阅读《花满芫合伙人供应商入口小程序隐私保护指引》如您同意该指引,请勾选开始使用本小程序 </view> </view> </form> diff --git a/store/index.js b/store/index.js index 7452b61..190659b 100644 --- a/store/index.js +++ b/store/index.js @@ -1,412 +1,417 @@ import http from '../plugins/http' import storage from '../plugins/storage.js' import message from '../plugins/message.js' -// #ifndef VUE3 import Vue from 'vue' import Vuex from 'vuex' + Vue.use(Vuex) const store = new Vuex.Store({ - // #endif + state: { + hasLogin: false, + isUniverifyLogin: false, + loginProvider: "", + openid: null, + testvuex: false, + colorIndex: 0, + colorList: ['#FF0000', '#00FF00', '#0000FF'], + noMatchLeftWindow: true, + active: 'componentPage', + leftWinActive: '/pages/component/view/view', + activeOpen: '', + menu: [], + univerifyErrorMsg: '', + currentInfo: {}, //个人用户信息 + cache_address: {}, + // remoteip:'',//服务器ip + sign: { + 'enterprise': 0, + 'info': 0, + 'flower': 0, + 'shopping': 0, + }, + defaultaddress: {} + }, + mutations: { + + updateLogin(state, provider) { + console.log('updateLogin', provider) + state.hasLogin = provider && true || false; + if (!state.hasLogin) { + storage.removeItem('token') + } + }, + login(state, provider) { + state.hasLogin = true; + state.loginProvider = provider; + }, + logout(state) { + state.hasLogin = false + state.openid = null + state.currentInfo = {} + storage.removeItem('token') + message.showToast('退出登录成功') + // #ifdef APP + var KeepAliveModule = uni.requireNativePlugin("yh-nl") //保活组件 + + let ret = KeepAliveModule.stopLocation(); + console.log('ret', ret) + // #endif + uni.redirectTo({ + url: '/views/login/login' + }) + }, + setOpenid(state, openid) { + state.openid = openid + }, + setDefaultAddress(state, defaultaddress) { + state.defaultaddress = defaultaddress + }, + setTestTrue(state) { + state.testvuex = true + }, + setTestFalse(state) { + state.testvuex = false + }, + setColorIndex(state, index) { + state.colorIndex = index + }, + setActive(state, tabPage) { + state.active = tabPage + }, + setActiveOpen(state, activeOpen) { + state.activeOpen = activeOpen + }, + setMenu(state, menu) { + state.menu = menu + }, + setUniverifyLogin(state, payload) { + typeof payload !== 'boolean' ? payload = !!payload : ''; + state.isUniverifyLogin = payload; + }, + setUniverifyErrorMsg(state, payload = '') { + state.univerifyErrorMsg = payload + } + }, + getters: { + currentColor(state) { + return state.colorList[state.colorIndex] + } + }, + actions: { + sign_add: async function ({ + commit, + state + }, key) { + console.log('sign_add', key) + state.sign[key] = 1 + }, + sign_clear: async function ({ + commit, + state + }, key) { + console.log('sign_clear', key) + state.sign[key] = 0 + }, + // lazy loading openid + logout: async function ({ + commit, + state + }) { + commit('logout') + }, + getUserOpenId: async function ({ + commit, + state + }) { + return await new Promise((resolve, reject) => { + if (state.openid) { + resolve(state.openid) + } else { + uni.login({ + success: (data) => { + commit('login') + setTimeout(function () { //模拟异步请求服务器获取 openid + const openid = '123456789' + console.log( + 'uni.request mock openid[' + + openid + ']'); + commit('setOpenid', openid) + resolve(openid) + }, 1000) + }, + fail: (err) => { + console.log('uni.login 接口调用失败,将无法正常使用开放接口等服务', + err) + reject(err) + } + }) + } + }) + }, + getCurrentInfo: async function ({ + commit, + state + }) { + //把权限获取到 + // console.log('getCurrentInfo,getCurrentInfo') + const currentInfo = await http.request('get', '/api/current/user', {}) + if (currentInfo && currentInfo.code == 0) { + // state.cMenu = cMenu + // state.roles = currentInfo.data.roles || [] + state.currentInfo = currentInfo.data || {} + state.type = currentInfo.data.type || '' + state.spacecode = currentInfo.data.spacecode || '' + // if(reload){ + // location.reload() + // } + commit("updateLogin", true) + } else { + commit("updateLogin", false) + //这种情况就是要跳转到登录页面 + } + }, + loginwx: async function ({ + dispatch, + commit, + state + }, data) { + var code = data.code + let inviter = data.inviter || '' + console.log('') + const resp = await http.request('post', '/api/login/wechat', { + data: { + code: code, + imgurl: data.imgurl || '', + nickname: data.nickname || '', + inviter: inviter + }, + // params:{ + // code:code + // } + }) + if (resp && resp.code == 0) { + state.isBind = true + storage.setItem("token", resp.data.access_token || "") + state.hasLogin = true + if (inviter) { + storage.removeItem('inviter'); + storage.removeItem('inviterTime'); + storage.removeItem('inviterName'); + } + await dispatch('getCurrentInfo') + } else { + message.showToast('登录失败.' + (resp && resp.msg)) + storage.removeItem('openid'); + storage.removeItem('tel'); + storage.removeItem('token'); + } + return resp + }, + regUser: async function ({ + commit, + dispatch, + state + }, data) { + { + const resp = await http.request('post', '/api/register/' + data.type, { + data: { + username: data.username, + password: data.password, + tel: data.phoneNumber || data.tel, + smsCode: data.smsCode || '', + dto: data.dto || undefined + }, + params: { + clientType: data.clientType || 'app' + } + }) + console.log('resp', resp) + if (resp && resp.code == 0) { + } else { - // #ifdef VUE3 - import { - createStore - } from 'vuex' - const store = createStore({ - // #endif - state: { - hasLogin: false, - isUniverifyLogin: false, - loginProvider: "", - openid: null, - testvuex: false, - colorIndex: 0, - colorList: ['#FF0000', '#00FF00', '#0000FF'], - noMatchLeftWindow: true, - active: 'componentPage', - leftWinActive: '/pages/component/view/view', - activeOpen: '', - menu: [], - univerifyErrorMsg: '', - currentInfo: {}, //个人用户信息 - cache_address: {}, - // remoteip:'',//服务器ip - sign: { - 'enterprise': 0, - 'info': 0, - 'flower': 0, - }, - defaultaddress: {} - }, - mutations: { + } + return resp + } - updateLogin(state, provider) { - console.log('updateLogin', provider) - state.hasLogin = provider && true || false; - if (!state.hasLogin) { - storage.removeItem('token') - } - }, - login(state, provider) { - state.hasLogin = true; - state.loginProvider = provider; - }, - logout(state) { - state.hasLogin = false - state.openid = null - state.currentInfo = {} - storage.removeItem('token') - message.showToast('退出登录成功') - // #ifdef APP - var KeepAliveModule = uni.requireNativePlugin("yh-nl") //保活组件 + }, + loginPartner: async function ({ + commit, + dispatch, + state + }, data) { + { + const resp = await http.request('post', '/api/login/partner' + ((data + .phoneNumber || data.tel) ? '/phone' : ''), { + data: { + username: (data.phoneNumber || data.tel) ? (data.phoneNumber || + data.tel) : data.username, + password: data.password, + tel: data.phoneNumber || data.tel, + smsCode: data.smsCode || '' + }, + params: { + clientType: data.clientType || 'app' + } + }) + console.log('resp', resp) + if (resp && resp.code == 0) { + // await getCurrentInfo() + // // this.$message.showToast('登录成功') + // console.log(resp) + storage.setItem('token', resp.data.access_token) + commit("updateLogin", true) + await dispatch('getCurrentInfo') - let ret = KeepAliveModule.stopLocation(); - console.log('ret', ret) - // #endif - uni.redirectTo({ - url: '/views/login/login' - }) - }, - setOpenid(state, openid) { - state.openid = openid - }, - setDefaultAddress(state, defaultaddress) { - state.defaultaddress = defaultaddress - }, - setTestTrue(state) { - state.testvuex = true - }, - setTestFalse(state) { - state.testvuex = false - }, - setColorIndex(state, index) { - state.colorIndex = index - }, - setActive(state, tabPage) { - state.active = tabPage - }, - setActiveOpen(state, activeOpen) { - state.activeOpen = activeOpen - }, - setMenu(state, menu) { - state.menu = menu - }, - setUniverifyLogin(state, payload) { - typeof payload !== 'boolean' ? payload = !!payload : ''; - state.isUniverifyLogin = payload; - }, - setUniverifyErrorMsg(state, payload = '') { - state.univerifyErrorMsg = payload - } - }, - getters: { - currentColor(state) { - return state.colorList[state.colorIndex] - } - }, - actions: { - sign_add: async function({ - commit, - state - }, key) { - console.log('sign_add', key) - state.sign[key] = 1 - }, - sign_clear: async function({ - commit, - state - }, key) { - console.log('sign_clear', key) - state.sign[key] = 0 - }, - // lazy loading openid - logout: async function({ - commit, - state - }) { - commit('logout') - }, - getUserOpenId: async function({ - commit, - state - }) { - return await new Promise((resolve, reject) => { - if (state.openid) { - resolve(state.openid) - } else { - uni.login({ - success: (data) => { - commit('login') - setTimeout(function() { //模拟异步请求服务器获取 openid - const openid = '123456789' - console.log( - 'uni.request mock openid[' + - openid + ']'); - commit('setOpenid', openid) - resolve(openid) - }, 1000) - }, - fail: (err) => { - console.log('uni.login 接口调用失败,将无法正常使用开放接口等服务', - err) - reject(err) - } - }) - } - }) - }, - getCurrentInfo: async function({ - commit, - state - }) { - //把权限获取到 - // console.log('getCurrentInfo,getCurrentInfo') - const currentInfo = await http.request('get', '/api/current/user', { + console.log('login,reLaunch') + // #ifdef APP + var KeepAliveModule = uni.requireNativePlugin("yh-nl") //保活组件 - }) - if (currentInfo && currentInfo.code == 0) { - // state.cMenu = cMenu - // state.roles = currentInfo.data.roles || [] - state.currentInfo = currentInfo.data || {} - state.type = currentInfo.data.type || '' - state.spacecode = currentInfo.data.spacecode || '' - // if(reload){ - // location.reload() - // } - commit("updateLogin", true) - } else { - commit("updateLogin", false) - //这种情况就是要跳转到登录页面 - } - }, - loginwx: async function({ - dispatch, - commit, - state - }, data) { - var code = data.code - let inviter = data.inviter || '' - console.log('') - const resp = await http.request('post', '/api/login/wechat', { - data: { - code: code, - imgurl: data.imgurl || '', - nickname: data.nickname || '', - inviter: inviter - }, - // params:{ - // code:code - // } - }) - if (resp && resp.code == 0) { - state.isBind = true - storage.setItem("token", resp.data.access_token || "") - state.hasLogin = true - if (inviter) { - storage.removeItem('inviter'); - storage.removeItem('inviterTime'); - storage.removeItem('inviterName'); - } - await dispatch('getCurrentInfo') - } else { - message.showToast('登录失败.' + (resp && resp.msg)) - storage.removeItem('openid'); - storage.removeItem('tel'); - storage.removeItem('token'); - } - return resp - }, - regUser: async function({ - commit, - dispatch, - state - }, data) { - { - const resp = await http.request('post', '/api/register/' + data.type, { - data: { - username: data.username, - password: data.password, - tel: data.phoneNumber || data.tel, - smsCode: data.smsCode || '', - dto: data.dto || undefined - }, - params: { - clientType: data.clientType || 'app' - } - }) - console.log('resp', resp) - if (resp && resp.code == 0) { + KeepAliveModule && KeepAliveModule.startLocation({ + intervalTime: 5000, //定位间隔时间 + gaodeApiKey: "0eef1axxxxxx7964", //高德地图Key,已停用,引入插件配置 + locationMode: 1, //定位模式 + purpose: 0, //定位场景 + ifUpload: true, //是否上报服务器 + uploadUrl: "http://bio51-api.fixbug.fun/api/current/employee/location", //上报接口 + params: "{'lat':'1','lng':'3'}", //其他参数 + headers: "{'authorization1':'Bearer xOHeJhg'}", + }, function (res) { + console.log("启用结果:", res); + let ret = KeepAliveModule.getCurrentLocation(); + console.log("启用结果2:", ret); + }); + // #endif + // uni.redirectTo({ + // url: '/views/app/app-home/app-home' + // }) + uni.reLaunch({ + url: '/pages/home/supplier-home' + }) + } else { + // this.$message.showToast('登录失败') + + } + return resp + } + + }, + loginSupplier: async function ({ + commit, + dispatch, + state + }, data) { + { + const resp = await http.request('post', '/api/login/supplier' + ((data + .phoneNumber || data.tel) ? '/phone' : ''), { + data: { + username: (data.phoneNumber || data.tel) ? (data.phoneNumber || + data.tel) : data.username, + password: data.password, + tel: data.phoneNumber || data.tel, + smsCode: data.smsCode || '' + }, + params: { + clientType: data.clientType || 'app' + } + }) + console.log('resp', resp) + if (resp && resp.code == 0) { + // await getCurrentInfo() + // // this.$message.showToast('登录成功') + // console.log(resp) + storage.setItem('token', resp.data.access_token) + commit("updateLogin", true) + await dispatch('getCurrentInfo') + + console.log('login,reLaunch') + // #ifdef APP + var KeepAliveModule = uni.requireNativePlugin("yh-nl") //保活组件 + + KeepAliveModule && KeepAliveModule.startLocation({ + intervalTime: 5000, //定位间隔时间 + gaodeApiKey: "0eef1axxxxxx7964", //高德地图Key,已停用,引入插件配置 + locationMode: 1, //定位模式 + purpose: 0, //定位场景 + ifUpload: true, //是否上报服务器 + uploadUrl: "http://bio51-api.fixbug.fun/api/current/employee/location", //上报接口 + params: "{'lat':'1','lng':'3'}", //其他参数 + headers: "{'authorization1':'Bearer xOHeJhg'}", + }, function (res) { + console.log("启用结果:", res); + let ret = KeepAliveModule.getCurrentLocation(); + console.log("启用结果2:", ret); + }); + // #endif + // uni.redirectTo({ + // url: '/views/app/app-home/app-home' + // }) + uni.reLaunch({ + url: '/pages/home/supplier-home' + }) + } else { + // this.$message.showToast('登录失败') + + } + return resp + } + + }, + + loginCustomer: async function ({ + commit, + dispatch, + state + }, data) { + { + const resp = await http.request('post', '/api/login/customer' + (data + .phoneNumber ? '/phone' : ''), { + data: { + username: (data.phoneNumber || data.tel) ? (data.phoneNumber || + data.tel) : data.username, + password: data.password, + tel: data.phoneNumber || data.tel, + smsCode: data.smsCode || '' + }, + params: { + clientType: data.clientType || 'app' + } + }) + console.log('resp', resp) + if (resp && resp.code == 0) { + storage.setItem('token', resp.data.access_token) + commit("updateLogin", true) + await dispatch('getCurrentInfo') + uni.reLaunch({ + url: '/pages/home/home' + }) + } else { - } else { + } + return resp + } - } - return resp - } + }, + submitShopping: async function ({commit, dispatch}, data) { + const resp = await http.request('post', '/api/api/customer/flower/cart/change-num', { + data: { + id: data.id, + num: 1 + } + } + ) + if (resp && resp.code === 0) { + message.showToast('添加购物车成功') + dispatch('sign_add', 'shopping') + } else { - }, - loginPartner: async function({ - commit, - dispatch, - state - }, data) { - { - const resp = await http.request('post', '/api/login/partner' + ((data - .phoneNumber || data.tel) ? '/phone' : ''), { - data: { - username: (data.phoneNumber || data.tel) ? (data.phoneNumber || - data.tel) : data.username, - password: data.password, - tel: data.phoneNumber || data.tel, - smsCode: data.smsCode || '' - }, - params: { - clientType: data.clientType || 'app' - } - }) - console.log('resp', resp) - if (resp && resp.code == 0) { - // await getCurrentInfo() - // // this.$message.showToast('登录成功') - // console.log(resp) - storage.setItem('token', resp.data.access_token) - commit("updateLogin", true) - await dispatch('getCurrentInfo') + } + return resp + }, - console.log('login,reLaunch') - // #ifdef APP - var KeepAliveModule = uni.requireNativePlugin("yh-nl") //保活组件 + } +}) - KeepAliveModule && KeepAliveModule.startLocation({ - intervalTime: 5000, //定位间隔时间 - gaodeApiKey: "0eef1axxxxxx7964", //高德地图Key,已停用,引入插件配置 - locationMode: 1, //定位模式 - purpose: 0, //定位场景 - ifUpload: true, //是否上报服务器 - uploadUrl: "http://bio51-api.fixbug.fun/api/current/employee/location", //上报接口 - params: "{'lat':'1','lng':'3'}", //其他参数 - headers: "{'authorization1':'Bearer xOHeJhg'}", - }, function(res) { - console.log("启用结果:", res); - let ret = KeepAliveModule.getCurrentLocation(); - console.log("启用结果2:", ret); - }); - // #endif - // uni.redirectTo({ - // url: '/views/app/app-home/app-home' - // }) - uni.reLaunch({ - url: '/pages/home/supplier-home' - }) - } else { - // this.$message.showToast('登录失败') - - } - return resp - } - - }, - loginSupplier: async function({ - commit, - dispatch, - state - }, data) { - { - const resp = await http.request('post', '/api/login/supplier' + ((data - .phoneNumber || data.tel) ? '/phone' : ''), { - data: { - username: (data.phoneNumber || data.tel) ? (data.phoneNumber || - data.tel) : data.username, - password: data.password, - tel: data.phoneNumber || data.tel, - smsCode: data.smsCode || '' - }, - params: { - clientType: data.clientType || 'app' - } - }) - console.log('resp', resp) - if (resp && resp.code == 0) { - // await getCurrentInfo() - // // this.$message.showToast('登录成功') - // console.log(resp) - storage.setItem('token', resp.data.access_token) - commit("updateLogin", true) - await dispatch('getCurrentInfo') - - console.log('login,reLaunch') - // #ifdef APP - var KeepAliveModule = uni.requireNativePlugin("yh-nl") //保活组件 - - KeepAliveModule && KeepAliveModule.startLocation({ - intervalTime: 5000, //定位间隔时间 - gaodeApiKey: "0eef1axxxxxx7964", //高德地图Key,已停用,引入插件配置 - locationMode: 1, //定位模式 - purpose: 0, //定位场景 - ifUpload: true, //是否上报服务器 - uploadUrl: "http://bio51-api.fixbug.fun/api/current/employee/location", //上报接口 - params: "{'lat':'1','lng':'3'}", //其他参数 - headers: "{'authorization1':'Bearer xOHeJhg'}", - }, function(res) { - console.log("启用结果:", res); - let ret = KeepAliveModule.getCurrentLocation(); - console.log("启用结果2:", ret); - }); - // #endif - // uni.redirectTo({ - // url: '/views/app/app-home/app-home' - // }) - uni.reLaunch({ - url: '/pages/home/supplier-home' - }) - } else { - // this.$message.showToast('登录失败') - - } - return resp - } - - }, - - loginCustomer: async function({ - commit, - dispatch, - state - }, data) { - { - const resp = await http.request('post', '/api/login/customer' + (data - .phoneNumber ? '/phone' : ''), { - data: { - username: (data.phoneNumber || data.tel) ? (data.phoneNumber || - data.tel) : data.username, - password: data.password, - tel: data.phoneNumber || data.tel, - smsCode: data.smsCode || '' - }, - params: { - clientType: data.clientType || 'app' - } - }) - console.log('resp', resp) - if (resp && resp.code == 0) { - storage.setItem('token', resp.data.access_token) - commit("updateLogin", true) - await dispatch('getCurrentInfo') - uni.reLaunch({ - url: '/pages/home/home' - }) - } else { - - - } - return resp - } - - }, - - } - }) - - export default store \ No newline at end of file +export default store \ No newline at end of file diff --git a/sub_pages/customer/self/collect.vue b/sub_pages/customer/self/collect.vue new file mode 100644 index 0000000..3d40b8e --- /dev/null +++ b/sub_pages/customer/self/collect.vue @@ -0,0 +1,150 @@ +<template> + <view class="page-collect"> + <view class="search-container m-t-12 flex"> + <view class="flex1 input"> + <u-input placeholder="请输入花名" v-model="query.name"> + <template slot="suffix"> + <uni-icons color="#20613D" type="search" size="24" @tap="refreshList"></uni-icons> + </template> + </u-input> + </view> + </view> + <view class="component-filter-container"> + <view class="flex1"> + 排序 + <image src="../../../static/common/icon-arrow-down.png" class="icon-arrow-down"></image> + </view> + <view class="flex1"> + {{ this.query.levelStr || '级别' }} + <image src="../../../static/common/icon-arrow-down.png" class="icon-arrow-down" + @click="level_show=true"></image> + </view> + </view> + + <u-picker :show="level_show" @confirm="select_level" keyName="label" :columns="level_columns" + @cancel="level_show=false"></u-picker> + <u-picker :show="order_show" @confirm="select_order" keyName="label" :columns="order_columns" + @cancel="order_show=false"></u-picker> + + <view class="trade-list-container"> + <view class="trade-info-container" v-for="(dto,index) of list" :key="index"> + <view class="title"> + <view class="level m-r-15">{{dto.levelStr || '-'}}级</view> + <view class=""> + {{dto.name || '-'}} + </view> + </view> + <view class="desc m-t-12"> + <view class="m-r-15">已售:{{ dto.sales || 0}}</view> + <view class="m-r-15">剩余:{{dto.stock || 0}}</view> + <view class=" ">{{dto.unit||'-'}}支/扎</view> + </view> + <view class="flex m-t-12"> + <view class="price m-r-a"> + <span class="num">{{dto.price||'-'}}</span> + 元/扎 + </view> + <view class="m-l-a m-r-15"> + <image src="../../../static/common/icon-kf.png" class="icon-kf m-l-15 img100"></image> + + </view> + <view class="m-r-0 gwc" @click="submitShopping(dto)"> + + 购物车 + </view> + </view> + </view> + + </view> + </view> +</template> + +<script> +export default { + async onPullDownRefresh() { + await this.refreshList() + uni.stopPullDownRefresh() + }, + data() { + return { + query: { + name: '', + levelStr: '', + level: '', + column:'', + columnStr:'', + }, + level_show: false, + level_columns: [[]], + + order_show:false, + order_columns:[[]] + } + }, + onLoad() { + this.listApi = '/api/collect/list' + this.$http.request('get', '/api/code/value', { + params: { + type: 'FLOWER_LEVEL' + } + }).then(res => { + var data = res.data + this.level_columns = [data || []] + this.columns_levels[0].unshift({ + label: '全部', + value: '' + }) + }) + + this.$http.request('get', '/api/code/value', { + params: { + type: 'FLOWER_ORDER_BY' + } + }).then(res => { + var data = res.data + this.order_columns = [data || []] + this.order_columns[0].unshift({ + label: '默认', + value: '' + }) + }) + }, + methods: { + select_level(e) { + this.level_show = false + this.query.levelStr = e.value[0].label + this.query.level = e.value[0].value + }, + select_order(e) { + this.order_show = false + this.query.columnStr = e.value[0].label + this.query.column = e.value[0].value + }, + } +} +</script> + +<style lang="scss" scoped> +.page-collect { + .search-container { + display: flex; + margin: 12rpx 0rpx 20rpx 0rpx; + position: relative; + z-index: 1; + + .input { + background-color: #fff !important; + border-radius: 8rpx; + } + + .button { + min-width: 120rpx; + max-width: 120rpx; + margin-left: auto; + margin-right: 0rpx; + text-align: right; + line-height: 70rpx !important; + } + } +} + +</style> diff --git a/sub_pages/customer/self/follow.vue b/sub_pages/customer/self/follow.vue new file mode 100644 index 0000000..22a77f8 --- /dev/null +++ b/sub_pages/customer/self/follow.vue @@ -0,0 +1,29 @@ +<template> + <view> + + </view> +</template> + +<script> + export default { + data() { + return { + + } + }, + async onPullDownRefresh() { + await this.refreshList() + uni.stopPullDownRefresh() + }, + onLoad(){ + this.listApi = '/api/follow/list' + }, + methods: { + + } + } +</script> + +<style> + +</style> diff --git a/sub_pages/customer/shopping/confirm.vue b/sub_pages/customer/shopping/confirm.vue new file mode 100644 index 0000000..3f9eb68 --- /dev/null +++ b/sub_pages/customer/shopping/confirm.vue @@ -0,0 +1,103 @@ +<script> +import { + mapState +} from 'vuex' + +export default { + name: "订单详情", + computed: { + ...mapState({ + address: state => { + return state.defaultaddress || {} + }, + }), + }, + watch: { + // address(nv, ov) { + // if (nv && nv.id) { + // //尝试更新一下 + // + // } + // } + }, + async onShow() { + setTimeout(async () => { + if (this.address && this.address.id && this.cacheAddressId !== this.address.id) { + this.$message.showLoading() + const {code, data} = await this.$http.request('get', '/api/flower/customer/order/confirm/transports', { + data: { + addressId: this.address.id, + weight: this.dto.totalWeight || 0 + } + }) + this.$message.hideLoading() + this.transportList = [] + if (code === 0) { + this.transportList = data || [] + } + } + }, 200) + }, + onLoad(options) { + let item = JSON.parse(decodeURIComponent(options.query.dto)); + this.dto = { + ...this.dto, + ...item + } + //先获取直接的全部地址 + // @ApiModelProperty(value = "订单商品") + // private List<FlowerCartListDTO> flowers; + // @ApiModelProperty(value = "打包费") + // private BigDecimal packing; + //todo 显示打包费等,然后再确认 + // https://lanhuapp.com/web/#/item/project/detailDetach?pid=05830e81-7c59-4655-8253-4deb7c913b51&project_id=05830e81-7c59-4655-8253-4deb7c913b51&image_id=f7cc3e57-5367-4b99-a84e-99c38249aa66&fromEditor=true + + }, + data() { + return { + dto: {}, + cacheAddressId: '', + transportList: [], + // private Long id; + // @ApiModelProperty(value = "名称") + // private String name; + // @ApiModelProperty(value = "英文名") + // private String enName; + // @ApiModelProperty(value = "运费") + // private BigDecimal fee; + } + } +} +</script> + +<template> + <view class="page-confirm"> + <view> + <common-address-select ref="addressselect"></common-address-select> + </view> + <view> +<!-- todo 查看商品列表,和选择运费 --> + </view> + <view class="bottom-price flex"> + <view> + 合计:¥ {{ dto.totalAmount||0 }} 元 + </view> + <view class="button-green-1"> + 提交订单 + </view> + </view> + </view> +</template> + +<style scoped lang="scss"> +.page-confirm{ + + .bottom-price { + position: fixed; + left: 0rpx; + padding: 20rpx; + right: 0rpx; + bottom: 160rpx; + } +} +</style> \ No newline at end of file diff --git a/sub_pages/customer/shopping/shopping.vue b/sub_pages/customer/shopping/shopping.vue index 63c4619..54ca191 100644 --- a/sub_pages/customer/shopping/shopping.vue +++ b/sub_pages/customer/shopping/shopping.vue @@ -1,25 +1,352 @@ <template> - <view> - - <view style="min-height:200rpx"> - </view> - <common-footer flg="2"></common-footer> - </view> + <view class="shopping-container"> + <view class="top-title"> 苏州市一价全含,市区内包邮派送到店 + </view> + <view class="top-desc"> + 全程鲜花冷链专线,时效快,损耗小 + </view> + <view class="flex"> + <image class="icon-clock m-r-6" src="../../../static/common/icon-call.png"></image> + <view class="name"> + 客服电话 : <span class="topic-gray">{{ tel }}</span> + </view> + </view> + <view class=""> + <no-data v-if="!list||list.length===0" style="width: 100%;"></no-data> + <view class="shopping-item m-t-20" v-for="(item,index) of list" :key="index"> + <u-swipe-action> + <u-swipe-action-item + :options="options1" + @click="(e)=>{clickSwipeButton(item)}" + > + <view class="sup-title"> + <radio :checked="ids.indexOf(item.id)>=0" @change="changeItem(item,'supplier')">></radio> + {{ item.supplierName || '-' }} + </view> + <u-divider></u-divider> + <view v-for="(dto,j) of item.flowerList" :key="j"> + <u-divider v-if="j>0"></u-divider> + <view class="item-each flex"> + <radio :checked="ids.indexOf(dto.id)>=0" @change="changeItem(dto,'flower')"></radio> + <image class="img img100 m-r-6" :src="dto.url||dto.cover"></image> + <view> + <view class="title"><span>{{ dto.levelStr || '-' }}</span> {{ dto.name || '-' }}</view> + <view class="price"> + {{ dto.price || '-' }}元/扎 + </view> + <view class="desc m-t-12"> + <view class="m-r-15">剩余:{{ dto.stock || 0 }}</view> + </view> + <view class="button-icons flex"> + <uni-icons v-if="dto.num&&dto.num>=1" type="minus" size="32" + @click="addnum(dto,-1)"></uni-icons> + <view class="curnums" v-if="dto.num&&dto.num>=1">{{ dto.num }}</view> + <uni-icons type="plus-filled" size="32" @click="addnum(dto,1)"></uni-icons> + </view> + </view> + </view> + </view> + </u-swipe-action-item> + </u-swipe-action> + </view> + + </view> + <view style="min-height:200rpx"> + </view> + <view class="bottom-price flex"> + <view> + <radio :checked="checkall" @change="selectAll"></radio> + 全选 + </view> + <view> + 合计:¥ {{ totalprice }} 元 + </view> + <view class="button-green-1"> + 提交订单 + </view> + </view> + <view style="min-height:200rpx"> + </view> + <common-footer flg="2"></common-footer> + </view> </template> <script> - export default { - data() { - return { - - } - }, - methods: { - - } - } +import http from "../../../plugins/http"; + +export default { + data() { + return { + tel: '15974805814', + ids: [], + checkall: false, + options1: [{ + text: '删除' + }] + } + }, + onShow() { + if (this.sign['shopping']) { + this.init() + } + }, + onLoad() { + this.init() + }, + computed: { + totalprice() { + + let totalprice = 0 + this.list.forEach(dto => { + dto.flowerList.forEach(item => { + if (this.ids.indexOf(item.id) >= 0) { + totalprice += item.price * item.num + } + }) + }) + return totalprice.toFixed(2) + }, + methods: { + async submitPay() { + // order/confirm/info + var arr = [] + for (var j = 0; j < this.list.flowerList; j++) { + + if (this.ids.indexOf(this.list.flowerList[j].id) >= 0) { + arr.push({ + id: this.list.flowerList[j].id, + num: this.list.flowerList[j].num + }) + } + } + if (this.arr.length < 1) { + return + } + this.$message.showLoading() + const {code, data} = await http.request('post', '/api/api/customer/order/confirm/info', { + data: { + flowers: arr, + } + } + ) + this.$message.hideLoading() + if (code === 0) { + uni.navigateTo({ + url: '/sub_pages/customer/shopping/confirm?dto=' + +encodeURIComponent(JSON.stringify(data)) + }) + } + }, + async clickSwipeButton(item) { + //删除商品,重新加载数据? + + this.$message.showLoading() + const {code} = await http.request('post', '/api/api/customer/flower/cart/change-num', { + data: { + id: dto.id, + num: addnum + } + } + ) + this.$message.hideLoading() + if (code === 0) { + if (this.ids.indexOf(item.id) >= 0) { + this.ids.splice(this.ids.indexOf(item.id), 1) + } + for (var i = 0; i < this.list.length; i++) { + if (this.list[i].id === dto.supplierId) { + this.list[i].splice(i, 1) + if (this.list.flowerList.length === 1) { + if (this.ids.indexOf(this.list[i].id) >= 0) { + this.ids.splice(this.ids.indexOf(this.list[i].id), 1) + } + this.list[i].flowerList.splice(0, 1) + this.list.splice(i, 1) + } else { + //只需要清楚这个元素 + var k = -1 + for (var j = 0; j < this.list[i].flowerList.length; j++) { + if (this.list[i][j].id === item.id) { + k = j; + break + } + } + this.list[i].flowerList.splice(k, 1) + } + break + } + } + } + } + }, + selectAll() { + if (this.checkall) { + this.ids = [] + this.checkall = false + } else { + list.for(dto => { + if (this.ids.indexOf(dto.id) < 0) { + this.ids.push(dto.id) + } + dto.flowerList.forEach(item => { + if (this.ids.indexOf(item.id) < 0) { + this.ids.push(item.id) + } + }) + }) + } + }, + changeItem(dto, type) { + if (type === 'supplier') { + //全选上 + if (this.ids.indexOf(dto.id) < 0) { + this.ids.push(dto.id) + dto.flowerList.forEach(item => { + if (this.ids.indexOf(item.id) < 0) { + this.ids.push(item.id) + } + }) + } else { + this.checkall = false + this.ids.splice(this.ids.indexOf(dto.id), 1) + dto.flowerList.forEach(item => { + this.ids.splice(this.ids.indexOf(item.id), 1) + }) + } + + } else { + //更换个人的 + if (this.ids.indexOf(dto.id) < 0) { + this.ids.push(dto.id) + } else { + this.checkall = false + + if (this.ids.indexOf(dto.supplierId) >= 0) { + this.ids.splice(this.ids.indexOf(dto.supplierId), 1) + } + } + + } + }, + async addnum(dto, addnum) { + if (dto.num + addnum >= 0) { + + } else { + return + } + this.$message.showLoading() + const {code} = await http.request('post', '/api/api/customer/flower/cart/change-num', { + data: { + id: dto.id, + num: addnum + } + } + ) + this.$message.hideLoading() + if (code === 0) { + dto.num += addnum + } + }, + async init() { + this.$message.showLoading() + await this.$store.dispatch('sign_clear', 'shopping'); + const {code, data} = await this.$http.request('get', '/api/customer/flower/cart/list', {}) + this.$message.hideLoading() + this.list = [] + if (code === 0) { + this.list = data.list || [] + + } + } + } +} </script> -<style> +<style lang="scss" scoped> +.shopping-container { + background-color: rgba(255, 255, 255, 0.4); + padding: 20rpx 30rpx; + .bottom-price { + position: fixed; + left: 0rpx; + padding: 20rpx; + right: 0rpx; + bottom: 160rpx; + } + + .shopping-item { + padding: 28rpx 22rpx; + position: relative; + + .sup-title { + + } + + .item-each { + padding-left: 88rpx; + + .img { + width: 124rpx; + height: 124rpx; + } + + .title { + font-weight: 600; + font-size: 28rpx; + + color: #000000; + line-height: 40rpx; + + .level { + color: #20613D; + } + } + + .price { + font-weight: 400; + font-size: 28rpx; + color: #CF0000; + line-height: 40rpx; + } + + .desc { + font-weight: 400; + font-size: 24rpx; + color: #666666; + line-height: 34rpx; + } + } + + .button-icons { + position: absolute; + } + } + + .top-title { + font-size: 28rpx; + color: #000000; + line-height: 40rpx; + } + + .top-desc { + font-size: 24rpx; + color: #666666; + line-height: 34rpx; + } + + .top-kf { + background: linear-gradient(270deg, rgba(219, 244, 229, 0) 0%, #D5ECDE 100%); + border-radius: 8rpx; + font-weight: 400; + font-size: 24rpx; + color: #20613D; + line-height: 52rpx; + height: 52rpx; + padding-left: 26rpx; + + .icon-clock { + margin-top: 9rpx; + } + } +} </style> diff --git a/sub_pages/customer/trade/detail.vue b/sub_pages/customer/trade/detail.vue index f1330a8..5575bf8 100644 --- a/sub_pages/customer/trade/detail.vue +++ b/sub_pages/customer/trade/detail.vue @@ -1,345 +1,368 @@ <template> - <view class="trade-detail"> - <view class="top-img-container"> - <image src="" class="top-img"></image> - <view class="icon-container"> - <image src="../../../static/common/icon-sc.png" class="icon-sc"></image> - <view class="num">12</view> - </view> - <view class="icon-container"> - <image src="../../../static/common/icon-shop.png" class="icon-shop"></image> + <view class="trade-detail"> + <view class="top-img-container"> + <image :src="dto.cover" class="top-img"></image> + <view class="icon-container"> + <image src="../../../static/common/icon-sc.png" class="icon-sc"></image> + <view class="num">12</view> + </view> + <view class="icon-container"> + <image src="../../../static/common/icon-shop.png" class="icon-shop"></image> - </view> - </view> - <view class="info-container"> - <view class="title"> - <view class="level m-r-15">B级</view> - <view class=""> - {{dto.name || '-'}} - </view> - </view> - <view class="desc m-t-12"> - <view class="m-r-15">已售:7</view> - <view class="m-r-15">剩余:13</view> - <view class=" ">10支/扎</view> - </view> - <view class="flex m-t-12"> - <view class="price m-r-a"> - <span class="num">28.01</span> - 元/扎 - </view> - <view class="m-l-a m-r-15"> - <image src="../../../static/common/icon-kf.png" class="icon-kf m-l-15 img100"></image> + </view> + </view> + <view class="trade-info-container"> + <view class="title"> + <view class="level m-r-15">{{ dto.levelStr || '-' }}级</view> + <view class=""> + {{ dto.name || '-' }} + </view> + </view> + <view class="desc m-t-12"> + <view class="m-r-15">已售:{{ dto.sales || 0 }}</view> + <view class="m-r-15">剩余:{{ dto.stock || 0 }}</view> + <view class=" ">{{ dto.unit || '-' }}支/扎</view> + </view> + <view class="flex m-t-12"> + <view class="price m-r-a"> + <span class="num">{{ dto.price || '-' }}</span> + 元/扎 + </view> + <view class="m-l-a m-r-15"> + <image src="../../../static/common/icon-kf.png" class="icon-kf m-l-15 img100"></image> - </view> - <view class="m-r-0 gwc"> - + 购物车 - </view> - </view> - </view> - <view class="line"> + </view> + <view class="m-r-0 gwc" @click="submitShopping(dto)"> + + 购物车 + </view> + </view> + </view> + <view class="line"> - </view> - <view class="info-detail"> - <view class="title-before-blue" style="padding-top: 0rpx;padding-bottom: 0rpx;">详情</view> - <view class="flex m-t-8"> - <view class="label">枝长:</view> - <view class="value">70-75cm</view> - </view> - <view class="flex m-t-8"> - <view class="label">枝粗:</view> - <view class="value">中等粗细</view> - </view> - <view class="flex m-t-8"> - <view class="label">均匀度:</view> - <view class="value">1-2支不均匀</view> - </view> - </view> - <view class="line"> + </view> + <view class="info-detail" v-if="dto.params"> + <view class="title-before-blue" style="padding-top: 0rpx;padding-bottom: 0rpx;">详情</view> + <view class="flex m-t-8" v-for="(param,index) of dto.params" :key="index"> + <view class="label">{{ param.name}}:</view> + <view class="value">{{ param.value || '-'}}</view> + </view> +<!-- <view class="flex m-t-8">--> +<!-- <view class="label">枝粗:</view>--> +<!-- <view class="value">中等粗细</view>--> +<!-- </view>--> +<!-- <view class="flex m-t-8">--> +<!-- <view class="label">均匀度:</view>--> +<!-- <view class="value">1-2支不均匀</view>--> +<!-- </view>--> + </view> + <view class="line"> - </view> + </view> - <view class="info-brand m-t-12" @click.stop="openbrand"> - <view class="title-before-blue" style="padding-top: 0rpx;padding-bottom: 0rpx;">店铺</view> - <view class="flex"> - <image class="store-logo"></image> - <view> - <view class="store-name">花仙子</view> - <view class="store-address">云南省-昆明市-官渡区</view> - </view> - <view class="store-to m-l-a m-r-0">进入店铺</view> - </view> - </view> - <view class="m-t-20 shop-recommend-container"> - <view class="shop-recommend-title">店铺推荐</view> - <view class="flex"> - <view v-for="i in 3" :key="i" class="shop-recommend"> - <image src="" class="shop-recommend-image"></image> - <view class="shop-recommend-title m-t-8"> - <view class="level m-r-15">B级</view> - <view class=""> - {{dto.name || '-'}} - </view> - </view> - <view class="shop-recommend-price m-t-8"> - ¥23.01/扎 - </view> - </view> - </view> - </view> - <view class="line"> + <view class="info-brand m-t-12" @click.stop="openbrand"> + <view class="title-before-blue" style="padding-top: 0rpx;padding-bottom: 0rpx;">店铺</view> + <view class="flex"> + <image class="store-logo"></image> + <view> + <view class="store-name">{{dto.supplierName||'-'}}</view> + <view class="store-address">{{dto.supplierStation||'-'}}</view> + </view> + <view class="store-to m-l-a m-r-0">进入店铺</view> + </view> + </view> + <view class="m-t-20 shop-recommend-container" v-if="false"> + <view class="shop-recommend-title">店铺推荐</view> + <view class="flex"> + <view v-for="i in 3" :key="i" class="shop-recommend"> + <image src="" class="shop-recommend-image"></image> + <view class="shop-recommend-title m-t-8"> + <view class="level m-r-15">B级</view> + <view class=""> + {{ dto.name || '-' }} + </view> + </view> + <view class="shop-recommend-price m-t-8"> + ¥23.01/扎 + </view> + </view> + </view> + </view> + <view class="line"> - </view> - <view class="comment-container m-t-12"> - <view class="title-before-blue" style="padding-top: 0rpx;padding-bottom: 0rpx;"> - <view>评价</view> - <view class="desc"> - 7条评论 - <uni-icons type="right" size="18" color="#B3B3B3"></uni-icons> + </view> + <view class="comment-container m-t-12" v-if="false"> + <view class="title-before-blue" style="padding-top: 0rpx;padding-bottom: 0rpx;"> + <view>评价</view> + <view class="desc"> + 7条评论 + <uni-icons type="right" size="18" color="#B3B3B3"></uni-icons> - </view> - </view> - <view v-for="i in 3" :key="i" class="m-t-20 flex user-item"> - <image class="user-icon m-r-10"></image> - <view> - <view class="name">用户名3370</view> - <view class="comment">非常棒,会回购</view> - </view> - <view class="stars"> + </view> + </view> + <view v-for="i in 3" :key="i" class="m-t-20 flex user-item"> + <image class="user-icon m-r-10"></image> + <view> + <view class="name">用户名3370</view> + <view class="comment">非常棒,会回购</view> + </view> + <view class="stars"> - </view> - <view class="date"> - 04-07 08:00 - </view> - </view> - </view> + </view> + <view class="date"> + 04-07 08:00 + </view> + </view> + </view> - </view> + </view> </template> <script> - export default { - data() { - return { - dto: { +export default { + data() { + return { + id: '', + dto: {} + } + }, + onLoad(options) { + this.id = options.id || '' + if (this.id) { + this.getDetail() + } + }, + methods: { + async getDetail() { + this.$message.showLoading() + const { + code, + data + } = await this.$http.request('get', '/api/customer/flower/list/view', { + params: { + id: this.id + } + }) + if (code === 0) { + this.dto = { + ...data, + } + } - } - } - }, - methods: { - openbrand() { - uni.navigateTo({ - url: '/sub_pages/customer/shop/shop?id=' + (this.dto.id || '') - }) - } - } - } + this.$message.hideLoading() + + }, + openbrand() { + uni.navigateTo({ + url: '/sub_pages/customer/shop/shop?id=' + (this.dto.id || '') + }) + } + } +} </script> <style lang="scss" scoped> - .trade-detail { - background-color: #FFFFFF; +.trade-detail { + background-color: #FFFFFF; - .info-container { - padding: 46rpx 30rpx; - border-radius: 40rpx 40rpx 0rpx 0rpx; + .trade-info-container { + padding: 46rpx 30rpx; + border-radius: 40rpx 40rpx 0rpx 0rpx; - .title { - font-weight: 600; - font-size: 36rpx; - color: #000000; - line-height: 50rpx; + .title { + font-weight: 600; + font-size: 36rpx; + color: #000000; + line-height: 50rpx; - .level { - color: #20613D; - } - } + .level { + color: #20613D; + } + } - .desc { - font-weight: 400; - font-size: 28rpx; - color: #666666; - line-height: 40rpx; - } + .desc { + font-weight: 400; + font-size: 28rpx; + color: #666666; + line-height: 40rpx; + } - .price { - font-weight: 600; - font-size: 28rpx; - color: #CF0000; - line-height: 40rpx; + .price { + font-weight: 600; + font-size: 28rpx; + color: #CF0000; + line-height: 40rpx; - .num { - font-size: 48rpx; - line-height: 66rpx; - } - } + .num { + font-size: 48rpx; + line-height: 66rpx; + } + } - .icon-kf { - width: 44rpx; - height: 44rpx; - } + .icon-kf { + width: 44rpx; + height: 44rpx; + } - .gwc { - width: 168rpx; - height: 48rpx; - border-radius: 30rpx; - border: 2rpx solid #20613D; - font-size: 24rpx; - color: #20613D; - line-height: 48rpx; - text-align: center; - } + .gwc { + width: 168rpx; + height: 48rpx; + border-radius: 30rpx; + border: 2rpx solid #20613D; + font-size: 24rpx; + color: #20613D; + line-height: 48rpx; + text-align: center; + } - } + } - .line { - min-height: 20rpx; - background: #F7F7F7; - } + .line { + min-height: 20rpx; + background: #F7F7F7; + } - .info-detail { - padding: 18rpx 30rpx; + .info-detail { + padding: 18rpx 30rpx; - .label { - font-weight: 400; - font-size: 28rpx; - color: #666666; - line-height: 40rpx; - min-width: 160rpx; - margin-right: 20rpx; - } + .label { + font-weight: 400; + font-size: 28rpx; + color: #666666; + line-height: 40rpx; + min-width: 160rpx; + margin-right: 20rpx; + } - .value { - font-weight: 400; - font-size: 28rpx; - color: #666666; - line-height: 40rpx; - } - } + .value { + font-weight: 400; + font-size: 28rpx; + color: #666666; + line-height: 40rpx; + } + } - .shop-recommend-title { - font-weight: 400; - font-size: 24rpx; - color: #666666; - line-height: 34rpx; - } + .shop-recommend-title { + font-weight: 400; + font-size: 24rpx; + color: #666666; + line-height: 34rpx; + } - .shop-recommend-container { - padding: 24rpx 30rpx; + .shop-recommend-container { + padding: 24rpx 30rpx; - .shop-recommend { - .shop-recommend-image { - width: 214rpx; - height: 214rpx; - background-size: 100% 100%; - border-radius: 8rpx; - } + .shop-recommend { + .shop-recommend-image { + width: 214rpx; + height: 214rpx; + background-size: 100% 100%; + border-radius: 8rpx; + } - .shop-recommend-title { - font-weight: 600; - font-size: 28rpx; - color: #000000; - line-height: 40rpx; + .shop-recommend-title { + font-weight: 600; + font-size: 28rpx; + color: #000000; + line-height: 40rpx; - .level { - color: #20613D; - ; - } - } - } - } + .level { + color: #20613D;; + } + } + } + } - .comment-container { - padding: 18rpx 30rpx; + .comment-container { + padding: 18rpx 30rpx; - .desc { - font-weight: 400; - font-size: 24rpx; - color: #666666; - line-height: 34rpx; - } + .desc { + font-weight: 400; + font-size: 24rpx; + color: #666666; + line-height: 34rpx; + } - .user-item { - .user-icon { - width: 72rpx; - height: 72rpx; - background-size: 100% 100%; - border-radius: 50%; - } + .user-item { + .user-icon { + width: 72rpx; + height: 72rpx; + background-size: 100% 100%; + border-radius: 50%; + } - .name { - font-weight: 600; - font-size: 24rpx; - color: #000000; - line-height: 34rpx; - } + .name { + font-weight: 600; + font-size: 24rpx; + color: #000000; + line-height: 34rpx; + } - .comment { - font-weight: 400; - font-size: 24rpx; - color: #666666; - line-height: 34rpx; - } + .comment { + font-weight: 400; + font-size: 24rpx; + color: #666666; + line-height: 34rpx; + } - .date { - font-weight: 400; - font-size: 24rpx; - color: #666666; - line-height: 72rpx; - } - } - } + .date { + font-weight: 400; + font-size: 24rpx; + color: #666666; + line-height: 72rpx; + } + } + } - .top-img-container { - position: relative; + .top-img-container { + position: relative; - .top-img { - width: 750rpx; - height: 764rpx; - } + .top-img { + width: 750rpx; + height: 764rpx; + } - .icon-container { - position: absolute; - top: 20rpx; - width: 80rpx; - height: 80rpx; - background: rgba(0, 0, 0, 0.42); + .icon-container { + position: absolute; + top: 20rpx; + width: 80rpx; + height: 80rpx; + background: rgba(0, 0, 0, 0.42); - .icon-sc { - width: 54rpx; - height: 54rpx; - margin: 0 auto; - margin-top: 12rpx; - } + .icon-sc { + width: 54rpx; + height: 54rpx; + margin: 0 auto; + margin-top: 12rpx; + } - .icon-shop { - width: 54rpx; - height: 54rpx; - margin: 0 auto; - margin-top: 12rpx; - } + .icon-shop { + width: 54rpx; + height: 54rpx; + margin: 0 auto; + margin-top: 12rpx; + } - .num { - font-weight: 400; - font-size: 20rpx; - color: #FFFFFF; - line-height: 28rpx; - position: absolute; - top: 6prx; - right: 16rpx; - } - } + .num { + font-weight: 400; + font-size: 20rpx; + color: #FFFFFF; + line-height: 28rpx; + position: absolute; + top: 6prx; + right: 16rpx; + } + } - .icon-container:last-child { - left: 120rpx; - } + .icon-container:last-child { + left: 120rpx; + } - .icon-container:first-child { - left: 20rpx; - } + .icon-container:first-child { + left: 20rpx; + } - } - } + } +} </style> \ No newline at end of file diff --git a/sub_pages/supplier/flower-manage/flower-add.vue b/sub_pages/supplier/flower-manage/flower-add.vue index b11bc26..5caa9c1 100644 --- a/sub_pages/supplier/flower-manage/flower-add.vue +++ b/sub_pages/supplier/flower-manage/flower-add.vue @@ -539,8 +539,8 @@ } var tmp = parseFloat(this.dto.price) if (isNaN(tmp) || parseFloat('' + tmp).toFixed(3) !== parseFloat('' + this.dto.price).toFixed(3)) { - this.$message.showToast('商品价格格式错误,精确到分') - console.log('a1', ('' + tmp) ) + this.$message.showToast('商品价格格式错误,精确到分') + console.log('a1', ('' + tmp) ) console.log('a1', ('' + this.dto.price)) return } -- Gitblit v1.9.3