Commit 4e2c6afc by 李伟康

修复BUG

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