diff --git a/common/common.js b/common/common.js
index 7cb60e3..a2ec4af 100644
--- a/common/common.js
+++ b/common/common.js
@@ -7,423 +7,504 @@ import Vue from 'vue'
// 防止处理多次点击
function noMultipleClicks(methods, info) {
- // methods是点击后需要执行的函数, info是函数需要传的参数
- let that = this
- if (that.noClick) {
- // 第一次点击
- that.noClick = false
- if ((info && info !== '') || info == 0) {
- // info是执行函数需要传的参数
- methods(info)
- } else {
- methods()
- }
- setTimeout(() => {
- that.noClick = true
- }, 2000)
- } else {
- // 这里是重复点击的判断
- }
+ // methods是点击后需要执行的函数, info是函数需要传的参数
+ let that = this
+ if (that.noClick) {
+ // 第一次点击
+ that.noClick = false
+ if ((info && info !== '') || info == 0) {
+ // info是执行函数需要传的参数
+ methods(info)
+ } else {
+ methods()
+ }
+ setTimeout(() => {
+ that.noClick = true
+ }, 2000)
+ } else {
+ // 这里是重复点击的判断
+ }
}
//导出
export default {
- data: {
- loading: false,
- timer: null
- },
+ data: {
+ loading: false,
+ timer: null
+ },
- noMultipleClicks, // 禁止多次点击
+ noMultipleClicks, // 禁止多次点击
- /* 获取日期 */
- getDateTime() {
- const date = new Date()
+ /* 获取日期 */
+ getDateTime() {
+ const date = new Date()
- const year = date.getFullYear().toString()
- const monty = (date.getMonth() + 1).toString()
- const day = date.getDate().toString()
+ const year = date.getFullYear().toString()
+ const monty = (date.getMonth() + 1).toString()
+ const day = date.getDate().toString()
- return `${year}-${monty}-${day}`
- },
+ return `${year}-${monty}-${day}`
+ },
- detailPageTitle(obj) {
- if (!obj) {
- return ''
- }
+ detailPageTitle(obj) {
+ if (!obj) {
+ return ''
+ }
- const types = {
- 1: '一番赏',
- 2: '无限赏',
- 3: '擂台赏',
- 4: '抽卡机',
- 5: '积分赏',
- 6: '全局赏',
- 7: '福利盲盒',
- 8: '领主赏',
- 9: '连击赏'
- }
+ const types = {
+ 1: '一番赏',
+ 2: '无限赏',
+ 3: '擂台赏',
+ 4: '抽卡机',
+ 5: '积分赏',
+ 6: '全局赏',
+ 7: '福利盲盒',
+ 8: '领主赏',
+ 9: '连击赏'
+ }
- const target = types[obj.type]
- return target
- },
+ const target = types[obj.type]
+ return target
+ },
- navTo(item) {
- /* 领券中心 */
- if (item.ttype == 1) {
- this.to({
- url: '/package/index/coupon-center',
- query: {
- coupon_id: item.coupon_id
- }
- })
- }
+ navTo(item) {
+ /* 领券中心 */
+ if (item.ttype == 1) {
+ this.to({
+ url: '/package/index/coupon-center',
+ query: {
+ coupon_id: item.coupon_id
+ }
+ })
+ }
- if (item.goods_id > 0) {
- if (item.ttype == 2) {
- /* 一番赏 */
- this.to({
- url: '/pages/shouye/detail',
- query: {
- goods_id: item.goods_id
- }
- })
- }
+ if (item.goods_id > 0) {
+ if (item.ttype == 2) {
+ /* 一番赏 */
+ this.to({
+ url: '/pages/shouye/detail',
+ query: {
+ goods_id: item.goods_id
+ }
+ })
+ }
- /* 无限赏 */
- if (item.ttype == 3) {
- this.to({
- url: '/pages/shouye/detail_wuxian',
- query: {
- goods_id: item.goods_id
- }
- })
- }
+ /* 无限赏 */
+ if (item.ttype == 3) {
+ this.to({
+ url: '/pages/shouye/detail_wuxian',
+ query: {
+ goods_id: item.goods_id
+ }
+ })
+ }
- /* 连击赏 */
- if (item.ttype == 4) {
- this.to({
- url: '/package/index/lian-ji',
- query: {
- goods_id: item.goods_id
- }
- })
- }
- }
- },
+ /* 连击赏 */
+ if (item.ttype == 4) {
+ this.to({
+ url: '/package/index/lian-ji',
+ query: {
+ goods_id: item.goods_id
+ }
+ })
+ }
+ }
+ },
- /**
- * @description: 微信支付(小程序)
- * @param {*}
- * @return {*}
- */
- wxMpPay({ provider = 'weixin', data }) {
- console.log('wxdata', data)
- // #ifdef H5
- console.log('进入h5支付', data)
- return new Promise((resolve, reject) => {
- WeixinJSBridge.invoke(
- 'getBrandWCPayRequest', data,
- function (res) {
- console.log('支付回调', res);
- if (res.errMsg == 'requestPayment:fail cancel') {
- uni.showToast({
- title: '取消支付',
- icon: 'none',
- duration: 500,
- success: () => {
- /* 取消订单 */
- }
- })
- resolve('cancel')
- }
- if (res.err_msg == "get_brand_wcpay_request:ok") {
- // 使用以上方式判断前端返回,微信团队郑重提示:
- //res.err_msg将在用户支付成功后返回ok,但并不保证它绝对可靠。
- uni.showToast({
- title: '支付成功',
- icon: 'success',
- duration: 500,
- success: () => {
- resolve('success')
- }
- })
- }
+ /**
+ * @description: 微信支付(小程序)
+ * @param {*}
+ * @return {*}
+ */
+ wxMpPay({
+ provider = 'weixin',
+ data
+ }) {
+ console.log('wxdata', data)
+ // #ifdef H5
+ console.log('进入h5支付', data)
+ return new Promise((resolve, reject) => {
+ WeixinJSBridge.invoke(
+ 'getBrandWCPayRequest', data,
+ function(res) {
+ console.log('支付回调', res);
+ if (res.errMsg == 'requestPayment:fail cancel') {
+ uni.showToast({
+ title: '取消支付',
+ icon: 'none',
+ duration: 500,
+ success: () => {
+ /* 取消订单 */
+ }
+ })
+ resolve('cancel')
+ }
+ if (res.err_msg == "get_brand_wcpay_request:ok") {
+ // 使用以上方式判断前端返回,微信团队郑重提示:
+ //res.err_msg将在用户支付成功后返回ok,但并不保证它绝对可靠。
+ uni.showToast({
+ title: '支付成功',
+ icon: 'success',
+ duration: 500,
+ success: () => {
+ resolve('success')
+ }
+ })
+ }
- });
+ });
- })
+ })
- // #endif
- // #ifdef MP-WEIXIN
- return new Promise((resolve, reject) => {
- uni.requestPayment({
- provider,
- ...data,
- success: res => {
- // console.log(res)
- },
- fail: err => {
- // console.log('common.wxMpPay-error', err)
- },
- complete: res => {
- console.log('complete (res)', res)
- if (res.errMsg == 'requestPayment:fail cancel') {
- this.toast({
- title: '取消支付',
- icon: 'none',
- duration: 500,
- success: () => {
- /* 取消订单 */
- }
- })
+ // #endif
+ // #ifdef MP-WEIXIN
+ return new Promise((resolve, reject) => {
+ uni.requestPayment({
+ provider,
+ ...data,
+ success: res => {
+ // console.log(res)
+ },
+ fail: err => {
+ // console.log('common.wxMpPay-error', err)
+ },
+ complete: res => {
+ console.log('complete (res)', res)
+ if (res.errMsg == 'requestPayment:fail cancel') {
+ this.toast({
+ title: '取消支付',
+ icon: 'none',
+ duration: 500,
+ success: () => {
+ /* 取消订单 */
+ }
+ })
- resolve('cancel')
- }
- if (res.errMsg == 'requestPayment:ok') {
- this.toast({
- title: '支付成功',
- icon: 'success',
- duration: 500,
- success: () => {
- resolve('success')
- }
- })
- }
- }
- })
- })
+ resolve('cancel')
+ }
+ if (res.errMsg == 'requestPayment:ok') {
+ this.toast({
+ title: '支付成功',
+ icon: 'success',
+ duration: 500,
+ success: () => {
+ resolve('success')
+ }
+ })
+ }
+ }
+ })
+ })
- // #endif
- },
+ // #endif
+ },
- /**
- * @description: 规避连点
- * @param {*}
- * @return {*}
- */
- noDouble(fun, data, loading = false) {
- /**
- * $common.noDouble(fun,data)
- * fun 需要规避连点的方法
- * data 该方法需要用到的参数
- * loading 接口加载中状态
- * 传入方法不要写括号
- */
+ /**
+ * @description: 规避连点
+ * @param {*}
+ * @return {*}
+ */
+ noDouble(fun, data, loading = false) {
+ /**
+ * $common.noDouble(fun,data)
+ * fun 需要规避连点的方法
+ * data 该方法需要用到的参数
+ * loading 接口加载中状态
+ * 传入方法不要写括号
+ */
- /* 如果接口加载中,终止任何操作 */
- if (loading) {
- setTimeout(() => {
- uni.showToast({
- title: '请勿重复点击',
- icon: 'none',
- mask: false
- })
- }, 100)
- return
- }
+ /* 如果接口加载中,终止任何操作 */
+ if (loading) {
+ setTimeout(() => {
+ uni.showToast({
+ title: '请勿重复点击',
+ icon: 'none',
+ mask: false
+ })
+ }, 100)
+ return
+ }
- /* 如果定时器未结束 */
- if (this.data.timer) {
- setTimeout(() => {
- uni.showToast({
- title: '请勿重复点击',
- icon: 'none',
- mask: false
- })
- }, 100)
+ /* 如果定时器未结束 */
+ if (this.data.timer) {
+ setTimeout(() => {
+ uni.showToast({
+ title: '请勿重复点击',
+ icon: 'none',
+ mask: false
+ })
+ }, 100)
- /* 清除之前的定时器 */
- clearTimeout(this.data.timer)
- /* 重新设置定时器 */
- this.data.timer = setTimeout(() => {
- this.data.timer = null
- }, 200)
- return
- }
+ /* 清除之前的定时器 */
+ clearTimeout(this.data.timer)
+ /* 重新设置定时器 */
+ this.data.timer = setTimeout(() => {
+ this.data.timer = null
+ }, 200)
+ return
+ }
- console.log(data && data)
+ console.log(data && data)
- /* 设置第一次点击的定时器 */
- this.data.timer = setTimeout(() => {
- this.data.timer = null
- }, 200)
+ /* 设置第一次点击的定时器 */
+ this.data.timer = setTimeout(() => {
+ this.data.timer = null
+ }, 200)
- /* 如果有回调,使用回调并传入参数 */
- fun && fun(data && data)
- },
+ /* 如果有回调,使用回调并传入参数 */
+ fun && fun(data && data)
+ },
- /**
- * @description: tost提示
- * @return {*}
- */
- toast(opt) {
- let title = opt.title || ''
- let icon = opt.icon || 'none'
- let mask = opt.mask || false
- let duration = opt.duration || 1500
- let position = opt.position || 'center'
+ /**
+ * @description: tost提示
+ * @return {*}
+ */
+ toast(opt) {
+ let title = opt.title || ''
+ let icon = opt.icon || 'none'
+ let mask = opt.mask || false
+ let duration = opt.duration || 1500
+ let position = opt.position || 'center'
- setTimeout(() => {
- uni.showToast({
- title,
- icon,
- mask,
- duration,
- position,
- success: () => {
- if (opt.success) {
- setTimeout(() => {
- opt.success()
- }, duration)
- }
- }
- })
- }, 100)
- },
+ setTimeout(() => {
+ uni.showToast({
+ title,
+ icon,
+ mask,
+ duration,
+ position,
+ success: () => {
+ if (opt.success) {
+ setTimeout(() => {
+ opt.success()
+ }, duration)
+ }
+ }
+ })
+ }, 100)
+ },
- /**
- * @description: 获取规则
- * @param {*} type
- * @return {*}
- */
- getRule(id = '', loading = false) {
- return new Promise((resolve, reject) => {
- Vue.prototype.req({
- url: 'danye',
- Loading: !loading,
- data: {
- type: id
- },
- success: res => {
- if (res.status == 1) {
- if (res.data) {
- res.data = res.data.replace(
- /\
{
+ Vue.prototype.req({
+ url: 'danye',
+ Loading: !loading,
+ data: {
+ type: id
+ },
+ success: res => {
+ if (res.status == 1) {
+ if (res.data) {
+ res.data = res.data.replace(
+ /\
`${key}=${value}`)
- .join('&')
- return `?${str}`
- },
+ /**
+ * @description: obj转为queryString
+ * @param {*} e
+ * @return {*}
+ */
+ qs(e) {
+ let str = Object.entries(e)
+ .map(([key, value]) => `${key}=${value}`)
+ .join('&')
+ return `?${str}`
+ },
- /**
- * @description: 跳转页面
- * @param {*} type 跳转类型 1 navigate,2 redirect,3 switch,4 relaunch
- * @param {*} url
- * @param {*} query
- * @return {*}
- */
- to({ type = 1, url, query = {}, success, fail, complete }) {
- if (!url) {
- this.toast({
- title: '暂未开放'
- })
- return
- }
+ /**
+ * @description: 跳转页面
+ * @param {*} type 跳转类型 1 navigate,2 redirect,3 switch,4 relaunch
+ * @param {*} url
+ * @param {*} query
+ * @return {*}
+ */
+ to({
+ type = 1,
+ url,
+ query = {},
+ success,
+ fail,
+ complete
+ }) {
+ if (!url) {
+ this.toast({
+ title: '暂未开放'
+ })
+ return
+ }
- if (Object.keys(query).length > 0) {
- url += this.qs(query)
- }
+ if (Object.keys(query).length > 0) {
+ url += this.qs(query)
+ }
- const opt = {
- url,
- success,
- fail,
- complete
- }
+ const opt = {
+ url,
+ success,
+ fail,
+ complete
+ }
- const dic = {
- 1: uni.navigateTo,
- 2: uni.redirectTo,
- 3: uni.switchTab,
- 4: uni.reLaunch
- }
+ const dic = {
+ 1: uni.navigateTo,
+ 2: uni.redirectTo,
+ 3: uni.switchTab,
+ 4: uni.reLaunch
+ }
- const action = dic[type]
+ const action = dic[type]
- action(opt)
- },
+ action(opt)
+ },
- /**
- * @description: 返回上一页
- * @param {*} e
- * @return {*}
- */
- back(e) {
- /* 判断传入的是否是数字 */
- let pages = getCurrentPages()
- console.log('pgaes', pages)
- if (pages.length >= 2) {
- if (typeof e === 'number' && !isNaN(e)) {
- /* 如果要跳转的长度小于页面栈数量 */
- if (e < pages.length) {
- uni.navigateBack({ delta: e })
- /* 否则回首页 */
- } else {
- uni.switchTab({ url: '/pages/shouye/index' })
- }
- /* 默认返回上一级 */
- } else {
- uni.navigateBack({ delta: 1 })
- }
- } else {
- uni.switchTab({ url: '/pages/shouye/index' })
- }
- },
+ /**
+ * @description: 返回上一页
+ * @param {*} e
+ * @return {*}
+ */
+ back(e) {
+ /* 判断传入的是否是数字 */
+ let pages = getCurrentPages()
+ console.log('pgaes', pages)
+ if (pages.length >= 2) {
+ if (typeof e === 'number' && !isNaN(e)) {
+ /* 如果要跳转的长度小于页面栈数量 */
+ if (e < pages.length) {
+ uni.navigateBack({
+ delta: e
+ })
+ /* 否则回首页 */
+ } else {
+ uni.switchTab({
+ url: '/pages/shouye/index'
+ })
+ }
+ /* 默认返回上一级 */
+ } else {
+ uni.navigateBack({
+ delta: 1
+ })
+ }
+ } else {
+ uni.switchTab({
+ url: '/pages/shouye/index'
+ })
+ }
+ },
- /**
- * @description: 提取富文本文字
- * @param {*} val
- * @return {*}
- */
- filterText(val) {
- if (val) {
- var replaceLbael = val.replace(/<[^>]+>/g, '')
- return replaceLbael.replace(/ /ig, '')
- } else {
- return ''
- }
- },
- // 返回上一页
- $navBack(num = 1, time = 0) {
- // 页面返回
- setTimeout(() => {
- uni.navigateBack({
- delta: num,
- fail: () => {
- uni.reLaunch({
- url: '/pages/shouye/index'
- })
- }
- })
- }, time * 1000)
- },
-}
+ /**
+ * @description: 提取富文本文字
+ * @param {*} val
+ * @return {*}
+ */
+ filterText(val) {
+ if (val) {
+ var replaceLbael = val.replace(/<[^>]+>/g, '')
+ return replaceLbael.replace(/ /ig, '')
+ } else {
+ return ''
+ }
+ },
+ // 返回上一页
+ $navBack(num = 1, time = 0) {
+ // 页面返回
+ setTimeout(() => {
+ uni.navigateBack({
+ delta: num,
+ fail: () => {
+ uni.reLaunch({
+ url: '/pages/shouye/index'
+ })
+ }
+ })
+ }, time * 1000)
+ },
+ /**
+ * 分享
+ * @param {Object} title
+ * @param {Object} desc
+ * @param {Object} link
+ * @param {Object} image
+ */
+ $fenxiang(title, desc, link, image) {
+ // #ifdef H5
+ Vue.prototype.req({
+ url: 'getAccessTokenOffiaccountSign',
+ data: {
+ url: location.href.split('#')[0]
+ },
+ success: res => {
+ console.log(res);
+ if (res.status == 1) {
+ let _data = res.data;
+ wx.config({
+ debug: false, // 开启调试模式,调用的所有api的返回值会在客户端alert出来,若要查看传入的参数,可以在pc端打开,参数信息会通过log打出,仅在pc端时才会打印。
+ appId: _data.appId,
+ timestamp: _data.timestamp,
+ nonceStr: _data.noncestr,
+ signature: _data.signature,
+ jsApiList: [
+ 'checkJsApi',
+ 'updateAppMessageShareData',
+ ]
+ });
+ wx.ready(function() {
+ wx.checkJsApi({
+ jsApiList: [
+ 'openAddress',
+ ],
+ success: function(res) {
+ if (link.indexOf('http:') < 0 && link.indexOf(
+ 'https:') < 0) {
+ link = location.href.split('#')[0] + link;
+ }
+
+ wx.updateAppMessageShareData({
+ title: title, // 分享标题
+ desc: desc, // 分享描述
+ link: link, // 分享链接,该链接域名或路径必须与当前页面对应的公众号JS安全域名一致
+ imgUrl: image, // 分享图标
+ success: function() {
+ // 设置成功
+ }
+ })
+ }
+ });
+
+
+ });
+ wx.error(function(res) {
+ // config信息验证失败会执行error函数,如签名过期导致验证失败,具体错误信息可以打开config的debug模式查看,也可以在返回的res参数中查看,对于SPA可以在这里更新签名。
+ console.log("出现错误", res);
+ });
+ }
+ }
+ })
+ // #endif
+ }
+}
\ No newline at end of file
diff --git a/components/coupon-pop/coupon-pop.vue b/components/coupon-pop/coupon-pop.vue
new file mode 100644
index 0000000..442fa5d
--- /dev/null
+++ b/components/coupon-pop/coupon-pop.vue
@@ -0,0 +1,119 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 恭喜抽中超神赏品!赠送{{ruleData.level_text}}
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/components/rule-pop/rule-pop.vue b/components/rule-pop/rule-pop.vue
index e8794de..1664333 100644
--- a/components/rule-pop/rule-pop.vue
+++ b/components/rule-pop/rule-pop.vue
@@ -84,7 +84,6 @@ export default {
async getRule(id, title = '') {
let res = await this.$c.getRule(id, true)
-
this.open({
title: title,
content: res.data
diff --git a/package/index/lian-ji.vue b/package/index/lian-ji.vue
index 2422e02..c42501e 100644
--- a/package/index/lian-ji.vue
+++ b/package/index/lian-ji.vue
@@ -446,6 +446,7 @@
+
@@ -896,6 +897,11 @@
close(e) {
this.$refs[e].close()
+ if (e == "resPop") {
+ if (this.prizeData['user_coupon'] != null) {
+ this.$refs["couponPop"].open(this.prizeData['user_coupon']);
+ }
+ }
},
open(e) {
diff --git a/pages/mall/index.vue b/pages/mall/index.vue
index 00f46bc..d3c2b0e 100644
--- a/pages/mall/index.vue
+++ b/pages/mall/index.vue
@@ -5,14 +5,27 @@
商城好物
-
+
+
+
+
-
-
+
+
@@ -142,6 +155,7 @@
return {
statusBarHeight: 0,
datas: [],
+ advert: [],
sendRuleData: '',
goodsId: "",
orderData: null,
@@ -161,7 +175,7 @@
});
this.getData();
-
+ this.load();
this.$c.getRule(10).then(res => {
if (res.status == 1) {
this.sendRuleData = res.data
@@ -178,6 +192,18 @@
}
},
methods: {
+ load() {
+ let that = this
+ that.req({
+ url: 'getAdvert?type_id=3',
+ success(res) {
+ if (res.status == 1) {
+ that.advert = res.data
+ }
+ }
+ })
+
+ },
getStatusBarHeight() {
const systemInfo = uni.getSystemInfoSync();
this.statusBarHeight = systemInfo.statusBarHeight;
@@ -301,7 +327,7 @@
if (type == 1) {
that.close('pop')
if (res.data.status == 1) {
-
+
const status = await that.$c.wxMpPay({
data: res.data.res
})
@@ -309,10 +335,10 @@
// that.getPrize(res.data.order_num)
that.getData();
}
-
-
-
+
+
+
} else {
that.$c.toast({
title: res.msg,
diff --git a/pages/shouye/detail.vue b/pages/shouye/detail.vue
index 98abad0..d894f27 100644
--- a/pages/shouye/detail.vue
+++ b/pages/shouye/detail.vue
@@ -42,8 +42,10 @@