From 7333043a4f1a42f755f7685d9a4f7d000571c30c Mon Sep 17 00:00:00 2001 From: Gao xiaosong <704041637@qq.com> Date: Sun, 18 Apr 2021 15:28:14 +0800 Subject: [PATCH 01/11] =?UTF-8?q?=E4=BC=98=E5=8C=96=E7=BB=86=E8=8A=82?= =?UTF-8?q?=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- components/OrderGoods.vue | 4 +- config/index.js | 5 +- main.js | 85 +- pages/home/index.vue | 828 +++++++++---------- pages/order/MyOrder/index.vue | 219 +++-- pages/orderAdmin/OrderCancellation/index.vue | 357 ++++---- pages/shop/GoodsCollection/index.vue | 95 ++- pages/shop/GoodsFoot/index.vue | 95 ++- pages/user/UserAccount/index.vue | 59 +- utils/index.js | 20 +- 10 files changed, 863 insertions(+), 904 deletions(-) diff --git a/components/OrderGoods.vue b/components/OrderGoods.vue index 50fac18..19b22f5 100644 --- a/components/OrderGoods.vue +++ b/components/OrderGoods.vue @@ -12,7 +12,8 @@ x {{ cart.cartNum }} {{ cart.productInfo.attrInfo.sku }} - ¥{{ cart.truePrice }} + {{ cart.costPrice }}积分 + ¥{{ cart.truePrice }} 评价 @@ -28,6 +29,7 @@ export default { type: Array, default: () => [], }, + isIntegral: Boolean, }, data: function() { return {} diff --git a/config/index.js b/config/index.js index 728afb9..1bc2e16 100644 --- a/config/index.js +++ b/config/index.js @@ -1,6 +1,7 @@ // export const VUE_APP_API_URL = 'http://natapp.xinxintuan.co/api'; -export const VUE_APP_API_URL = 'https://wxapi.yixiang.co/api'; -// export const VUE_APP_API_URL = 'http://192.168.31.223:8008/api'; +export const VUE_APP_API_URL = 'https://wxapi.yixiang.co/api' +// export const VUE_APP_API_URL = 'http://139.186.134.205:9006/api' +// export const VUE_APP_API_URL = 'http://192.168.31.223:8008/api' // export const VUE_APP_API_URL = 'http://natapp.xinxintuan.co/api'; // export const VUE_APP_API_URL = 'https://tapi.xinxintuan.co/api' // export const VUE_APP_API_URL = 'https://h5api.xinxintuan.co/api'; diff --git a/main.js b/main.js index f4fa072..915d91d 100644 --- a/main.js +++ b/main.js @@ -14,7 +14,7 @@ Vue.component('cu-custom', cuCustom) Vue.config.productionTip = false Vue.config.devtools = process.env.NODE_ENV !== 'production' -Vue.prototype.$validator = function (rule) { +Vue.prototype.$validator = function(rule) { return new schema(rule) } @@ -27,23 +27,6 @@ const app = new Vue({ store, }) -Vue.mixin({ - onLoad() { - const { $mp } = this.$root - this._route = parseRoute($mp) - }, - onShow() { - _router.app = this - _router.currentRoute = this._route - }, - // 这里为了解决 .vue文件中 template 无法获取 VUE.prototype 绑定的变量 - computed: { - $VUE_APP_RESOURCES_URL() { - return VUE_APP_RESOURCES_URL; - } - } -}) - Object.defineProperty(Vue.prototype, '$yrouter', { get() { return _router @@ -59,17 +42,16 @@ Object.defineProperty(Vue.prototype, '$yroute', { Vue.prototype.$VUE_APP_API_URL = VUE_APP_API_URL Vue.component('cu-custom', cuCustom) +let deviceType = '' // #ifdef APP-PLUS // App平台编译的代码 -Vue.prototype.$deviceType = 'app' -store.commit('updateDevicetype', 'app') +deviceType = 'app' Vue.prototype.$platform = uni.getSystemInfoSync().platform // #endif // #ifdef MP-WEIXIN // 微信小程序编译的代码 -Vue.prototype.$deviceType = 'routine' -store.commit('updateDevicetype', 'routine') +deviceType = 'routine' // #endif // !!! ps 不建议在 template 中使用 $deviceType 去判断当前环境,很有可能出现 $deviceType 为 undefined 导致判断出错的问题,可以在 script 模块中正常使用 @@ -99,29 +81,42 @@ if (urlSpread) { // #endif -async function init() { - // #ifdef H5 - // H5编译的代码 - // 判断是否是微信浏览器 - if (isWeixin()) { - Vue.prototype.$deviceType = 'weixin' - store.commit('updateDevicetype', 'weixin') - let wechatInit = await wechat() - console.log(wechatInit) - if (wechatInit) { - await oAuth() - app.$mount() - } - } else { - Vue.prototype.$deviceType = 'weixinh5' - store.commit('updateDevicetype', 'weixinh5') - app.$mount() +// #ifdef H5 +// H5编译的代码 +// 判断是否是微信浏览器 +if (isWeixin()) { + deviceType = 'weixin' + let wechatInit = await wechat() + if (wechatInit) { + await oAuth() } - // #endif - - // #ifndef H5 - app.$mount() - // #endif +} else { + deviceType = 'weixinh5' } +// #endif + +Vue.prototype.$deviceType = deviceType + +Vue.mixin({ + onLoad() { + const { $mp } = this.$root + this._route = parseRoute($mp) + }, + onShow() { + _router.app = this + _router.currentRoute = this._route + }, + // 这里为了解决 .vue文件中 template 无法获取 VUE.prototype 绑定的变量 + computed: { + $VUE_APP_RESOURCES_URL() { + return VUE_APP_RESOURCES_URL + }, + $deviceType() { + return deviceType + }, + }, +}) + +store.commit('updateDevicetype', deviceType) -init() +app.$mount() diff --git a/pages/home/index.vue b/pages/home/index.vue index 510ff15..c4647da 100644 --- a/pages/home/index.vue +++ b/pages/home/index.vue @@ -1,448 +1,438 @@ diff --git a/pages/order/MyOrder/index.vue b/pages/order/MyOrder/index.vue index b18a4da..524ac2d 100644 --- a/pages/order/MyOrder/index.vue +++ b/pages/order/MyOrder/index.vue @@ -4,7 +4,7 @@ 订单信息 - 累计订单:{{ orderData.orderCount || 0 }} 总消费:¥{{orderData.sumPrice || 0 }} + 累计订单:{{ orderData.orderCount || 0 }} 总消费:¥{{ orderData.sumPrice || 0 }} @@ -31,13 +31,10 @@ - + - 拼团 + 拼团 秒杀 砍价 门店 @@ -46,24 +43,15 @@ {{ getStatus(order) }} - + - + {{ cart.productInfo.storeName }} - - ¥{{ - cart.productInfo.attrInfo - ? cart.productInfo.attrInfo.price - : cart.productInfo.price - }} - - - {{order.payIntegral}}积分 - + ¥{{ cart.productInfo.attrInfo ? cart.productInfo.attrInfo.price : cart.productInfo.price }} + {{ order.payIntegral }}积分 x{{ cart.cartNum }} @@ -107,8 +89,8 @@ 共{{ order.cartInfo.length || 0 }}件商品,总金额 - ¥{{ order.payPrice }} - {{order.payIntegral}}积分 + ¥{{ order.payPrice }} + {{ order.payIntegral }}积分 diff --git a/pages/shop/GoodsCollection/index.vue b/pages/shop/GoodsCollection/index.vue index 298a06c..c9f5f44 100644 --- a/pages/shop/GoodsCollection/index.vue +++ b/pages/shop/GoodsCollection/index.vue @@ -1,30 +1,22 @@ diff --git a/pages/shop/GoodsFoot/index.vue b/pages/shop/GoodsFoot/index.vue index 642e85a..a405eef 100644 --- a/pages/shop/GoodsFoot/index.vue +++ b/pages/shop/GoodsFoot/index.vue @@ -1,30 +1,22 @@ diff --git a/pages/user/UserAccount/index.vue b/pages/user/UserAccount/index.vue index cc7e19e..a7a96de 100644 --- a/pages/user/UserAccount/index.vue +++ b/pages/user/UserAccount/index.vue @@ -8,7 +8,7 @@ 总资产(元) {{ now_money }} - 充值 + 充值 @@ -31,7 +31,7 @@ 消费记录 - + @@ -44,59 +44,58 @@ diff --git a/utils/index.js b/utils/index.js index 911ccae..83f39dc 100644 --- a/utils/index.js +++ b/utils/index.js @@ -499,6 +499,22 @@ export const handleLoginStatus = (location, complete, fail, success) => { path: '/pages/home/index', name: '首页', }, + { + path: '/pages/shop/HotNewGoods/index', + name: '热门榜单', + }, + { + path: '/pages/activity/GoodsGroup/index', + name: '超值拼团', + }, + { + path: '/pages/shop/Live/LiveList/index', + name: '热门直播', + }, + { + path: '/pages/shop/GoodsClass/index', + name: '商品分类', + }, { path: '/pages/user/Login/index', name: '登录页面', @@ -520,7 +536,7 @@ export const handleLoginStatus = (location, complete, fail, success) => { } else { path = location.path } - + console.log(path) // 判断用户是否有token if (!handleAuth()) { page.map(item => { @@ -531,7 +547,7 @@ export const handleLoginStatus = (location, complete, fail, success) => { } else { isAuth = true } - + console.log(isAuth) return new Promise((resolve, reject) => { if (isAuth) { // 有token From 0d98c8e77877f4e091e813d6d684ec31362820b1 Mon Sep 17 00:00:00 2001 From: Gao xiaosong <704041637@qq.com> Date: Sun, 18 Apr 2021 16:22:21 +0800 Subject: [PATCH 02/11] =?UTF-8?q?=E6=94=BE=E5=BC=80=E7=99=BB=E5=BD=95?= =?UTF-8?q?=E9=97=B2=E7=BD=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- utils/request.js | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/utils/request.js b/utils/request.js index b9db3d4..bbe4574 100644 --- a/utils/request.js +++ b/utils/request.js @@ -72,13 +72,13 @@ function baseRequest(options) { } } - // 如果需要登录才可访问的接口没有拿到 token 视为登录失效 - if (options.login === true && !token) { - // 跳转到登录或授权页面 - handleLoginFailure() - // 提示错误信息 - return Promise.reject({ msg: '未登录', toLogin: true }) - } + // // 如果需要登录才可访问的接口没有拿到 token 视为登录失效 + // if (options.login === true && !token) { + // // 跳转到登录或授权页面 + // handleLoginFailure() + // // 提示错误信息 + // return Promise.reject({ msg: '未登录', toLogin: true }) + // } // 结构请求需要的参数 const { url, params, data, login, ...option } = options From 7817ac45d891dc5135e723299ab747ea37b0952c Mon Sep 17 00:00:00 2001 From: Gao xiaosong <704041637@qq.com> Date: Sun, 18 Apr 2021 16:27:19 +0800 Subject: [PATCH 03/11] =?UTF-8?q?=E6=94=BE=E5=BC=80=E5=89=8D=E7=AB=AF?= =?UTF-8?q?=E8=B7=B3=E8=BD=AC=E6=9D=83=E9=99=90=E6=A0=A1=E9=AA=8C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- utils/index.js | 46 ++++++++++++++++++++++++++-------------------- 1 file changed, 26 insertions(+), 20 deletions(-) diff --git a/utils/index.js b/utils/index.js index 83f39dc..8a2b27a 100644 --- a/utils/index.js +++ b/utils/index.js @@ -549,26 +549,32 @@ export const handleLoginStatus = (location, complete, fail, success) => { } console.log(isAuth) return new Promise((resolve, reject) => { - if (isAuth) { - // 有token - if (path == '/pages/home/index' || path == '/pages/shop/GoodsClass/index' || path == '/pages/shop/ShoppingCart/index' || path == '/pages/user/User/index') { - // switchTab({ - // path: parseUrl(location), - // }) - // return - } - - resolve({ - url: parseUrl(location), - complete, - fail, - success, - }) - } else { - // 没有token,先校验用户是否授权,如果授权了,进行自动登录 - routerPermissions(parseUrl(location)) - reject() - } + resolve({ + url: parseUrl(location), + complete, + fail, + success, + }) + // if (isAuth) { + // // 有token + // if (path == '/pages/home/index' || path == '/pages/shop/GoodsClass/index' || path == '/pages/shop/ShoppingCart/index' || path == '/pages/user/User/index') { + // // switchTab({ + // // path: parseUrl(location), + // // }) + // // return + // } + + // resolve({ + // url: parseUrl(location), + // complete, + // fail, + // success, + // }) + // } else { + // // 没有token,先校验用户是否授权,如果授权了,进行自动登录 + // routerPermissions(parseUrl(location)) + // reject() + // } }).catch(error => { console.log(error) }) From 8aa46ec1d4d7f7b031b72cac4abbe2d53e68c248 Mon Sep 17 00:00:00 2001 From: Gao xiaosong <704041637@qq.com> Date: Sun, 18 Apr 2021 16:48:19 +0800 Subject: [PATCH 04/11] =?UTF-8?q?=E6=9C=AA=E7=99=BB=E5=BD=95=E7=94=A8?= =?UTF-8?q?=E6=88=B7=E5=85=81=E8=AE=B8=E8=AE=BF=E9=97=AE=E5=95=86=E5=93=81?= =?UTF-8?q?=E8=AF=A6=E6=83=85=E9=A1=B5=E9=9D=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- config/index.js | 2 +- pages/shop/GoodsCon/index.vue | 71 ++++++++++++++++++++--------------- 2 files changed, 41 insertions(+), 32 deletions(-) diff --git a/config/index.js b/config/index.js index 1bc2e16..b95b4d8 100644 --- a/config/index.js +++ b/config/index.js @@ -3,7 +3,7 @@ export const VUE_APP_API_URL = 'https://wxapi.yixiang.co/api' // export const VUE_APP_API_URL = 'http://139.186.134.205:9006/api' // export const VUE_APP_API_URL = 'http://192.168.31.223:8008/api' // export const VUE_APP_API_URL = 'http://natapp.xinxintuan.co/api'; -// export const VUE_APP_API_URL = 'https://tapi.xinxintuan.co/api' +// export const VUE_APP_API_URL = 'https://thapi.xinxintuan.co/api' // export const VUE_APP_API_URL = 'https://h5api.xinxintuan.co/api'; // export const VUE_APP_API_URL = 'https://h5api.xinxintuan.co/api'; export const VUE_APP_RESOURCES_URL = 'https://wx.yixiang.co/static' diff --git a/pages/shop/GoodsCon/index.vue b/pages/shop/GoodsCon/index.vue index 2838246..9d45a5f 100644 --- a/pages/shop/GoodsCon/index.vue +++ b/pages/shop/GoodsCon/index.vue @@ -229,7 +229,7 @@ export default { StorePoster, ShareInfo, }, - data: function () { + data: function() { return { shareInfoStatus: false, weixinStatus: false, @@ -287,13 +287,14 @@ export default { } }, computed: mapGetters(['isLogin', 'location']), - mounted: function () { + mounted: function() { this.$store.commit('get_to', 'goodcon') let url = handleQrCode() if (!url) { url = handleUrlParam(getCurrentPageUrlWithArgs()) } - this.coupons() + + const token = cookie.get('login_status') if (url && url.id) { this.id = url.id let urlSpread = parseInt(url.spread) @@ -303,7 +304,15 @@ export default { } else { this.id = this._route.query.id } + this.isIntegral = url.isIntegral == 'true' + + if (!token) { + this.productCon() + return + } + this.coupons() + this.productCon() this.setOpenShare() }, @@ -318,7 +327,7 @@ export default { }, }, methods: { - onShareAppMessage: function () { + onShareAppMessage: function() { return { title: this.storeInfo.storeName, imageUrl: this.storeInfo.image, @@ -368,7 +377,7 @@ export default { }, }) }, - showChang: function (data) { + showChang: function(data) { this.$yrouter.push({ path: '/pages/map/index', query: data, @@ -377,23 +386,23 @@ export default { updateTitle() { // document.title = this.storeInfo.storeName || this.$yroute.meta.title; }, - setShareInfoStatus: function () { + setShareInfoStatus: function() { this.shareInfoStatus = !this.shareInfoStatus this.posters = false }, - shareCode: function () { + shareCode: function() { var that = this getProductCode(that.id).then(res => { that.posterData.code = res.data.code that.listenerActionSheet() }) }, - setPosterImageStatus: function () { + setPosterImageStatus: function() { this.posterImageStatus = !this.posterImageStatus this.posters = false }, //产品详情接口; - productCon: function () { + productCon: function() { let that = this let from = this.location if (this.$deviceType == 'app') { @@ -453,7 +462,7 @@ export default { }) }, //默认选中属性; - DefaultSelect: function () { + DefaultSelect: function() { let productAttr = this.attr.productAttr let value = [] for (let i = 0; i < productAttr.length; i++) { @@ -495,7 +504,7 @@ export default { } }, //购物车; - ChangeCartNum: function (changeValue) { + ChangeCartNum: function(changeValue) { //changeValue:是否 加|减 //获取当前变动属性 let productSelect = this.productValue[this.attrValue] @@ -528,29 +537,29 @@ export default { } }, //将父级向子集多次传送的函数合二为一; - changeFun: function (opt) { + changeFun: function(opt) { if (typeof opt !== 'object') opt = {} let action = opt.action || '' let value = opt.value === undefined ? '' : opt.value this[action] && this[action](value) }, //打开优惠券插件; - couponTap: function () { + couponTap: function() { let that = this that.coupons() that.coupon.coupon = true }, - changecoupon: function (msg) { + changecoupon: function(msg) { this.coupon.coupon = msg this.coupons() }, - currentcoupon: function (res) { + currentcoupon: function(res) { let that = this that.coupon.coupon = false that.$set(that.coupon.list[res], 'is_use', true) }, //可领取优惠券接口; - coupons: function () { + coupons: function() { let that = this, q = { page: 1, @@ -562,18 +571,18 @@ export default { }) }, //打开属性插件; - selecAttrTap: function () { + selecAttrTap: function() { this.attr.cartAttr = true this.isOpen = true }, - changeattr: function (msg) { + changeattr: function(msg) { // 修改了规格 console.log(msg) this.attr.cartAttr = msg this.isOpen = false }, //选择属性; - ChangeAttr: function (res) { + ChangeAttr: function(res) { // 修改了规格 let productSelect = this.productValue[res.value] @@ -600,27 +609,27 @@ export default { } }, //收藏商品 - setCollect: function () { + setCollect: function() { let that = this, id = that.storeInfo.id, category = 'collect' if (that.storeInfo.userCollect) { - getCollectDel(id, category).then(function () { + getCollectDel(id, category).then(function() { that.storeInfo.userCollect = !that.storeInfo.userCollect }) } else { - getCollectAdd(id, category).then(function () { + getCollectAdd(id, category).then(function() { that.storeInfo.userCollect = !that.storeInfo.userCollect }) } }, // 点击加入购物车按钮 - joinCart: function () { + joinCart: function() { //0=加入购物车 this.goCat(0) }, // 加入购物车; - goCat: function (news) { + goCat: function(news) { let that = this, productSelect = that.productValue[this.attrValue] //打开属性 @@ -649,7 +658,7 @@ export default { uniqueId: that.attr.productSelect !== undefined ? that.attr.productSelect.unique : '', } postCartAdd(q) - .then(function (res) { + .then(function(res) { console.log(res) that.isOpen = false that.attr.cartAttr = false @@ -691,7 +700,7 @@ export default { }) }, //获取购物车数量 - getCartCount: function (isAnima) { + getCartCount: function(isAnima) { let that = this const isLogin = that.isLogin if (isLogin) { @@ -702,7 +711,7 @@ export default { //加入购物车后重置属性 if (isAnima) { that.animated = true - setTimeout(function () { + setTimeout(function() { that.animated = false }, 500) } @@ -710,20 +719,20 @@ export default { } }, //立即购买; - tapBuy: function () { + tapBuy: function() { // 1=直接购买 this.goCat(1) }, - listenerActionSheet: function () { + listenerActionSheet: function() { if (isWeixin() === true) { this.weixinStatus = true } this.posters = true }, - listenerActionClose: function () { + listenerActionClose: function() { this.posters = false }, - setOpenShare: function () { + setOpenShare: function() { var data = this.storeInfo var href = this.location.href if (this.$deviceType == 'weixin') { From bd14a8f88bfc33135fe40638fc4f0cb7a93f7724 Mon Sep 17 00:00:00 2001 From: Gao xiaosong <704041637@qq.com> Date: Sun, 18 Apr 2021 22:00:59 +0800 Subject: [PATCH 05/11] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E5=9B=BE=E7=89=87?= =?UTF-8?q?=E5=9C=B0=E5=9D=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- config/index.js | 2 +- main.js | 115 ++++++++++++++++++++++++++++++------------------ 2 files changed, 73 insertions(+), 44 deletions(-) diff --git a/config/index.js b/config/index.js index b95b4d8..d4da139 100644 --- a/config/index.js +++ b/config/index.js @@ -6,4 +6,4 @@ export const VUE_APP_API_URL = 'https://wxapi.yixiang.co/api' // export const VUE_APP_API_URL = 'https://thapi.xinxintuan.co/api' // export const VUE_APP_API_URL = 'https://h5api.xinxintuan.co/api'; // export const VUE_APP_API_URL = 'https://h5api.xinxintuan.co/api'; -export const VUE_APP_RESOURCES_URL = 'https://wx.yixiang.co/static' +export const VUE_APP_RESOURCES_URL = 'https://h5.yixiang.co/static' diff --git a/main.js b/main.js index 915d91d..955e520 100644 --- a/main.js +++ b/main.js @@ -8,14 +8,21 @@ import dialog from './utils/dialog' import cookie from '@/utils/store/cookie' import cuCustom from '@/components/colorui/components/cu-custom.vue' -import { parseRoute, _router, parseQuery } from '@/utils' -import { VUE_APP_RESOURCES_URL, VUE_APP_API_URL } from '@/config' +import { + parseRoute, + _router, + parseQuery +} from '@/utils' +import { + VUE_APP_RESOURCES_URL, + VUE_APP_API_URL +} from '@/config' Vue.component('cu-custom', cuCustom) Vue.config.productionTip = false Vue.config.devtools = process.env.NODE_ENV !== 'production' Vue.prototype.$validator = function(rule) { - return new schema(rule) + return new schema(rule) } Vue.config.productionTip = false @@ -23,20 +30,20 @@ App.mpType = 'app' Vue.prototype.$store = store const app = new Vue({ - ...App, - store, + ...App, + store, }) Object.defineProperty(Vue.prototype, '$yrouter', { - get() { - return _router - }, + get() { + return _router + }, }) Object.defineProperty(Vue.prototype, '$yroute', { - get() { - return this._route - }, + get() { + return this._route + }, }) Vue.prototype.$VUE_APP_API_URL = VUE_APP_API_URL @@ -64,19 +71,35 @@ deviceType = 'routine' // #ifdef H5 // H5编译的代码 -import { wechat, clearAuthStatus, oAuth, auth, toAuth, pay, openAddress, openShareAll, openShareAppMessage, openShareTimeline, wechatEvevt, ready, wxShowLocation } from '@/libs/wechat' - -import { isWeixin } from '@/utils' +import { + wechat, + clearAuthStatus, + oAuth, + auth, + toAuth, + pay, + openAddress, + openShareAll, + openShareAppMessage, + openShareTimeline, + wechatEvevt, + ready, + wxShowLocation +} from '@/libs/wechat' + +import { + isWeixin +} from '@/utils' const CACHE_KEY = 'clear_0.0.1' if (!cookie.has(CACHE_KEY)) { - cookie.clearAll() - cookie.set(CACHE_KEY, 1) + cookie.clearAll() + cookie.set(CACHE_KEY, 1) } var urlSpread = parseQuery()['spread'] if (urlSpread) { - cookie.set('spread', urlSpread) + cookie.set('spread', urlSpread) } // #endif @@ -84,39 +107,45 @@ if (urlSpread) { // #ifdef H5 // H5编译的代码 // 判断是否是微信浏览器 -if (isWeixin()) { - deviceType = 'weixin' - let wechatInit = await wechat() - if (wechatInit) { - await oAuth() - } -} else { - deviceType = 'weixinh5' +async function init() { + + if (isWeixin()) { + deviceType = 'weixin' + let wechatInit = wechat(); + if (wechatInit) { + await oAuth() + } + } else { + deviceType = 'weixinh5' + } } +init() // #endif Vue.prototype.$deviceType = deviceType Vue.mixin({ - onLoad() { - const { $mp } = this.$root - this._route = parseRoute($mp) - }, - onShow() { - _router.app = this - _router.currentRoute = this._route - }, - // 这里为了解决 .vue文件中 template 无法获取 VUE.prototype 绑定的变量 - computed: { - $VUE_APP_RESOURCES_URL() { - return VUE_APP_RESOURCES_URL - }, - $deviceType() { - return deviceType - }, - }, + onLoad() { + const { + $mp + } = this.$root + this._route = parseRoute($mp) + }, + onShow() { + _router.app = this + _router.currentRoute = this._route + }, + // 这里为了解决 .vue文件中 template 无法获取 VUE.prototype 绑定的变量 + computed: { + $VUE_APP_RESOURCES_URL() { + return VUE_APP_RESOURCES_URL + }, + $deviceType() { + return deviceType + }, + }, }) store.commit('updateDevicetype', deviceType) -app.$mount() +app.$mount() From a20612f08288aa5ace22d6eb92b57bc66316429e Mon Sep 17 00:00:00 2001 From: Gao xiaosong <704041637@qq.com> Date: Sun, 18 Apr 2021 22:21:02 +0800 Subject: [PATCH 06/11] =?UTF-8?q?=E6=81=A2=E5=A4=8D=E5=88=97=E8=A1=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pages/shop/GoodsList/index.vue | 221 ++++++--------------------------- 1 file changed, 41 insertions(+), 180 deletions(-) diff --git a/pages/shop/GoodsList/index.vue b/pages/shop/GoodsList/index.vue index d36d4f6..56a4bbe 100644 --- a/pages/shop/GoodsList/index.vue +++ b/pages/shop/GoodsList/index.vue @@ -26,90 +26,41 @@ 新品 - - - - - - - - - - - {{ item.storeName }} - - - ¥{{ item.price }} - ¥{{ item.otPrice }} - - 已售{{ item.sales }}件 - - - - - - - - - - - - - {{ item.storeName }} - - - ¥{{ item.price }} - ¥{{ item.otPrice }} - - 已售{{ item.sales }}件 - - - - - - - - - - - - - - - - - {{ item.storeName }} - - - {{ item.integral }}积分 - - 已售{{ item.sales }}件 - - - - - - - - - - - - - {{ item.storeName }} - - - {{ item.integral }}积分 - - 已售{{ item.sales }}件 - - - - - - - - + + + + + + + {{ item.storeName }} + + ¥ + {{ item.price }} + + + ¥{{ item.otPrice }} + 已售{{ item.sales }}件 + + + + + + + + + + + {{ item.storeName }} + + {{ item.integral }}积分 + + + + 已售{{ item.sales }}件 + + + + @@ -131,7 +82,7 @@ export default { Loading, }, props: {}, - data: function () { + data: function() { // const { s = "", id = 0, title = "" } = this.$yroute.query; const s = '', id = 0, @@ -195,7 +146,7 @@ export default { // } }, }, - mounted: function () { + mounted: function() { const { s = '', id = 0, title = '', isIntegral = false } = this.$yroute.query this.where.keyword = s @@ -287,7 +238,7 @@ export default { that.where.page = that.where.page + 1 }) }, - submitForm: function () { + submitForm: function() { this.$set(this, 'productList', []) this.where.page = 1 this.loadend = false @@ -295,7 +246,7 @@ export default { this.getProductList() }, //点击事件处理 - set_where: function (index) { + set_where: function(index) { let that = this switch (index) { case 0: @@ -328,7 +279,7 @@ export default { that.getProductList() }, //设置where条件 - setWhere: function () { + setWhere: function() { let that = this if (that.price === 0) { that.where.priceOrder = '' @@ -346,7 +297,7 @@ export default { } that.where.news = that.nows ? '1' : '0' }, - switchTap: function () { + switchTap: function() { let that = this that.Switch = !that.Switch }, @@ -358,94 +309,4 @@ export default { border-top: 3px solid #f5f5f5; padding-bottom: 1px; } - -.tui-product-list { - display: flex; - box-sizing: border-box; - margin-top: 1.72*100rpx; -} - -.tui-product-container { - display: flex; - flex-direction: row; - flex-wrap: wrap; - flex:1; - justify-content: space-between; - -} - -.tui-product-container:last-child { - margin-right: 0; -} - -.tui-pro-item { - flex: 0 0 49%; - margin-bottom: 10rpx; - background: #fff; - box-sizing: border-box; - border-radius: 12rpx; - overflow: hidden; - transition: all 0.15s ease-in-out; -} - -.tui-flex-list { - flex:1 1 100%; - display: flex; - margin-bottom: 1rpx !important; -} - -.tui-pro-img { - width: 100%; - display: block; -} - -.tui-proimg-list { - width: 260rpx; - height: 260rpx !important; - flex-shrink: 0; - border-radius: 12rpx; -} - -.tui-pro-content { - display: flex; - flex-direction: column; - justify-content: space-between; - box-sizing: border-box; - padding: 20rpx; -} - -.tui-pro-tit { - color: #2e2e2e; - font-size: 26rpx; - word-break: break-all; - overflow: hidden; - text-overflow: ellipsis; - display: -webkit-box; - -webkit-box-orient: vertical; - -webkit-line-clamp: 2; -} - -.tui-pro-price { - padding-top: 18rpx; -} - -.tui-sale-price { - font-size: 34rpx; - font-weight: 500; - color: #e41f19; -} - -.tui-factory-price { - font-size: 24rpx; - color: #a0a0a0; - text-decoration: line-through; - padding-left: 12rpx; -} - -.tui-pro-pay { - padding-top: 10rpx; - font-size: 24rpx; - color: #656565; -} -/* 商品列表*/ From 1d69e0ba3a8ea30b8b16231d7636f609b0de2e0a Mon Sep 17 00:00:00 2001 From: Gao xiaosong <704041637@qq.com> Date: Mon, 19 Apr 2021 11:40:14 +0800 Subject: [PATCH 07/11] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E6=97=A0=E6=B3=95?= =?UTF-8?q?=E8=BF=9B=E5=85=A5=E7=A7=92=E6=9D=80=E5=95=86=E5=93=81=E7=9A=84?= =?UTF-8?q?=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- components/t-goods-item/t-goods-item.vue | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/components/t-goods-item/t-goods-item.vue b/components/t-goods-item/t-goods-item.vue index 1543b89..4650a07 100644 --- a/components/t-goods-item/t-goods-item.vue +++ b/components/t-goods-item/t-goods-item.vue @@ -23,10 +23,10 @@ - 马上抢 + 马上抢 已售磬 即将开始 - 已结束 + 已结束 @@ -89,7 +89,7 @@ export default { // this.tui.href(`../seckillDetail/seckillDetail?status=${this.status}`) // }, goDetail: function() { - this.$emit('goDetail', item) + this.$emit('goDetail', this.item) }, }, } From c3618175f9f21481dffe4fd92af4f7b5d1b74885 Mon Sep 17 00:00:00 2001 From: Gao xiaosong <704041637@qq.com> Date: Mon, 19 Apr 2021 14:46:53 +0800 Subject: [PATCH 08/11] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E7=A7=92=E6=9D=80?= =?UTF-8?q?=E5=95=86=E5=93=81=E7=8A=B6=E6=80=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- components/t-goods-item/t-goods-item.vue | 22 +++++++++++++--------- pages/activity/GoodsSeckill/index.vue | 6 +++--- 2 files changed, 16 insertions(+), 12 deletions(-) diff --git a/components/t-goods-item/t-goods-item.vue b/components/t-goods-item/t-goods-item.vue index 4650a07..033e062 100644 --- a/components/t-goods-item/t-goods-item.vue +++ b/components/t-goods-item/t-goods-item.vue @@ -1,5 +1,5 @@