Browse Source

add writeoff

organize
刘嘉炜 3 years ago
parent
commit
a5981ef395
  1. 8
      src/js/api.js
  2. 8
      src/js/once_name.js
  3. 2
      src/pages/index/index.vue
  4. 121
      src/pages/write_off/mall/confirm/confirm.vue
  5. 35
      src/pages/write_off/mall/success/success.vue
  6. 17
      src/pages/write_off/menu/menu.vue
  7. 115
      src/pages/write_off/number_of_people/number_of_people.vue
  8. 111
      src/pages/write_off/operate/operate.vue

8
src/js/api.js

@ -102,6 +102,14 @@ API['writeOff'] = {
assistantVerify: `${ORIGIN}/admin/stadium/order/assistantVerify`, // 商家助手-核销查询-核销
userMonthlyCardVerify: `${ORIGIN}/admin/userMonthlyCard/verify`, // 年月卡核销-后台
userMonthlyCardOpenGate: `${ORIGIN}/admin/userMonthlyCard/openGate`, // 年月卡开门-后台
// 20211228 新增商城核销
shop2WriteoffList: `${ORIGIN}/admin/assistant/shop2/writeoffList`, // 商城订单核销 - 列表
shop2WriteoffGet: `${ORIGIN}/admin/assistant/shop2/writeoffGet`, // 商城订单核销 - 获取订单信息
shop2WriteoffSet: `${ORIGIN}/admin/assistant/shop2/writeoffSet`, // 商城订单核销 - 确认核销
timingNumber: `${ORIGIN}/stadium/person/timing/number`, // 现场人数
}
export default { ORIGIN, API };

8
src/js/once_name.js

@ -4,9 +4,15 @@
export const WRITE_OFF_STORE_INFO = 'stadium_list';
export const WRITE_OFF_ORDER_INFO = 'order_info';
export const WRITE_OFF_YM_ORDER_INFO = 'ym_order_info'; // 年月卡订单核销
export const WRITE_OFF_MALL_ORDER_INFO = 'mall_order_info'; // 商城订单核销
export const WRITE_OFF_MALL_ORDER_SUCCESS = 'mall_order_success'; // 商城订单核销成功!
export default {
WRITE_OFF_STORE_INFO,
WRITE_OFF_ORDER_INFO,
WRITE_OFF_YM_ORDER_INFO
WRITE_OFF_YM_ORDER_INFO,
WRITE_OFF_MALL_ORDER_INFO,
WRITE_OFF_MALL_ORDER_SUCCESS
}

2
src/pages/index/index.vue

@ -104,7 +104,7 @@
{
id: 4,
name: '核销查询',
path: '/pages/write_off/search_result/search_result',
path: '/pages/write_off/menu/menu',
serverKey: 1008 //
},
{

121
src/pages/write_off/mall/confirm/confirm.vue

@ -1,51 +1,135 @@
<template>
<view class="mall-ls-confirm">
<view class="mlc-status">待发货</view>
<!-- 20211228 pm 说写死 -->
<view class="mlc-status">{{ '待发货' }}</view>
<view class="mlc-main">
<view class="mm-top mm-box">
<view class="mt-line">
<view>下单时间</view>
<view>2020-08-22 10:30:40</view>
<view>复制</view>
<view>{{ orderInfo.success_time || '-' }}</view>
</view>
<view class="mt-line">
<view>订单编号</view>
<view>sc20 0822 0815 6894</view>
<view>{{ orderInfo.order_no || '-' }}</view>
<view @click="copyBtn(orderInfo.order_no || '-')">复制</view>
</view>
</view>
<view class="mm-user-info mm-box">
<view class="mm-tit">收货人信息</view>
<view class="mui-info">
<view class="mi-line">配送方式自提</view>
<view class="mi-line">李晓娜 18087690993</view>
<view class="mi-line">欧轩智能羽毛球馆永泰店</view>
<view class="mi-addr">广州市白云区永泰街道世联空间D2栋5楼</view>
<view class="mi-line">配送方式{{ sendMethod }}</view>
<view class="mi-line">{{ pickupInfo.name || '-' }} {{ pickupInfo.phone || '-' }}</view>
<view class="mi-line">{{ pickupInfo.store_name || '-' }}</view>
<view class="mi-addr">{{ pickupInfo.store_addr || '-' }}</view>
</view>
<view class="mui-code">取货码2009 1808 8956</view>
<view class="mui-code">取货码{{ pickupInfo.gcode || '-' }}</view>
</view>
<view class="mm-goods">
<view class="mm-goods" v-if="goodsLs.length">
<view class="mm-tit">商品信息</view>
<view class="mg-ls">
<view class="ml-item" v-for="i in 3" :key="i">
<image></image>
<view class="ml-item" v-for="(e, i) in goodsLs" :key="i">
<image mode="aspectFill" :src="e.product_imgs || ''"></image>
<view class="mi-info">
<view class="mi-name">克洛斯威羽毛球拍2支装正品碳素成人进攻型羽毛</view>
<view class="mi-name">{{ e.product_name || '-' }}</view>
<view class="mi-spec">
<view>比赛专用黑色</view>
<view>×1</view>
<view>{{ getSpecTxt(e) }}</view>
<view>×{{ e.product_nums || 0 }}</view>
</view>
</view>
</view>
</view>
</view>
</view>
<view class="mlc-fixd-btn">确认核销</view>
<view class="mlc-fixd-btn" @click="confirmBtn">确认核销</view>
</view>
</template>
<script>
import util from '../../../../utils/util';
import { API } from '../../../../js/api';
import { servers } from '../../../../js/server';
import { WRITE_OFF_MALL_ORDER_INFO, WRITE_OFF_MALL_ORDER_SUCCESS } from '../../../../js/once_name';
import { mapState } from 'vuex';
export default {
computed: {
goodsLs(){
let { orderInfo } = this;
if(!orderInfo || !orderInfo.product_order_goods || !orderInfo.product_order_goods.length)return [];
return orderInfo.product_order_goods || [];
},
setStatusTxt() {
let { orderInfo } = this;
if(!orderInfo || orderInfo.pay_status == undefined)return '-';
// 0 1 2 3 4 5 6退 7退 8退
let statusArr = ['待付款', '待发货', '待收货', '交易完成', '交易完成', '订单关闭', '退款中', '退款完成', '退款关闭'];
return statusArr[orderInfo.pay_status] || '-';
},
sendMethod(){
let { orderInfo } = this;
if(!orderInfo)return '-';
if(orderInfo.product_order_self_pickup == 1)return '自提';
if(orderInfo.product_order_self_pickup == 0)return '快递';
return '-'
},
pickupInfo(){
let { orderInfo } = this;
if(!orderInfo || !orderInfo.product_order_self_pickup_info)return {};
return orderInfo.product_order_self_pickup_info
},
},
data(){
return {
orderInfo: {
product_order_self_pickup_info: {}
}
}
},
onLoad(options){
console.warn(options)
util.$_once(WRITE_OFF_MALL_ORDER_INFO, data => {
console.warn(data)
this.orderInfo = data || { };
})
},
methods: {
confirmBtn: util.debounce(function(){
let { orderInfo, pickupInfo } = this;
util.showLoad();
servers.post({
url: API.writeOff.shop2WriteoffSet,
data: {
vcode: pickupInfo.gcode,
brand_id: orderInfo.brand_id,
},
isDefaultGet: false,
})
.then(res=>{
util.hideLoad();
if(res.data.code == 0){
let _ls = res.data.data || [];
util.$_emit(WRITE_OFF_MALL_ORDER_SUCCESS, _ls);
util.routeTo(`/pages/write_off/mall/success/success`, 'rT')
}else{
util.showNone(res.data.message || '操作失败!')
}
})
.catch(util.hideLoad)
}, 200, true),
copyBtn(data){
uni.setClipboardData({ data });
},
getSpecTxt(e){
if(
e.product_spec_multi == 1&&
e.product_spec_multi_info&&
e.product_spec_multi_info.spec_info&&
e.product_spec_multi_info.spec_info.length){
let specStr = (e.product_spec_multi_info.spec_info).join(";")
return specStr;
}
return '-';
}
}
}
</script>
@ -145,7 +229,7 @@ export default {
margin-right: 20upx;
width: 180upx;
height: 180upx;
background-color: skyblue;
border-radius: 10upx;
}
.mi-info{
flex-grow: 1;
@ -154,6 +238,7 @@ export default {
margin-bottom: 12upx;
font-size: 28upx;
line-height: 40upx;
min-height: 80upx;
color: #333;
@include textHide(2);
}

35
src/pages/write_off/mall/success/success.vue

@ -1,7 +1,7 @@
<template>
<view class="confirm-success">
<view class="cs-tip">
<image></image>
<image mode="aspectFit" src="/static/images/icon/success_tip.png"></image>
<view>核销成功</view>
</view>
<view class="cs-goods">
@ -9,26 +9,42 @@
<view class="mm-goods">
<view class="mm-tit">商品信息</view>
<view class="mg-ls">
<view class="ml-item" v-for="i in 3" :key="i">
<image></image>
<view class="ml-item" v-for="(e, i) in orderList" :key="i">
<image mode="aspectFill" :src="e.imgs || ''"></image>
<view class="mi-info">
<view class="mi-name">克洛斯威羽毛球拍2支装正品碳素成人进攻型羽毛</view>
<view class="mi-name">{{ e.name || '-' }}</view>
<view class="mi-spec">
<view>比赛专用黑色</view>
<view>×1</view>
<view>{{ e.spec || '-' }}</view>
<view>×{{ e.nums || 0 }}</view>
</view>
</view>
</view>
</view>
</view>
</view>
<view class="mlc-fixd-btn">确认核销</view>
<view class="mlc-fixd-btn" @click="backBtn">返回继续核销</view>
</view>
</template>
<script>
import { WRITE_OFF_MALL_ORDER_SUCCESS } from '../../../../js/once_name'
import util from '../../../../utils/util'
export default {
data(){
return {
orderList: []
}
},
onLoad(options){
util.$_once(WRITE_OFF_MALL_ORDER_SUCCESS, list=>{
this.orderList = list || [];
})
},
methods: {
backBtn(){
util.routeTo();
}
}
}
</script>
@ -46,7 +62,6 @@ export default {
margin: 0 auto 46upx;
width: 100upx;
height: 100upx;
background-color: skyblue;
}
>view{
text-align: center;
@ -81,7 +96,7 @@ export default {
margin-right: 20upx;
width: 180upx;
height: 180upx;
background-color: skyblue;
border-radius: 10upx;
}
.mi-info{
flex-grow: 1;

17
src/pages/write_off/menu/menu.vue

@ -3,7 +3,7 @@
<view class="wom-section">
<view class="ws-tit">场地订单核销</view>
<view class="ws-ls">
<view class="wl-item" @click="toOperate">
<view class="wl-item" @click="toOperate('site')">
<image mode="aspectFit" src="/static/images/write_off/site.png"></image>
<view>场地订单核销</view>
</view>
@ -16,7 +16,7 @@
<view class="wom-section">
<view class="ws-tit">商城订单核销</view>
<view class="ws-ls">
<view class="wl-item" @click="toOperate">
<view class="wl-item" @click="toOperate('mall')">
<image mode="aspectFit" src="/static/images/write_off/mall.png"></image>
<view>商城订单核销</view>
</view>
@ -39,21 +39,26 @@
</template>
<script>
import util from '../../../utils/util'
import util from '../../../utils/util';
import { WRITE_OFF_STORE_NAME, WRITE_OFF_ORDER_INFO } from '../../../js/once_name';
import { API } from '../../../js/api';
import { servers } from '../../../js/server';
export default {
methods: {
toPeopleNum(){
util.routeTo(`/pages/write_off/number_of_people/number_of_people`, 'nT');
},
toOperate(){
util.routeTo(`/pages/write_off/operate/operate`, 'nT');
toOperate(type){
util.$_emit(WRITE_OFF_STORE_NAME, null);
util.routeTo(`/pages/write_off/operate/operate?type=${type}`, 'nT');
},
toSiteList(){
util.routeTo(`/pages/write_off/search_result/search_result`, 'nT');
},
toMallLs(){
util.routeTo(`/pages/write_off/mall/list/list`, 'nT');
}
},
}
}
</script>

115
src/pages/write_off/number_of_people/number_of_people.vue

@ -1,19 +1,19 @@
<template>
<view class="number-of-people">
<view class="nop-store-name">
<picker>
<picker :range="stadiumList" range-key="name" @change="stadiumChange">
<view class="nsn-frame">
<input placeholder="123" disabled />
<input placeholder="请选择店铺" :value="curStadium.name" disabled />
<image mode="aspectFit" src="/static/images/icon/arrow_c33.png"></image>
</view>
</picker>
</view>
<view class="nop-main">
<view class="nm-date">日期2020年11月18日</view>
<view class="nm-date">日期{{ dateStr || '-' }}</view>
<view class="nm-tit">现场散客人数</view>
<view class="nm-num">
<image mode="aspectFit" src="/static/images/countdown_bg.png"></image>
<view class="nn-txt-num">69</view>
<view class="nn-txt-num">{{peopleInfo.present_person_number || 0}}</view>
</view>
<view class="nm-btn" @click="isChangeNum = true">修改人数</view>
<view class="nm-tip">
@ -41,10 +41,115 @@
</template>
<script>
import { API } from '../../../js/api'
import { servers } from '../../../js/server'
import { mapState } from 'vuex';
import util from '../../../utils/util';
let timer = null;
export default {
computed: {
...mapState([ 'brandInfo' ]),
},
data(){
return {
isChangeNum: false
isChangeNum: false,
stadiumList: [],
curStadium: {
name: ''
},
peopleInfo: {},
dateStr: '-'
}
},
onLoad(options){
this.initStore();
this.dateStr = util.formatDate({ partition: 'zh' }) || '-';
},
onUnload(){
this.clearTime();
},
methods: {
initInertval(){
this.clearTime();
let { curStadium } = this;
if(!curStadium.id || !curStadium.brand_id)return;
timer = setInterval(_=>{
if(!curStadium.id || !curStadium.brand_id)return this.clearTime();
this.getUserNum({
stadium_id: curStadium.id,
brand_id: curStadium.brand_id
})
}, 3000);
},
clearTime(){
clearInterval(timer);
timer = null;
},
stadiumChange(e){
let { stadiumList } = this;
let _curStadium = stadiumList[e.detail.value] || {};
if(!_curStadium.id || !_curStadium.brand_id)return;
this.curStadium = _curStadium;
this.getUserNum({
stadium_id: _curStadium.id,
brand_id: _curStadium.brand_id
})
this.initInertval();
},
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 || [];
let _curStadium = _storeList[0] || {};
this.curStadium = _curStadium;
this.initInertval();
this.getUserNum({
stadium_id: _curStadium.id,
brand_id: _curStadium.brand_id
})
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
})
},
getUserNum({
stadium_id,
brand_id,
}){
servers.get({
url: API.writeOff.timingNumber,
data: { stadium_id, brand_id },
failMsg: '加载现场人数失败!'
})
.then(res=>{
this.peopleInfo = res
})
}
}
}

111
src/pages/write_off/operate/operate.vue

@ -23,7 +23,7 @@
import util from '../../../utils/util';
import { API } from '../../../js/api';
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';
export default {
data(){
@ -31,20 +31,62 @@ export default {
iptCode: '',
stadiumList: [],
curStadium: {},
writeOffType: '', // site()/ mall()
}
},
computed: {
...mapState([ 'brandInfo' ]),
},
onLoad(){
onLoad(options){
this.writeOffType = options.type || '';
util.$_once(WRITE_OFF_STORE_NAME, data => {
console.warn(data);
if(!data)return this.initStore();
this.curStadium = data.curStadium;
this.stadiumList = data.stadiumList;
})
console.warn(this.brandInfo)
// console.warn(this.brandInfo)
},
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(){
uni.scanCode({
onlyFromCamera: true,
@ -66,6 +108,8 @@ export default {
this.curStadium = stadiumList[e.detail.value];
},
confirmBtn: util.debounce(function(){
let { iptCode } = this;
if(!iptCode)return util.showNone('请输入核销码!');
this.analysisOrder({ verify_code: this.iptCode });
return
let _timeSta = new Date().getTime();
@ -74,41 +118,78 @@ export default {
return util.routeTo(`/pages/write_off/confirm_order/confirm_order`, 'nT');
}, 300, true),
//
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 = {
brand_id: brandInfo.brand.id,
stadium_id: curStadium.id,
}
let type = '';
let _vType = '';
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){
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();
servers.get({
url: API.writeOff.enterVerifyOrder,
data: _query,
data: query,
isDefaultGet: false
})
.then(res=>{
util.hideLoad();
if(res.data.code == 0){
let _data = res.data.data || {}
util.$_emit(WRITE_OFF_ORDER_INFO, {..._data});
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
}
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{
util.routeTo(`/pages/write_off/null/null?type=${type}`, 'nT');
util.routeTo(`/pages/write_off/null/null?type=${vType}`, 'nT');
}
console.log('订单查询---->', res);
})

Loading…
Cancel
Save