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 @@
-
-
-
-
-
- {{ item.componentContent.title }}
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+ {{ item.componentContent.title }}
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
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 }}积分
@@ -150,32 +132,17 @@
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 @@
-
+
{{ item.storeName }}
- ¥{{ item.price }}
+ {{ item.costPrice }}积分
+ ¥{{ item.price }}
删除
-
+
@@ -33,70 +25,77 @@
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 @@
-
+
{{ item.storeName }}
- ¥{{ item.price }}
+ {{ item.costPrice }}积分
+ ¥{{ item.price }}
删除
-
+
@@ -33,70 +25,77 @@
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 @@
-
+
@@ -23,10 +23,10 @@
- 马上抢
- 已售磬
- 即将开始
- 已结束
+ 马上抢
+ 已售磬
+ 即将开始
+ 已结束
@@ -53,6 +53,14 @@ export default {
type: Number,
default: 2,
},
+ timeList: {
+ type: Array,
+ default: [],
+ },
+ active: {
+ type: Number,
+ default: 0,
+ },
},
filters: {
getBtnText(status, subscribe) {
@@ -84,10 +92,6 @@ export default {
return {}
},
methods: {
- // detail() {
- // //项目中应该传id
- // this.tui.href(`../seckillDetail/seckillDetail?status=${this.status}`)
- // },
goDetail: function() {
this.$emit('goDetail', this.item)
},
diff --git a/pages/activity/GoodsSeckill/index.vue b/pages/activity/GoodsSeckill/index.vue
index 05583fb..60df6de 100644
--- a/pages/activity/GoodsSeckill/index.vue
+++ b/pages/activity/GoodsSeckill/index.vue
@@ -45,12 +45,12 @@
-
+
-
+
@@ -189,7 +189,7 @@ export default {
query: {
id: item.id,
time,
- status: item.status,
+ status: that.timeList[that.active].status,
},
})
},
From 1cf7f78b7c2ece440722d1bc9f8591be899a5706 Mon Sep 17 00:00:00 2001
From: Gao xiaosong <704041637@qq.com>
Date: Mon, 19 Apr 2021 15:00:07 +0800
Subject: [PATCH 09/11] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E5=BE=AE=E4=BF=A1?=
=?UTF-8?q?=E6=94=AF=E4=BB=98=E6=97=A0=E6=B3=95=E4=BD=BF=E7=94=A8=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
---
libs/wechat.js | 331 +++++++++++++++++++++++++------------------------
1 file changed, 166 insertions(+), 165 deletions(-)
diff --git a/libs/wechat.js b/libs/wechat.js
index 222a4a4..f7a70b0 100644
--- a/libs/wechat.js
+++ b/libs/wechat.js
@@ -1,36 +1,39 @@
-import { subscribeMessage } from "@/libs/order";
-import { getProvider } from "@/utils";
-import WechatJSSDK from "wechat-jssdk/dist/client.umd";
-import { getWechatConfig, wechatAuth } from "@/api/public";
-import { parseQuery } from "@/utils";
-import cookie from "@/utils/store/cookie";
-import store from "@/store";
-import dayjs from "dayjs";
+import { subscribeMessage } from '@/libs/order'
+import { getProvider } from '@/utils'
+import WechatJSSDK from 'wechat-jssdk/dist/client.umd'
+import { getWechatConfig, wechatAuth } from '@/api/public'
+import { parseQuery } from '@/utils'
+import cookie from '@/utils/store/cookie'
+import store from '@/store'
+import dayjs from 'dayjs'
// 支付模块
-export const weappPay = (option) => {
+export const weappPay = option => {
return new Promise((resolve, reject) => {
if (store.state.$deviceType == 'weixinh5') {
setTimeout(() => {
- location.href = option.mweb_url;
- }, 100);
+ location.href = option.mweb_url
+ }, 100)
resolve()
return
}
if (store.state.$deviceType == 'weixin') {
- pay(option).then(() => {
- uni.showToast({
- title: '支付成功', icon: 'success', duration: 5000,
- });
- resolve()
- })
+ pay(option)
+ .then(() => {
+ uni.showToast({
+ title: '支付成功',
+ icon: 'success',
+ duration: 5000,
+ })
+ resolve()
+ })
.finally(res => {
//if(typeof(res) == "undefined") return
})
- .catch(function () {
- uni.showToast({ title: '支付失败', icon: 'none', duration: 5000 });
+ .catch(function() {
+ uni.showToast({ title: '支付失败', icon: 'none', duration: 5000 })
reject()
- });
+ })
return
}
// 吊起微信支付
@@ -48,13 +51,15 @@ export const weappPay = (option) => {
uni.requestPayment({
provider: 'wxpay',
...option,
- timestamp: orderInfo.timestamp,
+ timeStamp: orderInfo.timestamp,
orderInfo,
- success: (success) => {
+ success: success => {
console.log(success)
uni.showToast({
- title: '支付成功', icon: 'success', duration: 5000,
- });
+ title: '支付成功',
+ icon: 'success',
+ duration: 5000,
+ })
let time = setTimeout(() => {
clearTimeout(time)
resolve(success)
@@ -63,28 +68,26 @@ export const weappPay = (option) => {
subscribeMessage()
// #endif
},
- fail: (error) => {
+ fail: error => {
console.log(error)
if (error.errMsg == 'requestPayment:fail cancel') {
- uni.showToast({ title: '已取消支付', icon: 'none', duration: 5000 });
+ uni.showToast({ title: '已取消支付', icon: 'none', duration: 5000 })
} else {
- uni.showToast({ title: error || error.msg, icon: 'none', duration: 5000 });
+ uni.showToast({ title: error || error.msg, icon: 'none', duration: 5000 })
}
reject(error)
- }
+ },
})
// })
})
}
-
-
-const STATE_KEY = "wx_authorize_state";
-const WX_AUTH = "wx_auth";
-const BACK_URL = "login_back_url";
-const LOGINTYPE = "loginType";
-let instance;
-let wechatObj;
+const STATE_KEY = 'wx_authorize_state'
+const WX_AUTH = 'wx_auth'
+const BACK_URL = 'login_back_url'
+const LOGINTYPE = 'loginType'
+let instance
+let wechatObj
let appId
let wechatLoading = false
@@ -92,41 +95,41 @@ export function wechat() {
console.log('初始化微信配置')
wechatLoading = false
return new Promise((resolve, reject) => {
- if (instance) return resolve(instance);
+ if (instance) return resolve(instance)
getWechatConfig()
.then(res => {
console.log(res.data)
- const _wx = WechatJSSDK(res.data);
+ const _wx = WechatJSSDK(res.data)
console.log(_wx)
appId = res.data.appId
- wechatObj = _wx;
+ wechatObj = _wx
_wx
.initialize()
.then(() => {
- instance = _wx.wx;
- instance.initConfig = res.data;
- resolve(instance);
+ instance = _wx.wx
+ instance.initConfig = res.data
+ resolve(instance)
})
.catch(error => {
console.log(error)
uni.showToast({
title: error,
- icon: "none",
- duration: 2000
- });
+ icon: 'none',
+ duration: 2000,
+ })
reject()
- });
+ })
})
.catch(err => {
- console.log(err);
- reject();
- });
- });
+ console.log(err)
+ reject()
+ })
+ })
}
export function clearAuthStatus() {
- cookie.remove(WX_AUTH);
- cookie.remove(STATE_KEY);
+ cookie.remove(WX_AUTH)
+ cookie.remove(STATE_KEY)
}
export async function oAuth() {
@@ -137,11 +140,11 @@ export async function oAuth() {
// if (cookie.has(WX_AUTH)) {
if (cookie.has(WX_AUTH) && store.state.token) {
reject()
- return;
+ return
}
- const { code } = parseQuery();
+ const { code } = parseQuery()
if (!code) {
- toAuth();
+ toAuth()
return
} else {
auth(code)
@@ -155,24 +158,24 @@ export async function oAuth() {
export async function auth(code) {
console.log('获取微信授权')
return new Promise((resolve, reject) => {
- let loginType = cookie.get(LOGINTYPE);
- let spread = cookie.get('spread');
+ let loginType = cookie.get(LOGINTYPE)
+ let spread = cookie.get('spread')
console.log('微信授权登录前获取spread', spread)
wechatAuth(code, spread, loginType)
.then(({ data }) => {
console.log(data)
- const expires_time = dayjs(data.expires_time);
- const newTime = Math.round(new Date() / 1000);
- store.commit("login", data.token, expires_time - newTime);
- cookie.set(WX_AUTH, code, expires_time);
- cookie.remove(STATE_KEY);
- loginType && cookie.remove(LOGINTYPE);
+ const expires_time = dayjs(data.expires_time)
+ const newTime = Math.round(new Date() / 1000)
+ store.commit('login', data.token, expires_time - newTime)
+ cookie.set(WX_AUTH, code, expires_time)
+ cookie.remove(STATE_KEY)
+ loginType && cookie.remove(LOGINTYPE)
console.log('微信公众号授权登录,获取用户信息')
store.dispatch('getUser').finally(() => {
- resolve();
+ resolve()
})
})
- .catch(reject);
+ .catch(reject)
}).catch(error => {
console.log(error)
})
@@ -184,27 +187,26 @@ export async function toAuth() {
}
wechatLoading = true
wechat().then(wx => {
- location.href = getAuthUrl(appId);
- });
+ location.href = getAuthUrl(appId)
+ })
}
function getAuthUrl(appId) {
-
// const redirect_uri = encodeURIComponent(window.location.href);
// const redirect_uri = encodeURIComponent(`${location.origin}/pages/Loading/index`);
// #ifdef H5
// #endif
cookie.set('redirect', window.location.href)
- const redirect_uri = encodeURIComponent(`${location.origin}/pages/Loading/index`);
+ const redirect_uri = encodeURIComponent(`${location.origin}/pages/Loading/index`)
// const redirect_uri = encodeURIComponent(`${location.origin}/pages/Loading/index?path=${encodeURIComponent(window.location.href)}`);
// const redirect_uri = encodeURIComponent(`${window.location.origin}${window.location.pathname}`)
// const redirect_uri = encodeURIComponent(`${location.origin}`)
- cookie.remove(BACK_URL);
+ cookie.remove(BACK_URL)
const state = 'STATE'
// const state = encodeURIComponent(("" + Math.random()).split(".")[1] + "authorizestate");
- cookie.set(STATE_KEY, state);
- return `https://open.weixin.qq.com/connect/oauth2/authorize?appid=${appId}&redirect_uri=${redirect_uri}&response_type=code&scope=snsapi_userinfo&state=STATE#wechat_redirect`;
+ cookie.set(STATE_KEY, state)
+ return `https://open.weixin.qq.com/connect/oauth2/authorize?appid=${appId}&redirect_uri=${redirect_uri}&response_type=code&scope=snsapi_userinfo&state=STATE#wechat_redirect`
}
function toPromise(fn, config = {}) {
@@ -212,185 +214,184 @@ function toPromise(fn, config = {}) {
fn({
...config,
success(res) {
- resolve(res);
+ resolve(res)
},
fail(err) {
- reject(err);
+ reject(err)
},
complete(err) {
- reject(err);
+ reject(err)
},
cancel(err) {
- reject(err);
- }
- });
- });
+ reject(err)
+ },
+ })
+ })
}
export function pay(config) {
console.log(instance)
- return toPromise(instance.chooseWXPay, config);
+ return toPromise(instance.chooseWXPay, config)
}
export function openAddress() {
return new Promise((resolve, reject) => {
- wechatEvevt("openAddress", {})
+ wechatEvevt('openAddress', {})
.then(res => {
- resolve(res);
+ resolve(res)
})
.catch(res => {
if (res.is_ready) {
res.wx.openAddress({
fail(res) {
- reject(res);
+ reject(res)
},
success(res) {
- resolve(res);
- }
- });
+ resolve(res)
+ },
+ })
} else {
- reject(res);
+ reject(res)
}
- });
- });
+ })
+ })
}
export function openShareAll(config) {
- config || {};
- config.type = config.type == undefined ? "link" : config.type;
+ config || {}
+ config.type = config.type == undefined ? 'link' : config.type
return new Promise(resolve => {
getWechatConfig().then(res => {
wechatObj.signSignature({
nonceStr: res.data.nonceStr,
signature: res.data.signature,
- timestamp: res.data.timestamp
- });
- instance = wechatObj.getOriginalWx();
+ timestamp: res.data.timestamp,
+ })
+ instance = wechatObj.getOriginalWx()
instance.ready(() => {
- instance.updateAppMessageShareData(config);
- instance.updateTimelineShareData(config);
- resolve();
- });
- });
- });
+ instance.updateAppMessageShareData(config)
+ instance.updateTimelineShareData(config)
+ resolve()
+ })
+ })
+ })
}
export function openShareAppMessage(config) {
- instance.updateAppMessageShareData(config);
- instance.onMenuShareAppMessage && instance.onMenuShareAppMessage(config);
+ instance.updateAppMessageShareData(config)
+ instance.onMenuShareAppMessage && instance.onMenuShareAppMessage(config)
}
export function openShareTimeline(config) {
- instance.updateTimelineShareData(config);
- instance.onMenuShareTimeline && instance.onMenuShareTimeline(config);
+ instance.updateTimelineShareData(config)
+ instance.onMenuShareTimeline && instance.onMenuShareTimeline(config)
}
export function wechatEvevt(name, config) {
return new Promise((resolve, reject) => {
- let wx;
+ let wx
let configDefault = {
fail(res) {
- if (wx) return reject({ is_ready: true, wx: wx });
+ if (wx) return reject({ is_ready: true, wx: wx })
getWechatConfig().then(res => {
wechatObj.signSignature({
nonceStr: res.data.nonceStr,
signature: res.data.signature,
- timestamp: res.data.timestamp
- });
- wx = wechatObj.getOriginalWx();
- reject({ is_ready: true, wx: wx });
- });
+ timestamp: res.data.timestamp,
+ })
+ wx = wechatObj.getOriginalWx()
+ reject({ is_ready: true, wx: wx })
+ })
},
success(res) {
- resolve(res);
- }
- };
- Object.assign(configDefault, config);
- if (typeof instance !== "undefined") {
+ resolve(res)
+ },
+ }
+ Object.assign(configDefault, config)
+ if (typeof instance !== 'undefined') {
instance.ready(() => {
- if (typeof name === "object") {
+ if (typeof name === 'object') {
name.forEach(item => {
- instance[item] && instance[item](configDefault);
- });
- } else instance[name] && instance[name](configDefault);
- });
+ instance[item] && instance[item](configDefault)
+ })
+ } else instance[name] && instance[name](configDefault)
+ })
} else {
getWechatConfig().then(res => {
- const _wx = WechatJSSDK(res.data);
+ const _wx = WechatJSSDK(res.data)
_wx.initialize().then(() => {
- instance = _wx.getOriginalWx();
+ instance = _wx.getOriginalWx()
instance.ready(() => {
- if (typeof name === "object") {
+ if (typeof name === 'object') {
name.forEach(item => {
- instance[item] && instance[item](configDefault);
- });
- } else instance[name] && instance[name](configDefault);
- });
- });
- });
+ instance[item] && instance[item](configDefault)
+ })
+ } else instance[name] && instance[name](configDefault)
+ })
+ })
+ })
}
- });
+ })
}
export function ready() {
return new Promise(resolve => {
- if (typeof instance !== "undefined") {
+ if (typeof instance !== 'undefined') {
instance.ready(() => {
- resolve(instance);
- });
+ resolve(instance)
+ })
} else {
getWechatConfig().then(res => {
- const _wx = WechatJSSDK(res.data);
+ const _wx = WechatJSSDK(res.data)
_wx.initialize().then(() => {
- instance = _wx.wx;
+ instance = _wx.wx
instance.ready(() => {
- resolve(instance);
- });
- });
- });
+ resolve(instance)
+ })
+ })
+ })
}
- });
+ })
}
export function wxShowLocation() {
return new Promise(() => {
- wechatEvevt("getLocation", { type: "wgs84" })
+ wechatEvevt('getLocation', { type: 'wgs84' })
.then(res => {
- let latitude = res.latitude; // 纬度
- let longitude = res.longitude; // 经度
- cookie.set(LATITUDE, latitude);
- cookie.set(LONGITUDE, longitude);
+ let latitude = res.latitude // 纬度
+ let longitude = res.longitude // 经度
+ cookie.set(LATITUDE, latitude)
+ cookie.set(LONGITUDE, longitude)
})
.catch(res => {
if (res.is_ready) {
res.wx.getLocation({
success(res) {
- let latitude = res.latitude; // 纬度
- let longitude = res.longitude; // 经度
- cookie.set(LATITUDE, latitude);
- cookie.set(LONGITUDE, longitude);
+ let latitude = res.latitude // 纬度
+ let longitude = res.longitude // 经度
+ cookie.set(LATITUDE, latitude)
+ cookie.set(LONGITUDE, longitude)
},
cancel() {
- cookie.remove(LATITUDE);
- cookie.remove(LONGITUDE);
+ cookie.remove(LATITUDE)
+ cookie.remove(LONGITUDE)
uni.showToast({
- title: "取消获取位置",
- icon: "none",
+ title: '取消获取位置',
+ icon: 'none',
duration: 2000,
- });
+ })
},
fail() {
- cookie.remove(LATITUDE);
- cookie.remove(LONGITUDE);
+ cookie.remove(LATITUDE)
+ cookie.remove(LONGITUDE)
uni.showToast({
- title: "授权失败",
- icon: "none",
+ title: '授权失败',
+ icon: 'none',
duration: 2000,
- });
- }
- });
+ })
+ },
+ })
}
- });
- });
+ })
+ })
}
-
From 87bb537187c98ea9c960dd3fcf170f28d6ecd695 Mon Sep 17 00:00:00 2001
From: Gao xiaosong <704041637@qq.com>
Date: Mon, 19 Apr 2021 15:33:15 +0800
Subject: [PATCH 10/11] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E5=BE=AE=E4=BF=A1?=
=?UTF-8?q?=E6=94=AF=E4=BB=98=E6=97=A0=E6=B3=95=E4=BD=BF=E7=94=A8=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
---
main.js | 111 ++++++++++----------------
pages/order/OrderSubmission/index.vue | 17 ++--
2 files changed, 50 insertions(+), 78 deletions(-)
diff --git a/main.js b/main.js
index 955e520..8abffd1 100644
--- a/main.js
+++ b/main.js
@@ -8,21 +8,14 @@ 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
@@ -30,20 +23,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
@@ -71,35 +64,19 @@ 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
@@ -108,16 +85,15 @@ if (urlSpread) {
// H5编译的代码
// 判断是否是微信浏览器
async function init() {
-
- if (isWeixin()) {
- deviceType = 'weixin'
- let wechatInit = wechat();
- if (wechatInit) {
- await oAuth()
- }
- } else {
- deviceType = 'weixinh5'
- }
+ if (isWeixin()) {
+ deviceType = 'weixin'
+ let wechatInit = wechat()
+ if (wechatInit) {
+ await oAuth()
+ }
+ } else {
+ deviceType = 'weixinh5'
+ }
}
init()
// #endif
@@ -125,27 +101,22 @@ init()
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
+ },
+ },
})
store.commit('updateDevicetype', deviceType)
-app.$mount()
+app.$mount()
diff --git a/pages/order/OrderSubmission/index.vue b/pages/order/OrderSubmission/index.vue
index 61cd79a..9da39db 100644
--- a/pages/order/OrderSubmission/index.vue
+++ b/pages/order/OrderSubmission/index.vue
@@ -268,7 +268,7 @@ export default {
AddressWindow,
},
props: {},
- data: function () {
+ data: function() {
return {
offlinePayStatus: 2,
from: this.$deviceType,
@@ -313,7 +313,7 @@ export default {
this.computedPrice()
},
},
- onShow: function () {
+ onShow: function() {
let that = this
this.$store.dispatch('getUser', true)
that.getCartInfo()
@@ -338,7 +338,7 @@ export default {
path: '/pages/shop/StoreList/index',
})
},
- addressType: function (index) {
+ addressType: function(index) {
if (index && !this.systemStore.id) {
uni.showToast({
title: '暂无门店信息,您无法选择到店自提!',
@@ -350,7 +350,7 @@ export default {
console.log(this)
this.shipping_type = index
},
- changeUseIntegral: function (e) {
+ changeUseIntegral: function(e) {
// this.computedPrice();
if (this.isIntegral) {
return
@@ -410,7 +410,7 @@ export default {
})
})
},
- addressTap: function () {
+ addressTap: function() {
this.showAddress = true
if (!this.addressLoaded) {
this.addressLoaded = true
@@ -421,10 +421,10 @@ export default {
this.addressLoaded = false
this.showAddress = false
},
- couponTap: function () {
+ couponTap: function() {
this.showCoupon = true
},
- changeCoupon: function (coupon) {
+ changeCoupon: function(coupon) {
if (!coupon) {
this.usableCoupon = {
couponTitle: '不使用优惠券',
@@ -435,7 +435,7 @@ export default {
}
this.computedPrice()
},
- payItem: function (index) {
+ payItem: function(index) {
this.active = index
},
changeAddress(addressInfo) {
@@ -508,6 +508,7 @@ export default {
if (this.$deviceType == 'app') {
from.from = 'app'
}
+ console.log(this.$deviceType)
// #ifdef MP-WEIXIN
subscribeMessage()
// #endif
From 2a9492cac43ba47a5ba0aad8f1cbb4c1f2b08e31 Mon Sep 17 00:00:00 2001
From: Gao xiaosong <704041637@qq.com>
Date: Mon, 19 Apr 2021 15:34:01 +0800
Subject: [PATCH 11/11] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E5=BE=AE=E4=BF=A1?=
=?UTF-8?q?=E6=94=AF=E4=BB=98=E6=97=A0=E6=B3=95=E4=BD=BF=E7=94=A8=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
---
libs/wechat.js | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/libs/wechat.js b/libs/wechat.js
index f7a70b0..2b35c88 100644
--- a/libs/wechat.js
+++ b/libs/wechat.js
@@ -51,7 +51,7 @@ export const weappPay = option => {
uni.requestPayment({
provider: 'wxpay',
...option,
- timeStamp: orderInfo.timestamp,
+ timestamp: orderInfo.timestamp,
orderInfo,
success: success => {
console.log(success)