Commit 4e2c6afc by 李伟康

修复BUG

1 parent b22a2565
......@@ -6,6 +6,7 @@
title-inactive-color="#BBB"
title-active-color="#2c2c2c"
@click="click"
:key="updata"
>
<template v-for="(i,index) in data">
<van-tab
......
......@@ -194,7 +194,7 @@ const itemObj = [
]
export default {
name: '',
data() {
data () {
return {
tab: [
['', '', ''],
......@@ -227,15 +227,15 @@ export default {
]
}
},
mounted() {
mounted () {
this.getTabNum()
window.$wx = wxConfig
window.$wx.init(['scanQRCode'])
},
methods: {
getTabNum() {
getTabNum () {
this.showLoading()
this.getVerificationList()
this.getVerificationList(0, true)
this.getUserCouponList({
userStatus: 0,
type: 0
......@@ -254,35 +254,36 @@ export default {
type: 3
})
},
search(e) {
search (e) {
this.userName = e
this.clearData()
},
change(e) {
change (e) {
this.showLoading()
this.tabIndex = e
this.clearData()
},
changeType(e) {
changeType (e) {
this.showLoading()
this.type = e
this.updata = new Date().getTime()
this.userName = ''
this.clearData()
},
clearData() {
clearData () {
this.list = []
this.flag = false
this.pageNum = 1
this.tabIndex = 0
if (this.$refs.scrollView) this.$refs.scrollView.finished = false
this.getList()
},
getList() {
getList () {
let { tabIndex, type } = this
switch (type) {
case 0:
case 3:
if (tabIndex == 0) this.getVerificationList(type)
if (tabIndex == 0) this.getVerificationList(type, true)
else
this.getUserCouponList(
{
......@@ -301,22 +302,24 @@ export default {
}
},
/**优惠券已核销 */
getVerificationList(type = 0) {
getVerificationList (type = 0, setData) {
let { list, userName, pageNum } = this
let discountTypes = [2, 3, 4]
if (type == 3) discountTypes = [7]
couponApi.getVerificationList({ pageNum, userName, discountTypes }).then(res => {
this.list = list.concat(res.list)
if (setData) {
this.list = list.concat(res.list)
this.flag = true
this.itemObj = this.tools.deepClone(itemObj)
this.total = res.total
}
this.tab[type == 0 ? 0 : 3][0] = `已核销(${res.total})`
this.updata = new Date().getTime()
this.itemObj = this.tools.deepClone(itemObj)
this.total = res.total
this.flag = true
this.hideLoading()
})
},
/**优惠券待核销 已领取 */
getUserCouponList({ userStatus, type }, setData) {
getUserCouponList ({ userStatus, type }, setData) {
let { list, userName, pageNum } = this
let discountTypes = [2, 3, 4]
if (type == 3) discountTypes = [7]
......@@ -325,7 +328,7 @@ export default {
this.list = list.concat(res.list)
this.itemObj = this.tools.deepClone(itemObj).splice(0, 2)
this.flag = true
this.hideLoading()
this.total = res.total
}
if (type == 0) {
if (userStatus == 0) {
......@@ -336,17 +339,18 @@ export default {
} else {
this.tab[3][1] = `待核销(${res.total})`
}
this.total = res.total
this.updata = new Date().getTime()
this.hideLoading()
})
},
/**精品礼券 */
getCustomerCouponList(usedFlag, setData) {
getCustomerCouponList (usedFlag, setData) {
let { list, pageNum, userName } = this
boutiquecouponApi.getCustomerCouponList({ currentPage: pageNum, customerName: userName, usedFlag }).then(res => {
if (setData) {
this.list = list.concat(res.list)
this.flag = true
this.total = res.total
}
if (usedFlag == 'Y') {
this.tab[1][0] = `已核销(${res.total})`
......@@ -354,12 +358,11 @@ export default {
this.tab[1][1] = `待核销(${res.total})`
}
this.updata = new Date().getTime()
this.total = res.total
this.hideLoading()
})
},
/**商品订单 */
getGoodsVerficationList(verificationStatus, setData) {
getGoodsVerficationList (verificationStatus, setData) {
let { list, pageNum, userName } = this
shopmallApi
.getGoodsVerficationList({
......@@ -371,7 +374,7 @@ export default {
if (setData) {
this.list = list.concat(res.list)
this.flag = true
console.log(res.list)
this.total = res.total
}
if (verificationStatus == 2) {
this.tab[2][0] = `已核销(${res.total})`
......@@ -379,11 +382,10 @@ export default {
this.tab[2][1] = `待核销(${res.total})`
}
this.updata = new Date().getTime()
this.total = res.total
this.hideLoading()
})
},
onReachBottom() {
onReachBottom () {
let { total, pageNum, list } = this
this.$refs.scrollView.loading = false
if (list.length == total) {
......@@ -397,7 +399,7 @@ export default {
this.$refs.scrollView.finished = true
}
},
scan() {
scan () {
window.$wx.scanQRCode(1).then(({ resultStr }) => {
let name = 'verificationDetail'
let [t, c] = resultStr.split('&')
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!