From f2596c53a343ff93ee2161d0d21416ff1521d862 Mon Sep 17 00:00:00 2001 From: Aaron <578780649@qq.com> Date: Sun, 11 Jul 2021 18:06:22 +0800 Subject: [PATCH 01/16] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E9=83=A8=E5=88=86?= =?UTF-8?q?=E6=98=BE=E7=A4=BAbug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- components/CountDown.vue | 83 ++++++++++++++------------- components/ProductWindow.vue | 1 + pages/activity/GoodsSeckill/index.vue | 3 +- pages/activity/GroupDetails/index.vue | 36 +++++++----- pages/home/index.vue | 4 ++ pages/order/OrderSubmission/index.vue | 9 ++- pages/shop/GoodsList/index.vue | 17 +++--- pages/shop/ShoppingCart/index.vue | 4 ++ pages/user/User/index.vue | 12 ++-- 9 files changed, 98 insertions(+), 71 deletions(-) diff --git a/components/CountDown.vue b/components/CountDown.vue index cec9316..7bb8037 100644 --- a/components/CountDown.vue +++ b/components/CountDown.vue @@ -42,8 +42,9 @@ export default { default: true, }, }, - data: function() { + data() { return { + timeInterval: null, time: this.datatime, day: '00', hour: '00', @@ -51,7 +52,7 @@ export default { second: '00', } }, - created: function() { + created() { this.show_time() }, watch: { @@ -61,10 +62,11 @@ export default { this.show_time() }, }, - mounted: function() {}, + mounted() { + }, methods: { - show_time: function() { - let that = this + show_time() { + console.log(this.datatime) if (this.time.toString().length == 13) { // 毫秒级 console.log('毫秒') @@ -77,41 +79,44 @@ export default { console.log('时间') this.time = Date.parse(this.time) / 1000 } - - function runTime() { - //时间函数 - let intDiff = that.time - Date.parse(new Date()) / 1000 //获取数据中的时间戳的时间差; - let day = 0, - hour = 0, - minute = 0, - second = 0 - if (intDiff > 0) { - //转换时间 - if (that.isDay === true) { - day = Math.floor(intDiff / (60 * 60 * 24)) - } else { - day = 0 - } - hour = Math.floor(intDiff / (60 * 60)) - day * 24 - minute = Math.floor(intDiff / 60) - day * 24 * 60 - hour * 60 - second = Math.floor(intDiff) - day * 24 * 60 * 60 - hour * 60 * 60 - minute * 60 - if (hour <= 9) hour = '0' + hour - if (minute <= 9) minute = '0' + minute - if (second <= 9) second = '0' + second - that.day = day - that.hour = hour - that.minute = minute - that.second = second - } else { - that.day = '00' - that.hour = '00' - that.minute = '00' - that.second = '00' - } - } - runTime() - this.timeInterval = setInterval(runTime, 1000) + this.runTime() + this.timeInterval = setInterval(this.runTime, 1000) }, + runTime() { + //时间函数 + let intDiff = this.time - Date.parse(new Date()) / 1000 //获取数据中的时间戳的时间差 + console.log(intDiff) + let day = 0, + hour = 0, + minute = 0, + second = 0 + if (intDiff > 0) { + //转换时间 + if (this.isDay === true) { + day = Math.floor(intDiff / (60 * 60 * 24)) + } else { + day = 0 + } + hour = Math.floor(intDiff / (60 * 60)) - day * 24 + minute = Math.floor(intDiff / 60) - day * 24 * 60 - hour * 60 + second = Math.floor(intDiff) - day * 24 * 60 * 60 - hour * 60 * 60 - minute * 60 + if (hour <= 9) hour = '0' + hour + if (minute <= 9) minute = '0' + minute + if (second <= 9) second = '0' + second + this.day = day + this.hour = hour + this.minute = minute + this.second = second + } else { + this.day = '00' + this.hour = '00' + this.minute = '00' + this.second = '00' + } + } }, + destroyed() { + clearTimeout(this.timeInterval) + } } diff --git a/components/ProductWindow.vue b/components/ProductWindow.vue index 0dda009..3bdf3f6 100644 --- a/components/ProductWindow.vue +++ b/components/ProductWindow.vue @@ -83,6 +83,7 @@ export default { return {}; }, mounted: function () { + console.log(this.attr) console.log(this); }, watch: { diff --git a/pages/activity/GoodsSeckill/index.vue b/pages/activity/GoodsSeckill/index.vue index 60df6de..7652ea2 100644 --- a/pages/activity/GoodsSeckill/index.vue +++ b/pages/activity/GoodsSeckill/index.vue @@ -37,7 +37,7 @@ 距离{{ item.status == 1 ? '结束还剩' : '开始还有' }} - + @@ -163,6 +163,7 @@ export default { that.status = false that.active = index that.datatime = that.timeList[that.active].stop + console.log(new Date(that.datatime)) this.seckillList = [] that.getSeckillList() }, diff --git a/pages/activity/GroupDetails/index.vue b/pages/activity/GroupDetails/index.vue index 5cfd5c1..cac09b4 100644 --- a/pages/activity/GroupDetails/index.vue +++ b/pages/activity/GroupDetails/index.vue @@ -260,7 +260,7 @@ export default { }, methods: { formatPrice(price, index) { - console.log(price) + // console.log(price) if (price) { return price.split('.')[index] } @@ -284,15 +284,6 @@ export default { }, } }, - openAlone: function() { - this.$yrouter.push({ - path: '/pages/shop/GoodsCon/index', - query: { - id: this.storeInfo.productId, - }, - }) - // this.$yrouter.replace({ path: "/detail/" + this.storeInfo.productId }); - }, //收藏商品 setCollect: function() { let that = this, @@ -452,24 +443,41 @@ export default { this.$set(this, 'attrTxt', '请选择') } }, - + // 单独购买 + openAlone: function() { + this.$yrouter.push({ + path: '/pages/shop/GoodsCon/index', + query: { + id: this.storeInfo.productId, + }, + }) + // this.$yrouter.replace({ path: "/detail/" + this.storeInfo.productId }); + }, + // 发起拼团 openTeam: function() { var that = this - if (that.attr.cartAttr == false) { + console.log(this.attr) + if (that.attr.cartAttr == false) { // 展示弹框 + console.log(this.attr.cartAttr) that.attr.cartAttr = !this.attr.cartAttr - } else { + // 设置拼团价格 + that.attr.productSelect.price = this.storeInfo.price + } else { // 已有弹框——初始化商品信息,下单请求 var data = {} data.productId = that.storeInfo.productId + data.price = that.storeInfo.price data.cartNum = that.attr.productSelect.cart_num data.uniqueId = that.attr.productSelect.unique data.combinationId = that.storeInfo.id data.new = 1 + console.log(data) postCartAdd(data) .then(res => { that.$yrouter.push({ path: '/pages/order/OrderSubmission/index', query: { - id: res.data.cartId, + // id: res.data.cartId, + pinkId: res.data.cartId, }, }) }) diff --git a/pages/home/index.vue b/pages/home/index.vue index c4647da..0d0525f 100644 --- a/pages/home/index.vue +++ b/pages/home/index.vue @@ -46,6 +46,10 @@ + + + PC + diff --git a/pages/user/PersonalData/index.vue b/pages/user/PersonalData/index.vue index 1ab834d..9444bb1 100644 --- a/pages/user/PersonalData/index.vue +++ b/pages/user/PersonalData/index.vue @@ -39,7 +39,8 @@ 手机号 - + + @@ -156,7 +157,6 @@ export default { }, chooseImage() { chooseImage((img) => { - console.log(img); this.avatar = img; }); }, diff --git a/pages/user/User/index.vue b/pages/user/User/index.vue index 31e5112..d3e9eb4 100644 --- a/pages/user/User/index.vue +++ b/pages/user/User/index.vue @@ -1,7 +1,11 @@ + + + diff --git a/pages/user/Login/index.vue b/pages/user/Login/index.vue index d81905b..8f4aebc 100644 --- a/pages/user/Login/index.vue +++ b/pages/user/Login/index.vue @@ -5,40 +5,50 @@ {{ item }} +
- + + v-model="account" required/> + + {{ clockText }} + - + - + + - + - + + + + + + - 登录 - 登录 + --> + + 手机号登录 + 登录 - 没有账号? + 第一次使用? 立即注册
@@ -124,22 +134,21 @@ mixins: [sendVerifyCode], data: function () { return { - navList: ["手机号登录"], + // navList: ["手机号登录", "密码登录"], + navList: ["手机号登录",], current: 0, account: "", password: "", captcha: "", inviteCode: "", formItem: 1, - type: "login" + type: "login", + timer: null, + clock: 60, + clockText: '获取验证码' }; }, methods: { - checkPhone(e) { - if (e.target.value.length === 11) { - console.log('手机号') - } - }, async loginMobile() { var that = this; const { @@ -166,16 +175,18 @@ return validatorDefaultCatch(e); } loginMobile({ - phone: that.account, + account: that.account, captcha: that.captcha, spread: cookie.get("spread") }) - .then(res => { + .then(res => { var data = res.data; that.$store.commit("login", data.token, dayjs(data.expires_time)); + that.$store.dispatch('userInfo', true) handleGetUserInfo(); }) .catch(err => { + console.log(err) uni.showToast({ title: err.msg || err.response.data.msg || err.response.data.message, icon: "none", @@ -183,157 +194,215 @@ }); }); }, - async register() { - var that = this; - const { - account, - captcha, - password - } = that; - try { - await that - .$validator({ - account: [ - required(required.message("手机号码")), - chs_phone(chs_phone.message()) - ], - captcha: [ - required(required.message("验证码")), - alpha_num(alpha_num.message("验证码")) - ], - password: [ - required(required.message("密码")), - attrs.range([6, 16], attrs.range.message("密码")), - alpha_num(alpha_num.message("密码")) - ] - }) - .validate({ - account, - captcha, - password - }); - } catch (e) { - return validatorDefaultCatch(e); - } - register({ - account: that.account, - captcha: that.captcha, - password: that.password, - inviteCode: that.inviteCode, - spread: cookie.get("spread") - }) - .then(res => { - uni.showToast({ - title: res.msg, - icon: "success", - duration: 2000 - }); - that.formItem = 1; - }) - .catch(err => { - uni.showToast({ - title: err.msg || err.response.data.msg || err.response.data.message, - icon: "none", - duration: 2000 - }); - }); - }, - // 获取验证码 - async code() { - var that = this; - const { - account - } = that; - try { - await that - .$validator({ - account: [ - required(required.message("手机号码")), - chs_phone(chs_phone.message()) - ] - }) - .validate({ - account - }); - } catch (e) { - return validatorDefaultCatch(e); - } - if (that.formItem == 2) that.type = "register"; - await registerVerify({ - phone: that.account, - type: that.type - }) - .then(res => { - uni.showToast({ - title: res.msg, - icon: "success", - duration: 2000 - }); - that.sendCode(); - }) - .catch(err => { - uni.showToast({ - title: err.msg || err.response.data.msg || err.response.data.message, - icon: "none", - duration: 2000 - }); - }); - }, - navTap: function (index) { - this.current = index; - }, - async submit() { - const { - account, - password - } = this; - try { - await this.$validator({ - account: [ - required(required.message("账号")), - attrs.range([5, 16], attrs.range.message("账号")), - alpha_num(alpha_num.message("账号")) - ], - password: [ - required(required.message("密码")), - attrs.range([6, 16], attrs.range.message("密码")), - alpha_num(alpha_num.message("密码")) - ] - }).validate({ - account, - password - }); - } catch (e) { - return validatorDefaultCatch(e); - } - - login({ - username: account, - password, - spread: cookie.get("spread") - }) - .then(({ - data - }) => { - this.$store.commit("login", data.token, dayjs(data.expires_time)); - handleGetUserInfo(); - // let replace=this.$yroute.query.replace - // if(replace){ + async register() { + var that = this; + const { + account, + captcha, + password + } = that; + try { + await that + .$validator({ + account: [ + required(required.message("手机号码")), + chs_phone(chs_phone.message()) + ], + captcha: [ + required(required.message("验证码")), + alpha_num(alpha_num.message("验证码")) + ], + password: [ + required(required.message("密码")), + attrs.range([6, 16], attrs.range.message("密码")), + alpha_num(alpha_num.message("密码")) + ] + }) + .validate({ + account, + captcha, + password + }); + } catch (e) { + return validatorDefaultCatch(e); + } + register({ + account: that.account, + captcha: that.captcha, + password: that.password, + inviteCode: that.inviteCode, + spread: cookie.get("spread") + }) + .then(res => { + uni.showToast({ + title: res.msg, + icon: "success", + duration: 2000 + }); + that.formItem = 1; + }) + .catch(err => { + uni.showToast({ + title: err.msg || err.response.data.msg || err.response.data.message, + icon: "none", + duration: 2000 + }); + }); + }, + // 获取验证码 + async code() { + const { + account + } = this; + try { + await this + .$validator({ + account: [ + required(required.message("手机号码")), + chs_phone(chs_phone.message()) + ] + }) + .validate({ + account + }); + } catch (e) { + return validatorDefaultCatch(e); + } + if (this.formItem == 2) this.type = "register"; + this.showCode() + }, + // 手机号登录获取验证码 + async sendCode () { + const { + account + } = this; + try { + await this + .$validator({ + account: [ + required(required.message("手机号码")), + chs_phone(chs_phone.message()) + ] + }) + .validate({ + account + }); + } catch (e) { + return validatorDefaultCatch(e); + } + // 倒计时 + if (this.clock !== 60) { + return + } + this.clock-- + this.clockText = `${this.clock} 秒` + this.timer = setInterval(() => { + if (parseInt(this.clock) === 1) { + clearTimeout(this.timer) + this.clock = 60 + this.clockText = '获取验证码' + return + } + this.clock-- + if (this.clock < 10) this.clock = `0${this.clock}` + this.clockText = `${this.clock} 秒` + }, 1000) + this.showCode() + }, + // 验证码请求 + showCode() { + return registerVerify({ + phone: this.account, + type: this.type + }) + .then(res => { + uni.showToast({ + title: res.msg, + icon: "success", + duration: 2000 + }); + this.sendCode(); + }) + .catch(err => { + uni.showToast({ + title: err.msg || err.response.data.msg || err.response.data.message, + icon: "none", + duration: 2000 + }); + }); + }, + navTap(index) { this.current = index; }, + async submit() { + const { + account, + password + } = this; + try { + await this.$validator({ + account: [ + required(required.message("账号")), + attrs.range([5, 16], attrs.range.message("账号")), + alpha_num(alpha_num.message("账号")) + ], + password: [ + required(required.message("密码")), + attrs.range([6, 16], attrs.range.message("密码")), + alpha_num(alpha_num.message("密码")) + ] + }).validate({ + account, + password + }); + } catch (e) { + return validatorDefaultCatch(e); + } + // 账号密码登录 + login({ + username: account, + password, + spread: cookie.get("spread") + }) + .then(({ + data + }) => { + this.$store.commit("login", data.token, dayjs(data.expires_time)); + handleGetUserInfo(); + // let replace=this.$yroute.query.replace + // if(replace){ - // } - // this.$yrouter.replace({ - // path: this.$yroute.query.replace || '/pages/home/index' - // }); - }) - .catch(err => { - console.log(err); - uni.showToast({ - title: err.msg || err.response.data.msg || err.response.data.message, - icon: "none", - duration: 2000 - }); - }); - } + // } + // this.$yrouter.replace({ + // path: this.$yroute.query.replace || '/pages/home/index' + // }); + }) + .catch(err => { + console.log(err); + uni.showToast({ + title: err.msg || err.response.data.msg || err.response.data.message, + icon: "none", + duration: 2000 + }); + }); + } } }; + + diff --git a/pages/user/PersonalData/index.vue b/pages/user/PersonalData/index.vue index 9444bb1..e976475 100644 --- a/pages/user/PersonalData/index.vue +++ b/pages/user/PersonalData/index.vue @@ -1,58 +1,56 @@ @@ -36,54 +36,56 @@ } }, methods: { - // 砍价海报 - getBargainPoster: function () { - var that = this; - let from = this.$deviceType - if (from == 'weixin' || this.$deviceType == 'weixinh5') { - from = 'uniappH5' - } - getBargainPoster({ - bargainId: that.id, - from - }) - .then(res => { - that.image = res.data.url; - that.status = false; - }) - .catch(res => { - uni.showToast({ - title: res.msg, - icon: "none", - duration: 2000 - }); - }); - }, - // 拼团海报 - getCombinationPoster: function () { - var that = this; - console.log(this.$deviceType) - let from = this.$deviceType - if (from == 'weixin' || this.$deviceType == 'weixinh5') { - from = 'uniappH5' - } - console.log(from) - getCombinationPoster({ - id: that.id, - from - }) - .then(res => { - that.image = res.data.url; - that.status = false; - }) - .catch(res => { - uni.showToast({ - title: res.msg, - icon: "none", - duration: 2000 - }); - }); - } + // 砍价海报 + getBargainPoster: function () { + var that = this; + let from = this.$deviceType + if (from == 'weixin' || this.$deviceType == 'weixinh5') { + from = 'uniappH5' + } + getBargainPoster({ + bargainId: that.id, + from + }) + .then(res => { + that.image = res.data.url; + that.status = false; + }) + .catch(res => { + uni.showToast({ + title: res.msg, + icon: "none", + duration: 2000 + }); + }); + }, + // 拼团海报 + getCombinationPoster: function () { + var that = this; + console.log(this.$deviceType) + let from = this.$deviceType + if (from == 'weixin' || this.$deviceType == 'weixinh5') { + from = 'uniappH5' + } + console.log(from) + getCombinationPoster({ + id: that.id, + from + }) + .then(res => { + that.image = res.data.url; + that.status = false; + }) + .catch(res => { + uni.showToast({ + title: res.msg, + icon: "none", + duration: 2000 + }); + }); + }, + // 长按保存图片 + longtap () {} } }; From 3a1ce61f9798fe61c84f91d65441a3680bd0497e Mon Sep 17 00:00:00 2001 From: Aaron <578780649@qq.com> Date: Wed, 21 Jul 2021 17:40:53 +0800 Subject: [PATCH 08/16] =?UTF-8?q?app=E5=9B=BE=E7=89=87=E9=95=BF=E6=8C=89?= =?UTF-8?q?=E4=BF=9D=E5=AD=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- manifest.json | 2 +- pages/activity/Poster/index.vue | 39 ++++++++++++++++++++++++++++----- pages/user/User/index.vue | 4 ++-- store/index.js | 1 + 4 files changed, 38 insertions(+), 8 deletions(-) diff --git a/manifest.json b/manifest.json index 7e9ffd5..9850897 100644 --- a/manifest.json +++ b/manifest.json @@ -131,7 +131,7 @@ "setting" : { "urlCheck" : true, "postcss" : true, - "minified" : false + "minified" : true }, "usingComponents" : true, "permission" : { diff --git a/pages/activity/Poster/index.vue b/pages/activity/Poster/index.vue index 866caa8..5689ca6 100644 --- a/pages/activity/Poster/index.vue +++ b/pages/activity/Poster/index.vue @@ -1,10 +1,17 @@ @@ -22,7 +29,8 @@ return { status: true, id: 0, - image: "" + image: "", + img: 'https://img-blog.csdnimg.cn/20190626120443986.png' }; }, mounted () { @@ -84,8 +92,29 @@ }); }); }, - // 长按保存图片 - longtap () {} + // app端长按保存 + longtap () { + // 先下载图片 + uni.downloadFile({ + url: this.img, + success: (res) => { + // 获取到图片本地地址后再保存图片到相册(因为此方法不支持远程地址) + uni.saveImageToPhotosAlbum({ + filePath: res.tempFilePath, + success: () => { + uni.showToast({ + title: "保存成功!", + }); + }, + fail: () => { + uni.showToast({ + title: "保存失败", + }); + }, + }); + }, + }); + } } }; diff --git a/pages/user/User/index.vue b/pages/user/User/index.vue index d3e9eb4..b883206 100644 --- a/pages/user/User/index.vue +++ b/pages/user/User/index.vue @@ -64,7 +64,7 @@
- + @@ -336,7 +336,7 @@ export default { }, // 获取用户信息 MenuUser() { - getMenuUser() + getMenuUser() .then(res => { uni.hideLoading() this.MyMenus = res.data.routine_my_menus diff --git a/store/index.js b/store/index.js index cafa8e7..144bb6f 100644 --- a/store/index.js +++ b/store/index.js @@ -29,6 +29,7 @@ const vuexStore = new Vuex.Store({ }, mutations: { login(state, token, expires_time) { + console.log('设置token') state.token = token cookie.set(loginKey, token, expires_time) }, From 41cffec39ff7f9d6e04d19494b9ca2a18ba7f285 Mon Sep 17 00:00:00 2001 From: Aaron <578780649@qq.com> Date: Wed, 15 Sep 2021 11:26:57 +0800 Subject: [PATCH 09/16] =?UTF-8?q?=E5=94=AE=E5=90=8E=E9=83=A8=E5=88=86?= =?UTF-8?q?=E6=B5=8B=E8=AF=95=E6=94=B9=E5=8A=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- api/user.js | 3 +- pages.json | 2 +- pages/activity/Poster/index.vue | 3 +- pages/authorization/index.vue | 7 +- pages/home/index.vue | 75 ++--- pages/order/GoodsReturn/index.vue | 106 ++++--- pages/order/GoodsReturn/productlist.vue | 39 +++ pages/order/OrderDetails/index.vue | 27 +- pages/user/Login/login.vue | 381 ++++++++++++------------ pages/user/User/index.vue | 1 - utils/index.js | 2 +- utils/request.js | 4 +- 12 files changed, 371 insertions(+), 279 deletions(-) create mode 100644 pages/order/GoodsReturn/productlist.vue diff --git a/api/user.js b/api/user.js index b9045c3..b4555ee 100644 --- a/api/user.js +++ b/api/user.js @@ -407,7 +407,8 @@ export function wxappBindingPhone(data) { * 小程序上传用户头像 */ export function wxappGetUserInfo (data) { - return request.post('/wxapp/loginAuth', data) + // return request.post('/wxapp/loginAuth', data) + return request.get('/wechat/auth', data) } /* diff --git a/pages.json b/pages.json index ee80869..871b897 100644 --- a/pages.json +++ b/pages.json @@ -318,7 +318,7 @@ { "path": "pages/order/ReturnList/index", "style": { - "navigationBarTitleText": "退货列表" + "navigationBarTitleText": "我的售后" } }, { diff --git a/pages/activity/Poster/index.vue b/pages/activity/Poster/index.vue index 5689ca6..2548409 100644 --- a/pages/activity/Poster/index.vue +++ b/pages/activity/Poster/index.vue @@ -29,8 +29,7 @@ return { status: true, id: 0, - image: "", - img: 'https://img-blog.csdnimg.cn/20190626120443986.png' + image: "" }; }, mounted () { diff --git a/pages/authorization/index.vue b/pages/authorization/index.vue index 47228b5..7c43a22 100644 --- a/pages/authorization/index.vue +++ b/pages/authorization/index.vue @@ -11,6 +11,8 @@ class="cu-btn author-btn" open-type="getPhoneNumber" @getphonenumber="phoneLogin">微信手机号一键登录 + @@ -35,11 +37,14 @@ import dayjs from 'dayjs' import cookie from '@/utils/store/cookie' import store from '@/store' +// 公众号登录 +import { auth } from '@/libs/wechat.js' + export default { data() { return { authorize: false, - canIUseGetUserProfile: false, + canIUseGetUserProfile: false } }, computed: { diff --git a/pages/home/index.vue b/pages/home/index.vue index fe806b7..a2a308c 100644 --- a/pages/home/index.vue +++ b/pages/home/index.vue @@ -315,43 +315,44 @@ export default { startQr: function() { uni.scanCode({ success: res => { - let option = handleUrlParam(res.result) - switch (option.pageType) { - case 'good': - // 跳转商品详情 - this.$yrouter.push({ - path: '/pages/shop/GoodsCon/index', - query: { - q: res.result, - }, - }) - break - case 'group': - // 跳转团购 - this.$yrouter.push({ - path: '/pages/activity/GroupRule/index', - query: { - q: res.result, - }, - }) - break - case 'dargain': - // 跳转砍价 - this.$yrouter.push({ - path: '/pages/activity/DargainDetails/index', - query: { - q: res.result, - }, - }) - break - default: - // 跳转分销 - this.$yrouter.push({ - path: '/pages/Loading/index', - query: {}, - }) - break - } + let option = handleUrlParam(res.result) + console.log(option) + switch (option.pageType) { + case 'good': + // 跳转商品详情 + this.$yrouter.push({ + path: '/pages/shop/GoodsCon/index', + query: { + q: res.result, + }, + }) + break + case 'group': + // 跳转团购 + this.$yrouter.push({ + path: '/pages/activity/GroupRule/index', + query: { + q: res.result, + }, + }) + break + case 'dargain': + // 跳转砍价 + this.$yrouter.push({ + path: '/pages/activity/DargainDetails/index', + query: { + q: res.result, + }, + }) + break + default: + // 跳转分销 + this.$yrouter.push({ + path: '/pages/Loading/index', + query: {}, + }) + break + } }, }) }, diff --git a/pages/order/GoodsReturn/index.vue b/pages/order/GoodsReturn/index.vue index b50ed1b..ab8fa94 100644 --- a/pages/order/GoodsReturn/index.vue +++ b/pages/order/GoodsReturn/index.vue @@ -1,45 +1,75 @@ @@ -68,13 +98,20 @@ Authorization: "Bearer " + this.$store.state.token }, id: 0, + selected: true, orderInfo: {}, + rebackList: [], reasonList: [], reason: "", refund_reason_wap_explain: "", refund_reason_wap_img: [] }; }, + mounted() { + this.id = this.$yroute.query.id || 0; + this.getOrderDetail(); + this.getRefundReason(); + }, methods: { changeReason(e) { this.reason = this.reasonList[e.mp.detail.value]; @@ -143,11 +180,6 @@ }); }); } - }, - mounted() { - this.id = this.$yroute.query.id || 0; - this.getOrderDetail(); - this.getRefundReason(); } }; diff --git a/pages/order/GoodsReturn/productlist.vue b/pages/order/GoodsReturn/productlist.vue new file mode 100644 index 0000000..21f0243 --- /dev/null +++ b/pages/order/GoodsReturn/productlist.vue @@ -0,0 +1,39 @@ + + + + + diff --git a/pages/order/OrderDetails/index.vue b/pages/order/OrderDetails/index.vue index f108c88..243de94 100644 --- a/pages/order/OrderDetails/index.vue +++ b/pages/order/OrderDetails/index.vue @@ -239,12 +239,20 @@ - + - + @@ -329,6 +347,7 @@ }, methods: { copyClipboard, + // 申请退款 goGoodsReturn(orderInfo) { this.$yrouter.push({ path: "/pages/order/GoodsReturn/index", diff --git a/pages/user/Login/login.vue b/pages/user/Login/login.vue index fbe897a..a446787 100644 --- a/pages/user/Login/login.vue +++ b/pages/user/Login/login.vue @@ -145,199 +145,196 @@ }; }, methods: { - async loginMobile() { - var that = this; - const { - account, - captcha - } = that; - try { - await that - .$validator({ - account: [ - required(required.message("手机号码")), - chs_phone(chs_phone.message()) - ], - captcha: [ - required(required.message("验证码")), - alpha_num(alpha_num.message("验证码")) - ] - }) - .validate({ - account, - captcha - }); - } catch (e) { - return validatorDefaultCatch(e); - } - loginMobile({ - phone: that.account, - captcha: that.captcha, - spread: cookie.get("spread") - }) - .then(res => { - var data = res.data; - that.$store.commit("login", data.token, dayjs(data.expires_time)); - handleGetUserInfo(); - }) - .catch(err => { - uni.showToast({ - title: err.msg || err.response.data.msg || err.response.data.message, - icon: "none", - duration: 2000 - }); - }); - }, - async register() { - var that = this; - const { - account, - captcha, - password - } = that; - try { - await that - .$validator({ - account: [ - required(required.message("手机号码")), - chs_phone(chs_phone.message()) - ], - captcha: [ - required(required.message("验证码")), - alpha_num(alpha_num.message("验证码")) - ], - password: [ - required(required.message("密码")), - attrs.range([6, 16], attrs.range.message("密码")), - alpha_num(alpha_num.message("密码")) - ] - }) - .validate({ - account, - captcha, - password - }); - } catch (e) { - return validatorDefaultCatch(e); - } - register({ - account: that.account, - captcha: that.captcha, - password: that.password, - inviteCode: that.inviteCode, - spread: cookie.get("spread") - }) - .then(res => { - uni.showToast({ - title: res.msg, - icon: "success", - duration: 2000 - }); - that.formItem = 1; - }) - .catch(err => { - uni.showToast({ - title: err.msg || err.response.data.msg || err.response.data.message, - icon: "none", - duration: 2000 - }); - }); - }, - async code() { - var that = this; - const { - account - } = that; - try { - await that - .$validator({ - account: [ - required(required.message("手机号码")), - chs_phone(chs_phone.message()) - ] - }) - .validate({ - account - }); - } catch (e) { - return validatorDefaultCatch(e); - } - if (that.formItem == 2) that.type = "register"; - await registerVerify({ - phone: that.account, - type: that.type - }) - .then(res => { - uni.showToast({ - title: res.msg, - icon: "success", - duration: 2000 - }); - that.sendCode(); - }) - .catch(err => { - uni.showToast({ - title: err.msg || err.response.data.msg || err.response.data.message, - icon: "none", - duration: 2000 - }); - }); - }, - navTap: function (index) { - this.current = index; - }, - async submit() { - const { - account, - password - } = this; - try { - await this.$validator({ - account: [ - required(required.message("账号")), - attrs.range([5, 16], attrs.range.message("账号")), - alpha_num(alpha_num.message("账号")) - ], - password: [ - required(required.message("密码")), - attrs.range([6, 16], attrs.range.message("密码")), - alpha_num(alpha_num.message("密码")) - ] - }).validate({ - account, - password - }); - } catch (e) { - return validatorDefaultCatch(e); - } + async loginMobile() { + var that = this; + const { + account, + captcha + } = that; + try { + await that + .$validator({ + account: [ + required(required.message("手机号码")), + chs_phone(chs_phone.message()) + ], + captcha: [ + required(required.message("验证码")), + alpha_num(alpha_num.message("验证码")) + ] + }) + .validate({ + account, + captcha + }); + } catch (e) { + return validatorDefaultCatch(e); + } + loginMobile({ + phone: that.account, + captcha: that.captcha, + spread: cookie.get("spread") + }) + .then(res => { + var data = res.data; + that.$store.commit("login", data.token, dayjs(data.expires_time)); + handleGetUserInfo(); + }) + .catch(err => { + uni.showToast({ + title: err.msg || err.response.data.msg || err.response.data.message, + icon: "none", + duration: 2000 + }); + }); + }, + async register() { + var that = this; + const { + account, + captcha, + password + } = that; + try { + await that + .$validator({ + account: [ + required(required.message("手机号码")), + chs_phone(chs_phone.message()) + ], + captcha: [ + required(required.message("验证码")), + alpha_num(alpha_num.message("验证码")) + ], + password: [ + required(required.message("密码")), + attrs.range([6, 16], attrs.range.message("密码")), + alpha_num(alpha_num.message("密码")) + ] + }) + .validate({ + account, + captcha, + password + }); + } catch (e) { + return validatorDefaultCatch(e); + } + register({ + account: that.account, + captcha: that.captcha, + password: that.password, + inviteCode: that.inviteCode, + spread: cookie.get("spread") + }) + .then(res => { + uni.showToast({ + title: res.msg, + icon: "success", + duration: 2000 + }); + that.formItem = 1; + }) + .catch(err => { + uni.showToast({ + title: err.msg || err.response.data.msg || err.response.data.message, + icon: "none", + duration: 2000 + }); + }); + }, + async code() { + var that = this; + const { + account + } = that; + try { + await that + .$validator({ + account: [ + required(required.message("手机号码")), + chs_phone(chs_phone.message()) + ] + }) + .validate({ + account + }); + } catch (e) { + return validatorDefaultCatch(e); + } + if (that.formItem == 2) that.type = "register"; + await registerVerify({ + phone: that.account, + type: that.type + }) + .then(res => { + uni.showToast({ + title: res.msg, + icon: "success", + duration: 2000 + }); + that.sendCode(); + }) + .catch(err => { + uni.showToast({ + title: err.msg || err.response.data.msg || err.response.data.message, + icon: "none", + duration: 2000 + }); + }); + }, + navTap: function (index) { + this.current = index; + }, + async submit() { + const { + account, + password + } = this; + try { + await this.$validator({ + account: [ + required(required.message("账号")), + attrs.range([5, 16], attrs.range.message("账号")), + alpha_num(alpha_num.message("账号")) + ], + password: [ + required(required.message("密码")), + attrs.range([6, 16], attrs.range.message("密码")), + alpha_num(alpha_num.message("密码")) + ] + }).validate({ + account, + password + }); + } catch (e) { + return validatorDefaultCatch(e); + } + login({ + username: account, + password, + spread: cookie.get("spread") + }) + .then(({ data }) => { + this.$store.commit("login", data.token, dayjs(data.expires_time)); + handleGetUserInfo(); + // let replace=this.$yroute.query.replace + // if(replace){ - login({ - username: account, - password, - spread: cookie.get("spread") - }) - .then(({ - data - }) => { - this.$store.commit("login", data.token, dayjs(data.expires_time)); - handleGetUserInfo(); - // let replace=this.$yroute.query.replace - // if(replace){ - - // } - // this.$yrouter.replace({ - // path: this.$yroute.query.replace || '/pages/home/index' - // }); - }) - .catch(err => { - console.log(err); - uni.showToast({ - title: err.msg || err.response.data.msg || err.response.data.message, - icon: "none", - duration: 2000 - }); - }); - } + // } + // this.$yrouter.replace({ + // path: this.$yroute.query.replace || '/pages/home/index' + // }); + }) + .catch(err => { + console.log(err); + uni.showToast({ + title: err.msg || err.response.data.msg || err.response.data.message, + icon: "none", + duration: 2000 + }); + }); + } } }; diff --git a/pages/user/User/index.vue b/pages/user/User/index.vue index b883206..965a4d1 100644 --- a/pages/user/User/index.vue +++ b/pages/user/User/index.vue @@ -314,7 +314,6 @@ export default { iv: res.iv, code: loginRes.code, // 开发code }).then(res => { - console.log(res === 200) if (res.status === 200) { this.userInfo.avatar = res.data.avatar this.userInfo.nickname = res.data.nickname diff --git a/utils/index.js b/utils/index.js index 907b3b4..171ee01 100644 --- a/utils/index.js +++ b/utils/index.js @@ -524,7 +524,7 @@ export const handleLoginStatus = (location, complete, fail, success) => { // 是否可以访问 let isAuth = false - console.log('即将跳转', location, parseUrl(location)) + // console.log('即将跳转', location, parseUrl(location)) // 从 location 中获取当前url,location typeof string || object let path = '' diff --git a/utils/request.js b/utils/request.js index d7f70e0..ab1868e 100644 --- a/utils/request.js +++ b/utils/request.js @@ -22,12 +22,12 @@ fly.config.baseURL = VUE_APP_API_URL // 小程序请求域名 // #ifdef MP-WEIXIN -fly.config.baseURL = 'http://itxzz.51vip.biz/api' +fly.config.baseURL = 'http://347i13244b.zicp.vip/api' // #endif // #ifdef APP-PLUS // app端 -fly.config.baseURL = 'http://itxzz.51vip.biz/api' +fly.config.baseURL = 'http://347i13244b.zicp.vip/api' // #endif fly.interceptors.response.use( From 02534e936a50285e9b587f761122742b28328ef0 Mon Sep 17 00:00:00 2001 From: 2021 Date: Wed, 15 Sep 2021 18:39:14 +0800 Subject: [PATCH 10/16] =?UTF-8?q?=E5=94=AE=E5=90=8E=E8=AF=A6=E6=83=85?= =?UTF-8?q?=E9=9D=99=E6=80=81=E9=A1=B5=E9=9D=A2=E6=B7=BB=E5=8A=A0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .hbuilderx/launch.json | 15 ++- pages.json | 8 +- pages/order/OrderReturnDetail/index.vue | 135 ++++++++++++++++++++++++ pages/order/ReturnList/index.vue | 3 +- 4 files changed, 154 insertions(+), 7 deletions(-) create mode 100644 pages/order/OrderReturnDetail/index.vue diff --git a/.hbuilderx/launch.json b/.hbuilderx/launch.json index 501e01c..9cba30d 100644 --- a/.hbuilderx/launch.json +++ b/.hbuilderx/launch.json @@ -2,10 +2,15 @@ // launchtype项可配置值为local或remote, local代表前端连本地云函数,remote代表前端连云端云函数 "version": "0.0", "configurations": [{ - "type": "uniCloud", - "default": { - "launchtype": "remote" - } - } + "default" : + { + "launchtype" : "remote" + }, + "mp-weixin" : + { + "launchtype" : "remote" + }, + "type" : "uniCloud" + } ] } diff --git a/pages.json b/pages.json index 871b897..998fb4f 100644 --- a/pages.json +++ b/pages.json @@ -297,6 +297,12 @@ "navigationBarTitleText": "订单详情" } }, + { + "path" : "pages/order/OrderReturnDetail/index", + "style": { + "navigationBarTitleText": "售后详情" + } + }, { "path": "pages/order/OrderSubmission/index", "style": { @@ -423,7 +429,7 @@ "navigationBarTitleText": "直播列表" } } - ], + ], "easycom": { "autoscan": true, "custom": { diff --git a/pages/order/OrderReturnDetail/index.vue b/pages/order/OrderReturnDetail/index.vue new file mode 100644 index 0000000..41edfad --- /dev/null +++ b/pages/order/OrderReturnDetail/index.vue @@ -0,0 +1,135 @@ + + + + + diff --git a/pages/order/ReturnList/index.vue b/pages/order/ReturnList/index.vue index c72190e..4a4d80d 100644 --- a/pages/order/ReturnList/index.vue +++ b/pages/order/ReturnList/index.vue @@ -69,7 +69,8 @@ export default { }, goOrderDetails(order) { this.$yrouter.push({ - path: "/pages/order/OrderDetails/index", + // path: "/pages/order/OrderReturnDetail/index", + path: "/pages/order/OrderDetails/index", query: { id: order.orderId } }); }, From 66d9ba83d55ae5e32186abcb95943aa54f18b998 Mon Sep 17 00:00:00 2001 From: 2021 Date: Thu, 23 Sep 2021 12:29:33 +0800 Subject: [PATCH 11/16] =?UTF-8?q?=E5=94=AE=E5=90=8E=E7=94=B3=E8=AF=B7?= =?UTF-8?q?=E9=83=A8=E5=88=86=E6=94=B9=E5=8A=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- api/aftersales.js | 64 +++++ pages/order/GoodsReturn/index.vue | 425 ++++++++++++++++++++-------- pages/order/OrderDetails/index.vue | 15 +- pages/order/ReturnList/index.vue | 109 +++++-- pages/order/ReturnList/listItem.vue | 73 +++++ utils/request.js | 2 +- 6 files changed, 545 insertions(+), 143 deletions(-) create mode 100644 api/aftersales.js create mode 100644 pages/order/ReturnList/listItem.vue diff --git a/api/aftersales.js b/api/aftersales.js new file mode 100644 index 0000000..adf3a9c --- /dev/null +++ b/api/aftersales.js @@ -0,0 +1,64 @@ +import request from '@/utils/request' + +// 提交售后 +/** + * + 订单号 orderCode; + 服务类型 0仅退款1退货退款 serviceType; + 申请原因 reasonForApplication; + 申请说明 applicationInstructions; + 申请说明图片 applicationDescriptionPicture; + 商品数据 productParamList; + */ +export function submitAfterSealsOrder(data) { + return request.post(`/applyForAfterSales`, data, { + login: true + }); +} + +// 售后订单列表 +export function getAfterSealsList (params) { + return request.get('/storeAfterSales/list', params, { + login: true, + }); +} + +// 售后详情 +export function getAfterSalesDeatail(key) { + return request.get(`/applyForAfterSales/${key}`); +} + +// 查询订单 +export function getAfterSealsDetail (key, id) { + return request.get(`/api/store/detail/${key}/${id}`) +} + +// 搜索 +export function searchAfterSealsDetail (key) { + return request.get(`/api/store/detail/${key}`) +} + +// 撤销售后订单 +export function rebackAfterSeals (key, id) { + return request.get(`/api/revoke/revoke/${key}/${id}`) +} + +// 获取物流信息 +export function getExpressData () { + return request.get('/api/yxExpress') + +} + +// 添加快递单号 +export function addExpressData (params) { + return request.post('/api/addLogisticsInformation', params, { + login: true + }) +} + +// 删除售后订单 +export function deleteAfterSeals (params) { + return request.delete('/api/deleteAfterSalesOrder', params, { + login: true + }) +} diff --git a/pages/order/GoodsReturn/index.vue b/pages/order/GoodsReturn/index.vue index ab8fa94..9db9751 100644 --- a/pages/order/GoodsReturn/index.vue +++ b/pages/order/GoodsReturn/index.vue @@ -1,9 +1,10 @@ + + + diff --git a/pages/order/OrderDetails/index.vue b/pages/order/OrderDetails/index.vue index 243de94..904bb47 100644 --- a/pages/order/OrderDetails/index.vue +++ b/pages/order/OrderDetails/index.vue @@ -100,7 +100,10 @@ {{ orderInfo.realName }} {{ orderInfo.userPhone }} - + {{ orderInfo.userAddress }} @@ -118,7 +121,11 @@ - + 订单编号: @@ -233,8 +240,8 @@ 取消订单 立即付款 -