diff --git a/src/pages/details/details.vue b/src/pages/details/details.vue index b754f32..0dfa51c 100644 --- a/src/pages/details/details.vue +++ b/src/pages/details/details.vue @@ -655,6 +655,7 @@ export default { /* #ifndef APP-NVUE */ padding-bottom: constant(safe-area-inset-bottom); padding-bottom: env(safe-area-inset-bottom); + /* #endif */ .menu_1 { width: 20%; height: 100%; diff --git a/src/pages/index/index.vue b/src/pages/index/index.vue index 2c2443c..0372967 100644 --- a/src/pages/index/index.vue +++ b/src/pages/index/index.vue @@ -88,12 +88,12 @@ data-format="Object" > - + ',this.$store.state.index.list) const list = this.$store.state.index.list - if (list.length == 0) { - this.isLoading = false - } - this.scrollTop = 0.1 - return list + if (list.length === 0) { + this.isLoading = false + } + this.scrollTop = 0.1 + return list }, categoryList() { return this.$store.state.index.categoryList @@ -186,7 +186,7 @@ export default { * 页面载入完成后调用子组件的方法生成预加载效果 */ onReady: function() { - this.getInitData() + this.getInitData() }, methods: { async getInitData () { diff --git a/src/pages/myOrder/components/OrderCard.vue b/src/pages/myOrder/components/OrderCard.vue index 83fc7d4..1a2f1c2 100644 --- a/src/pages/myOrder/components/OrderCard.vue +++ b/src/pages/myOrder/components/OrderCard.vue @@ -65,133 +65,174 @@ class="btns" v-if="status == '2'" > - 再次购买 + 再次购买 - - - - - 订单号:{{order.pay_id}} - 下单时间:{{order.pay_time}} - 待付款 - 待收货 - 已完成 - - - - - - {{orderInfo.p_name}} - {{orderInfo.p_name}} - - {{orderInfo.nowPrice}} - X {{orderInfo.num}} - - - - 实付:{{order.total_fee}} - - 取消订单 - 去支付 - - - 确认收货 - - - 再次购买 - - + + + + 订单号:{{order.pay_id}} + 下单时间:{{order.pay_time}} + 待付款 + 待收货 + 已完成 + + + + + + {{orderInfo.p_name}} + {{orderInfo.p_name}} + + {{orderInfo.nowPrice}} + X {{orderInfo.num}} + + + + 实付:{{order.total_fee}} + + 取消订单 + 去支付 + + + 确认收货 + + + 再次购买 + + + 再次购买 + --> diff --git a/src/store/modules/index.js b/src/store/modules/index.js index cf272d4..9af9b82 100644 --- a/src/store/modules/index.js +++ b/src/store/modules/index.js @@ -1,455 +1,468 @@ - import urlAlias from '../url'; - import request from '../request'; +import urlAlias from '../url' +import request from '../request' - const { - category, - shopList, - search, - } = urlAlias; +const { + category, + shopList, + search, +} = urlAlias -let initData = {"name":"志平防蓝光-防辐射电脑网课眼镜","id":"9","imgurl":"", - "price":0,"trade_num":"102","rsSon":{"pic":"9_FDB33D.jpg","model_pic":null,"in_price":"6000","sku_value":"80_83", - "discount":"45","kc":"0","sku_name":"1.56非球面防蓝光_黑透+蓝纹","Max_Price":158,"Min_Price":99}} -var initArr = [1,2,3,4,5,6,7,8] -let list = [] +const initData = { + name: '志平防蓝光-防辐射电脑网课眼镜', + id: '9', + imgurl: '', + price: 0, + trade_num: '102', + rsSon: { + pic: '9_FDB33D.jpg', + model_pic: null, + in_price: '6000', + sku_value: '80_83', + discount: '45', + kc: '0', + sku_name: '1.56非球面防蓝光_黑透+蓝纹', + Max_Price: 158, + Min_Price: 99, + }, +} +var initArr = [1, 2, 3, 4, 5, 6, 7, 8] +const list = [] initArr.forEach(function (value) { - list.push(initData) -}); + list.push(initData) +}) -let categoryList = [ - { - "type": "checkbox", - "name": "产品", - "value": "category", - "submenu": [ - { - "label": "镜框", - "name": "镜框", - "value": "1" - }, - { - "label": "镜片", - "name": "镜片", - "value": "2" - }, - { - "label": "特种镜", - "name": "特种镜", - "value": "146" - } - ], - "groups": [ - "001" - ] - }, - { - "type": "radio", - "name": "规则", - "value": "px", - "submenu": [ - { - "name": "按价格排", - "value": "1" - }, - { - "name": "按销量排", - "value": "2" - } - ], - "groups": [ - "002" - ] - }, - { - "type": "radio", - "name": "排序", - "value": "sort", - "submenu": [ - { - "name": "从高到低", - "value": "1" - }, - { - "name": "从低到高", - "value": "2" - } - ], - "groups": [ - "003" - ] - }, - { - "type": "filter", - "name": "筛选", - "value": "filter", - "submenu": [ - { - "type": "checkbox", - "name": "性别", - "value": "sex", - "submenu": [ - { - "label": "男性", - "name": "男性", - "value": "27" - }, - { - "label": "女性", - "name": "女性", - "value": "28" - } - ] - }, - { - "type": "checkbox", - "name": "年龄", - "value": "age", - "submenu": [ - { - "label": "通用", - "name": "通用", - "value": "24" - } - ] - }, - { - "type": "checkbox", - "name": "适用场景", - "value": "sense", - "submenu": [ - { - "label": "行政风", - "name": "行政风", - "value": "53" - }, - { - "label": "青春学子风", - "name": "青春学子风", - "value": "54" - }, - { - "label": "运动风", - "name": "运动风", - "value": "55" - }, - { - "label": "简约-极简文艺范", - "name": "简约-极简文艺范", - "value": "56" - }, - { - "label": "奶奶风", - "name": "奶奶风", - "value": "57" - }, - { - "label": "流线洛可可", - "name": "流线洛可可", - "value": "58" - }, - { - "label": "自然舒视角", - "name": "自然舒视角", - "value": "59" - }, - { - "label": "无界人文系", - "name": "无界人文系", - "value": "60" - }, - { - "label": "有机未来时", - "name": "有机未来时", - "value": "61" - }, - { - "label": "立体巴洛克", - "name": "立体巴洛克", - "value": "62" - }, - { - "label": "多元新风尚", - "name": "多元新风尚", - "value": "63" - }, - { - "label": "理性几何派", - "name": "理性几何派", - "value": "64" - }, - { - "label": "轻简北欧风", - "name": "轻简北欧风", - "value": "65" - }, - { - "label": "质感哥特潮", - "name": "质感哥特潮", - "value": "66" - }, - { - "label": "时尚", - "name": "时尚", - "value": "67" - }, - { - "label": "复古", - "name": "复古", - "value": "68" - }, - { - "label": "商务", - "name": "商务", - "value": "69" - }, - { - "label": "休闲", - "name": "休闲", - "value": "70" - }, - { - "label": "折射率", - "name": "折射率", - "value": "285" - } - ] - }, - { - "type": "checkbox", - "name": "价格", - "value": "price", - "submenu": [ - { - "name": "100以下", - "value": "1,100" - }, - { - "name": "100-300", - "value": "100,300" - }, - { - "name": "300-1000", - "value": "300,1000" - }, - { - "name": "1000以上", - "value": "1000,-1" - } - ] - }, - { - "type": "checkbox", - "name": "材质", - "value": "glasscate", - "submenu": [ - { - "label": "购易", - "name": "购易", - "value": "72" - }, - { - "label": "海俪恩", - "name": "海俪恩", - "value": "73" - }, - { - "label": "沙漠风暴", - "name": "沙漠风暴", - "value": "74" - }, - { - "label": "古诗", - "name": "古诗", - "value": "75" - }, - { - "label": "暴龙", - "name": "暴龙", - "value": "76" - }, - { - "label": "犀牛", - "name": "犀牛", - "value": "77" - }, - { - "label": "Ray-Ban雷朋", - "name": "Ray-Ban雷朋", - "value": "78" - }, - { - "label": "PARIM派丽蒙", - "name": "PARIM派丽蒙", - "value": "79" - }, - { - "label": "石狼", - "name": "石狼", - "value": "80" - }, - { - "label": "木九十", - "name": "木九十", - "value": "81" - } - ] - }, - { - "type": "checkbox", - "name": "品牌", - "value": "brand", - "submenu": [ - { - "label": "购易", - "name": "购易", - "value": "72" - }, - { - "label": "海俪恩", - "name": "海俪恩", - "value": "73" - }, - { - "label": "沙漠风暴", - "name": "沙漠风暴", - "value": "74" - }, - { - "label": "古诗", - "name": "古诗", - "value": "75" - }, - { - "label": "暴龙", - "name": "暴龙", - "value": "76" - }, - { - "label": "犀牛", - "name": "犀牛", - "value": "77" - }, - { - "label": "Ray-Ban雷朋", - "name": "Ray-Ban雷朋", - "value": "78" - }, - { - "label": "PARIM派丽蒙", - "name": "PARIM派丽蒙", - "value": "79" - }, - { - "label": "石狼", - "name": "石狼", - "value": "80" - }, - { - "label": "木九十", - "name": "木九十", - "value": "81" - } - ] - } - ], - "groups": [ - "001", - "002", - "003" - ], - } - ] +// let categoryList = [ +// { +// "type": "checkbox", +// "name": "产品", +// "value": "category", +// "submenu": [ +// { +// "label": "镜框", +// "name": "镜框", +// "value": "1" +// }, +// { +// "label": "镜片", +// "name": "镜片", +// "value": "2" +// }, +// { +// "label": "特种镜", +// "name": "特种镜", +// "value": "146" +// } +// ], +// "groups": [ +// "001" +// ] +// }, +// { +// "type": "radio", +// "name": "规则", +// "value": "px", +// "submenu": [ +// { +// "name": "按价格排", +// "value": "1" +// }, +// { +// "name": "按销量排", +// "value": "2" +// } +// ], +// "groups": [ +// "002" +// ] +// }, +// { +// "type": "radio", +// "name": "排序", +// "value": "sort", +// "submenu": [ +// { +// "name": "从高到低", +// "value": "1" +// }, +// { +// "name": "从低到高", +// "value": "2" +// } +// ], +// "groups": [ +// "003" +// ] +// }, +// { +// "type": "filter", +// "name": "筛选", +// "value": "filter", +// "submenu": [ +// { +// "type": "checkbox", +// "name": "性别", +// "value": "sex", +// "submenu": [ +// { +// "label": "男性", +// "name": "男性", +// "value": "27" +// }, +// { +// "label": "女性", +// "name": "女性", +// "value": "28" +// } +// ] +// }, +// { +// "type": "checkbox", +// "name": "年龄", +// "value": "age", +// "submenu": [ +// { +// "label": "通用", +// "name": "通用", +// "value": "24" +// } +// ] +// }, +// { +// "type": "checkbox", +// "name": "适用场景", +// "value": "sense", +// "submenu": [ +// { +// "label": "行政风", +// "name": "行政风", +// "value": "53" +// }, +// { +// "label": "青春学子风", +// "name": "青春学子风", +// "value": "54" +// }, +// { +// "label": "运动风", +// "name": "运动风", +// "value": "55" +// }, +// { +// "label": "简约-极简文艺范", +// "name": "简约-极简文艺范", +// "value": "56" +// }, +// { +// "label": "奶奶风", +// "name": "奶奶风", +// "value": "57" +// }, +// { +// "label": "流线洛可可", +// "name": "流线洛可可", +// "value": "58" +// }, +// { +// "label": "自然舒视角", +// "name": "自然舒视角", +// "value": "59" +// }, +// { +// "label": "无界人文系", +// "name": "无界人文系", +// "value": "60" +// }, +// { +// "label": "有机未来时", +// "name": "有机未来时", +// "value": "61" +// }, +// { +// "label": "立体巴洛克", +// "name": "立体巴洛克", +// "value": "62" +// }, +// { +// "label": "多元新风尚", +// "name": "多元新风尚", +// "value": "63" +// }, +// { +// "label": "理性几何派", +// "name": "理性几何派", +// "value": "64" +// }, +// { +// "label": "轻简北欧风", +// "name": "轻简北欧风", +// "value": "65" +// }, +// { +// "label": "质感哥特潮", +// "name": "质感哥特潮", +// "value": "66" +// }, +// { +// "label": "时尚", +// "name": "时尚", +// "value": "67" +// }, +// { +// "label": "复古", +// "name": "复古", +// "value": "68" +// }, +// { +// "label": "商务", +// "name": "商务", +// "value": "69" +// }, +// { +// "label": "休闲", +// "name": "休闲", +// "value": "70" +// }, +// { +// "label": "折射率", +// "name": "折射率", +// "value": "285" +// } +// ] +// }, +// { +// "type": "checkbox", +// "name": "价格", +// "value": "price", +// "submenu": [ +// { +// "name": "100以下", +// "value": "1,100" +// }, +// { +// "name": "100-300", +// "value": "100,300" +// }, +// { +// "name": "300-1000", +// "value": "300,1000" +// }, +// { +// "name": "1000以上", +// "value": "1000,-1" +// } +// ] +// }, +// { +// "type": "checkbox", +// "name": "材质", +// "value": "glasscate", +// "submenu": [ +// { +// "label": "购易", +// "name": "购易", +// "value": "72" +// }, +// { +// "label": "海俪恩", +// "name": "海俪恩", +// "value": "73" +// }, +// { +// "label": "沙漠风暴", +// "name": "沙漠风暴", +// "value": "74" +// }, +// { +// "label": "古诗", +// "name": "古诗", +// "value": "75" +// }, +// { +// "label": "暴龙", +// "name": "暴龙", +// "value": "76" +// }, +// { +// "label": "犀牛", +// "name": "犀牛", +// "value": "77" +// }, +// { +// "label": "Ray-Ban雷朋", +// "name": "Ray-Ban雷朋", +// "value": "78" +// }, +// { +// "label": "PARIM派丽蒙", +// "name": "PARIM派丽蒙", +// "value": "79" +// }, +// { +// "label": "石狼", +// "name": "石狼", +// "value": "80" +// }, +// { +// "label": "木九十", +// "name": "木九十", +// "value": "81" +// } +// ] +// }, +// { +// "type": "checkbox", +// "name": "品牌", +// "value": "brand", +// "submenu": [ +// { +// "label": "购易", +// "name": "购易", +// "value": "72" +// }, +// { +// "label": "海俪恩", +// "name": "海俪恩", +// "value": "73" +// }, +// { +// "label": "沙漠风暴", +// "name": "沙漠风暴", +// "value": "74" +// }, +// { +// "label": "古诗", +// "name": "古诗", +// "value": "75" +// }, +// { +// "label": "暴龙", +// "name": "暴龙", +// "value": "76" +// }, +// { +// "label": "犀牛", +// "name": "犀牛", +// "value": "77" +// }, +// { +// "label": "Ray-Ban雷朋", +// "name": "Ray-Ban雷朋", +// "value": "78" +// }, +// { +// "label": "PARIM派丽蒙", +// "name": "PARIM派丽蒙", +// "value": "79" +// }, +// { +// "label": "石狼", +// "name": "石狼", +// "value": "80" +// }, +// { +// "label": "木九十", +// "name": "木九十", +// "value": "81" +// } +// ] +// } +// ], +// "groups": [ +// "001", +// "002", +// "003" +// ], +// } +// ] -//初始化数据是为了显示默认骨架 - const state = { - categoryList: [], - list: list - }; - - const mutations = { - LIST: (state, list) => { - state.list = list; - }, - CATEGORY: (state, categoryList) => { - state.categoryList = categoryList; - } - }; +// 初始化数据是为了显示默认骨架 +const state = { + categoryList: [], + list: list, +} - const actions = { - category({ - commit - }, param) { - return new Promise((resolve) => request({ - url: category, - success: (res) => { - let data = res.data.data; - for (let i = 0; i <= data.length; i++) { - if (data[i] && data[i].type !== 'filter') { - data[i].type = 'hierarchy'; - } - } - data.unshift({ - type: "hierarchy", - name: "全部", - value: "all", - isNoPull: true, - }); - commit('CATEGORY', data); - resolve(data) - }, - fail: (res) => { - console.log("fail status === > ", res); - } - })) - - }, - list({ - commit - }, param) { - return new Promise((resolve) => request({ - url: shopList, - success: (res) => { - commit('LIST', res.data.data) - resolve(res.data) - }, - fail: (res) => { - console.log("fail status === > ", res); - }, - complete: (res) => { - state.isLoading = false; - }, - })) - }, - search({ - commit - }, { - params, - keyword - }) { - const uid = uni.getStorageSync('uid'); - return new Promise((resolve) => request({ - url: search, - data: { - params: JSON.stringify(params), - uid, - way: 1, - keyword, - }, - success: (res) => { - commit('LIST', res.data.data); - resolve(res.data) - }, - fail: (res) => { - console.log("fail status === > ", res); - } - })) - - }, - }; +const mutations = { + LIST: (state, list) => { + state.list = list + }, + CATEGORY: (state, categoryList) => { + state.categoryList = categoryList + }, +} - export default { - namespaced: true, - state, - mutations, - actions, - }; \ No newline at end of file +const actions = { + category({ + commit, + }, param) { + return new Promise((resolve) => request({ + url: category, + success: (res) => { + const data = res.data.data + for (let i = 0; i <= data.length; i++) { + if (data[i] && data[i].type !== 'filter') { + data[i].type = 'hierarchy' + } + } + data.unshift({ + type: 'hierarchy', + name: '全部', + value: 'all', + isNoPull: true, + }) + commit('CATEGORY', data) + resolve(data) + }, + fail: (res) => { + console.log('fail status === > ', res) + }, + })) + }, + list({ + commit, + }, param) { + return new Promise((resolve) => request({ + url: shopList, + success: (res) => { + commit('LIST', res.data.data) + resolve(res.data) + }, + fail: (res) => { + console.log('fail status === > ', res) + }, + complete: (res) => { + state.isLoading = false + }, + })) + }, + search({ + commit, + }, { + params, + keyword, + }) { + const uid = uni.getStorageSync('uid') + return new Promise((resolve) => request({ + url: search, + data: { + params: JSON.stringify(params), + uid, + way: JSON.stringify(params) === '{}' ? 0 : 1, + keyword, + }, + success: (res) => { + commit('LIST', res.data.data) + resolve(res.data) + }, + fail: (res) => { + console.log('fail status === > ', res) + }, + })) + }, +} + +export default { + namespaced: true, + state, + mutations, + actions, +} diff --git a/src/store/request.js b/src/store/request.js index 205d77c..681a857 100644 --- a/src/store/request.js +++ b/src/store/request.js @@ -1,5 +1,7 @@ const DOMAIN = 'https://api.glass.xiuyetang.com' +let loading = false + export default async function request({ url, method = 'post', @@ -16,8 +18,19 @@ export default async function request({ }, complete = (res) => { console.log('complete status === > ', res) + if (loading) { + uni.hideLoading() + } }, + isLoading = false, + loadingText = '加载中', }) { + if (isLoading) { + loading = isLoading + uni.showLoading({ + title: loadingText, + }) + } const uid = uni.getStorageSync('uid') const openid = uni.getStorageSync('openid') data = {