|
@ -23,7 +23,7 @@ |
|
|
import util from '../../../utils/util'; |
|
|
import util from '../../../utils/util'; |
|
|
import { API } from '../../../js/api'; |
|
|
import { API } from '../../../js/api'; |
|
|
import { servers } from '../../../js/server'; |
|
|
import { servers } from '../../../js/server'; |
|
|
import { WRITE_OFF_STORE_NAME, WRITE_OFF_ORDER_INFO } from '../../../js/once_name'; |
|
|
|
|
|
|
|
|
import { WRITE_OFF_STORE_NAME, WRITE_OFF_ORDER_INFO, WRITE_OFF_MALL_ORDER_INFO } from '../../../js/once_name'; |
|
|
import { mapState } from 'vuex'; |
|
|
import { mapState } from 'vuex'; |
|
|
export default { |
|
|
export default { |
|
|
data(){ |
|
|
data(){ |
|
@ -31,20 +31,62 @@ export default { |
|
|
iptCode: '', |
|
|
iptCode: '', |
|
|
stadiumList: [], |
|
|
stadiumList: [], |
|
|
curStadium: {}, |
|
|
curStadium: {}, |
|
|
|
|
|
|
|
|
|
|
|
writeOffType: '', // 新增核销类型 site(场地订单)/ mall(商城订单) |
|
|
|
|
|
|
|
|
} |
|
|
} |
|
|
}, |
|
|
}, |
|
|
computed: { |
|
|
computed: { |
|
|
...mapState([ 'brandInfo' ]), |
|
|
...mapState([ 'brandInfo' ]), |
|
|
}, |
|
|
}, |
|
|
onLoad(){ |
|
|
|
|
|
|
|
|
onLoad(options){ |
|
|
|
|
|
this.writeOffType = options.type || ''; |
|
|
util.$_once(WRITE_OFF_STORE_NAME, data => { |
|
|
util.$_once(WRITE_OFF_STORE_NAME, data => { |
|
|
|
|
|
console.warn(data); |
|
|
|
|
|
if(!data)return this.initStore(); |
|
|
this.curStadium = data.curStadium; |
|
|
this.curStadium = data.curStadium; |
|
|
this.stadiumList = data.stadiumList; |
|
|
this.stadiumList = data.stadiumList; |
|
|
}) |
|
|
}) |
|
|
console.warn(this.brandInfo) |
|
|
|
|
|
|
|
|
// console.warn(this.brandInfo) |
|
|
|
|
|
|
|
|
}, |
|
|
}, |
|
|
methods: { |
|
|
methods: { |
|
|
|
|
|
async initStore(){ |
|
|
|
|
|
let { brandInfo } = this; |
|
|
|
|
|
try{ |
|
|
|
|
|
util.showLoad(); |
|
|
|
|
|
let _storeList = await this.getStoreList({ brand_id: brandInfo.brand.id || '' }); |
|
|
|
|
|
if(!_storeList || !_storeList.length)return util.showNone('没有店铺信息'); |
|
|
|
|
|
this.stadiumList = _storeList || []; |
|
|
|
|
|
if(_storeList.length) this.curStadium = _storeList[0]; |
|
|
|
|
|
util.hideLoad(); |
|
|
|
|
|
}catch(err){ |
|
|
|
|
|
util.hideLoad(); |
|
|
|
|
|
util.showNone('初始化店铺数据失败!'); |
|
|
|
|
|
console.warn('加载数据失败!', err); |
|
|
|
|
|
} |
|
|
|
|
|
}, |
|
|
|
|
|
// 获取店铺列表 |
|
|
|
|
|
getStoreList({ |
|
|
|
|
|
page=1, |
|
|
|
|
|
page_size=9999, |
|
|
|
|
|
brand_id='', |
|
|
|
|
|
}){ |
|
|
|
|
|
return servers.get({ |
|
|
|
|
|
url: API.stadiumList, |
|
|
|
|
|
data: { |
|
|
|
|
|
page, |
|
|
|
|
|
page_size, |
|
|
|
|
|
brand_id, |
|
|
|
|
|
}, |
|
|
|
|
|
failMsg: '获取列表失败!' |
|
|
|
|
|
}) |
|
|
|
|
|
.then(res=>{ |
|
|
|
|
|
let _list = res.list || []; |
|
|
|
|
|
return _list |
|
|
|
|
|
}) |
|
|
|
|
|
}, |
|
|
|
|
|
|
|
|
scanCodeBtn: util.debounce(function(){ |
|
|
scanCodeBtn: util.debounce(function(){ |
|
|
uni.scanCode({ |
|
|
uni.scanCode({ |
|
|
onlyFromCamera: true, |
|
|
onlyFromCamera: true, |
|
@ -66,6 +108,8 @@ export default { |
|
|
this.curStadium = stadiumList[e.detail.value]; |
|
|
this.curStadium = stadiumList[e.detail.value]; |
|
|
}, |
|
|
}, |
|
|
confirmBtn: util.debounce(function(){ |
|
|
confirmBtn: util.debounce(function(){ |
|
|
|
|
|
let { iptCode } = this; |
|
|
|
|
|
if(!iptCode)return util.showNone('请输入核销码!'); |
|
|
this.analysisOrder({ verify_code: this.iptCode }); |
|
|
this.analysisOrder({ verify_code: this.iptCode }); |
|
|
return |
|
|
return |
|
|
let _timeSta = new Date().getTime(); |
|
|
let _timeSta = new Date().getTime(); |
|
@ -74,41 +118,78 @@ export default { |
|
|
return util.routeTo(`/pages/write_off/confirm_order/confirm_order`, 'nT'); |
|
|
return util.routeTo(`/pages/write_off/confirm_order/confirm_order`, 'nT'); |
|
|
}, 300, true), |
|
|
}, 300, true), |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// 核销请求 |
|
|
analysisOrder({ verify_code, decrypt_text }){ |
|
|
analysisOrder({ verify_code, decrypt_text }){ |
|
|
let { curStadium, brandInfo } = this; |
|
|
|
|
|
if(!verify_code&!decrypt_text)return; |
|
|
|
|
|
|
|
|
let { curStadium, brandInfo, writeOffType } = this; |
|
|
|
|
|
if(!verify_code&&!decrypt_text)return; |
|
|
|
|
|
|
|
|
let _query = { |
|
|
let _query = { |
|
|
brand_id: brandInfo.brand.id, |
|
|
brand_id: brandInfo.brand.id, |
|
|
stadium_id: curStadium.id, |
|
|
stadium_id: curStadium.id, |
|
|
} |
|
|
} |
|
|
let type = ''; |
|
|
|
|
|
|
|
|
let _vType = ''; |
|
|
if(!!verify_code){ |
|
|
if(!!verify_code){ |
|
|
_query['verify_code'] = verify_code; |
|
|
|
|
|
type = 'verify_code'; |
|
|
|
|
|
|
|
|
_vType = 'verify_code'; |
|
|
|
|
|
writeOffType == 'site'&&(_query['verify_code'] = verify_code); |
|
|
|
|
|
writeOffType == 'mall'&&(_query['vcode'] = verify_code); |
|
|
} |
|
|
} |
|
|
if(!!decrypt_text){ |
|
|
if(!!decrypt_text){ |
|
|
type = 'decrypt_text'; |
|
|
|
|
|
_query['decrypt_text'] = decrypt_text; |
|
|
|
|
|
|
|
|
_vType = 'decrypt_text'; |
|
|
|
|
|
writeOffType == 'site'&&(_query['decrypt_text'] = decrypt_text); |
|
|
|
|
|
writeOffType == 'mall'&&(_query['vcode'] = decrypt_text); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
if(writeOffType == 'site')return this.siteGet({ query: _query, vType: _vType, }); |
|
|
|
|
|
if(writeOffType == 'mall')return this.mallGet({ query: _query, vType: _vType, }); |
|
|
|
|
|
}, |
|
|
|
|
|
// 商城订单 |
|
|
|
|
|
mallGet({ query = {}, vType = '', }){ |
|
|
|
|
|
util.showLoad(); |
|
|
|
|
|
servers.get({ |
|
|
|
|
|
url: API.writeOff.shop2WriteoffGet, |
|
|
|
|
|
data: query, |
|
|
|
|
|
isDefaultGet: false |
|
|
|
|
|
}) |
|
|
|
|
|
.then(res=>{ |
|
|
|
|
|
util.hideLoad(); |
|
|
|
|
|
if(res.data.code == 0){ |
|
|
|
|
|
let _data = res.data.data || {}; |
|
|
|
|
|
if(_data.has_order){ |
|
|
|
|
|
util.$_emit(WRITE_OFF_MALL_ORDER_INFO, {..._data.order || {}}); |
|
|
|
|
|
util.routeTo(`/pages/write_off/mall/confirm/confirm?type=${vType}`, 'nT'); |
|
|
|
|
|
}else{ |
|
|
|
|
|
util.routeTo(`/pages/write_off/null/null?type=${vType}`, 'nT'); |
|
|
|
|
|
} |
|
|
|
|
|
}else{ |
|
|
|
|
|
util.showNone(res.data.message || '操作失败!') |
|
|
|
|
|
// util.routeTo(`/pages/write_off/null/null?type=${vType}`, 'nT'); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
}) |
|
|
|
|
|
.catch(util.hideLoad) |
|
|
|
|
|
}, |
|
|
|
|
|
// 场地/ 年月卡 |
|
|
|
|
|
siteGet({ query = {}, vType = '', }){ |
|
|
util.showLoad(); |
|
|
util.showLoad(); |
|
|
servers.get({ |
|
|
servers.get({ |
|
|
url: API.writeOff.enterVerifyOrder, |
|
|
url: API.writeOff.enterVerifyOrder, |
|
|
data: _query, |
|
|
|
|
|
|
|
|
data: query, |
|
|
isDefaultGet: false |
|
|
isDefaultGet: false |
|
|
}) |
|
|
}) |
|
|
.then(res=>{ |
|
|
.then(res=>{ |
|
|
util.hideLoad(); |
|
|
util.hideLoad(); |
|
|
if(res.data.code == 0){ |
|
|
if(res.data.code == 0){ |
|
|
let _data = res.data.data || {} |
|
|
let _data = res.data.data || {} |
|
|
util.$_emit(WRITE_OFF_ORDER_INFO, {..._data}); |
|
|
|
|
|
|
|
|
|
|
|
if(_data.extension&&_data.extension.verify_order_type === 'monthly_card'){ |
|
|
if(_data.extension&&_data.extension.verify_order_type === 'monthly_card'){ |
|
|
util.routeTo(`/pages/write_off/ym_confirm/ym_confirm?type=${type}`, 'nT'); |
|
|
|
|
|
|
|
|
util.$_emit(WRITE_OFF_ORDER_INFO, {..._data}); |
|
|
|
|
|
util.routeTo(`/pages/write_off/ym_confirm/ym_confirm?type=${vType}`, 'nT'); |
|
|
return |
|
|
return |
|
|
} |
|
|
} |
|
|
util.routeTo(`/pages/write_off/confirm_order/confirm_order?type=${type}`, 'nT'); |
|
|
|
|
|
|
|
|
util.$_emit(WRITE_OFF_ORDER_INFO, {..._data}); |
|
|
|
|
|
util.routeTo(`/pages/write_off/confirm_order/confirm_order?type=${vType}`, 'nT'); |
|
|
}else{ |
|
|
}else{ |
|
|
util.routeTo(`/pages/write_off/null/null?type=${type}`, 'nT'); |
|
|
|
|
|
|
|
|
util.routeTo(`/pages/write_off/null/null?type=${vType}`, 'nT'); |
|
|
} |
|
|
} |
|
|
console.log('订单查询---->', res); |
|
|
console.log('订单查询---->', res); |
|
|
}) |
|
|
}) |
|
|