【类 型】:refactor

【主	题】:调整 订单获取接口 相关代码
【描	述】:
	[原因]:数据库 订单表的解构变化 导致接口获取失败
	[过程]:取消quest字段 全部改用 status back字段 并且此俩字段的类型改为 枚举类型
	[影响]:
【结	束】

# 类型 包含:
# feat:新功能(feature)
# fix:修补bug
# docs:文档(documentation)
# style: 格式(不影响代码运行的变动)
# refactor:重构(即不是新增功能,也不是修改bug的代码变动)
# test:增加测试
# chore:构建过程或辅助工具的变动
This commit is contained in:
tk 2024-06-04 18:12:32 +08:00
parent 1b137c0442
commit 7d346defe2
6 changed files with 19 additions and 16 deletions

View File

@ -62,11 +62,8 @@
<el-select v-model="questForm.id" :filterable="isMobile" placeholder="请选择,也可输入搜索" :disabled="airLock"> <el-select v-model="questForm.id" :filterable="isMobile" placeholder="请选择,也可输入搜索" :disabled="airLock">
<el-option v-for="item in questList" :key="item.id" :label="item.id" :value="item.id"> <el-option v-for="item in questList" :key="item.id" :label="item.id" :value="item.id">
<span class="l">{{ item.id }}</span> <span class="l">{{ item.id }}</span>
<span class="l m-l-5">{{ item.name }}</span> <span class="l m-l-5">{{ item.receiver }}</span>
<span class="l m-l-5">{{ item.receive_site_name }}</span> <span class="l m-l-5">{{ item.receive_site_name }}</span>
<span v-for="product in item.products" :key="product.id" class="l m-l-5">{{
product.name
}}-{{ product.pro_buff }}-{{ product.num }}</span>
</el-option> </el-option>
</el-select> </el-select>
</el-form-item> </el-form-item>
@ -300,13 +297,13 @@ export default {
*/ */
questList () { questList () {
const plane = this.plane const plane = this.plane
return plane ? this.$store.state.questList.filter((item) => item.shop_id === plane.shop_id && item.quest === '1' && item.status === '20' && item.back === '0' && item.runing === null) : [] return plane ? this.$store.state.orderList.filter((item) => item.shop_id === plane.shop_id && item.status === 'processing' && item.back === 'normal') : []
}, },
/** /**
* @description: 付款 已承接 发货 订单列表 * @description: 发货 订单列表
*/ */
overQuestList () { overQuestList () {
return this.$store.state.questList.filter((item) => item.quest === '1' && item.status === '30' && item.runing != null) return this.$store.state.orderList.filter((item) => item.status === 'shipped')
}, },
/** /**
* @description: 航线列表 * @description: 航线列表
@ -539,6 +536,9 @@ export default {
} }
}, },
created () { created () {
setTimeout(() => {
console.log(this.$store.state.orderList)
}, 3000)
if (this.siteList && this.routeList) { if (this.siteList && this.routeList) {
this.airLock = this.siteList.some(item => item.runing === this.planesId) this.airLock = this.siteList.some(item => item.runing === this.planesId)
} }
@ -550,7 +550,7 @@ export default {
} else { // 线 } else { // 线
this.$emit('clearRoute') this.$emit('clearRoute')
} }
this.$store.dispatch('fetchQuestList')// this.$store.dispatch('fetchOrderList')//
this.$store.dispatch('fetchSiteList')// this.$store.dispatch('fetchSiteList')//
}, },
siteList (val) { siteList (val) {

View File

@ -52,12 +52,12 @@
<el-button type="danger" icon="iconfont icon-zhengque"> <el-button type="danger" icon="iconfont icon-zhengque">
<font class="m-l-5">同意退款</font> <font class="m-l-5">同意退款</font>
</el-button> </el-button>
<el-button @click="questAss(item.id, 'back', 'zero')" type="warning" icon="iconfont icon-cuowu"> <el-button @click="questAss(item.id, 'back', 'rejected')" type="warning" icon="iconfont icon-cuowu">
<font class="m-l-5">拒绝退款</font> <font class="m-l-5">拒绝退款</font>
</el-button> </el-button>
</el-button-group> </el-button-group>
<el-button-group v-else-if="item.back == 'normal' && item.status == 'pending'"> <el-button-group v-else-if="item.back == 'normal' && item.status == 'pending'">
<el-button @click="questAss(item.id, 'quest', '1')" type="primary" icon="iconfont icon-chengjie"> <el-button @click="questAss(item.id, 'status', 'processing')" type="primary" icon="iconfont icon-chengjie">
<font class="m-l-5">确认备货</font> <font class="m-l-5">确认备货</font>
</el-button> </el-button>
<el-button type="danger" icon="iconfont icon-cuowu"> <el-button type="danger" icon="iconfont icon-cuowu">
@ -89,6 +89,7 @@
<script> <script>
import { parseTime } from '@/utils/index' import { parseTime } from '@/utils/index'
import { questAss } from '@/utils/api/table'
export default { export default {
data () { data () {
@ -126,6 +127,7 @@ export default {
} }
}, },
methods: { methods: {
questAss, //
parseTime, // parseTime, //
orderState (back, status) { orderState (back, status) {
if (back === 'requested') { if (back === 'requested') {

View File

@ -926,7 +926,7 @@ const store = new Vuex.Store({
} }
}, },
/** /**
* @description: 获取订单列表 ps:待发货及待收货 并且不是退款成功状态 * @description: 获取订单列表
* @return {*} 列表 * @return {*} 列表
*/ */
async fetchOrderList ({ commit }) { async fetchOrderList ({ commit }) {

View File

@ -21,7 +21,7 @@ export async function apiCrosFrequency (params) {
/** /**
* @description: 向改变订单承接任务api 提交数据 () * @description: 向改变订单承接任务api 提交数据 ()
* @param {*} id 订单id * @param {*} id 订单id
* @param {*} state "quest"修改quest字段 "status"修改status字段 * @param {*} state "status"修改status字段 "back"修改back字段
*/ */
export function questAss (id, state, val) { export function questAss (id, state, val) {
const data = new URLSearchParams()// post对象参数 转成 字符串连接 const data = new URLSearchParams()// post对象参数 转成 字符串连接
@ -31,6 +31,7 @@ export function questAss (id, state, val) {
api.post('questAss', data).then(res => { api.post('questAss', data).then(res => {
if (res.data.status === 1) { if (res.data.status === 1) {
Message.success(res.data.msg) Message.success(res.data.msg)
store.dispatch('fetchOrderList')// 更新订单列表
} else { } else {
Message.error(res.data.msg) Message.error(res.data.msg)
} }

View File

@ -168,8 +168,8 @@ export default {
if (this.getQuestInterval !== null) { if (this.getQuestInterval !== null) {
clearInterval(this.getQuestInterval) clearInterval(this.getQuestInterval)
} }
const pending = list.filter(item => item.status === 'pending')// const pending = list.filter(item => item.status === 'pending' && item.back === 'normal')//
const processing = list.filter(item => item.status === 'processing')// const processing = list.filter(item => item.status === 'processing' && item.back === 'normal')//
const requested = list.filter(item => item.back === 'requested')// 退 const requested = list.filter(item => item.back === 'requested')// 退
if (this.pendingCount < pending.length && this.pendingCount != null) { // if (this.pendingCount < pending.length && this.pendingCount != null) { //
this.playMusic('newMsg')// this.playMusic('newMsg')//

View File

@ -55,8 +55,6 @@ export default {
} }
}, },
mounted () { mounted () {
},
created () {
/* init */ /* init */
this.$store.commit('app/setIsMobile')// this.$store.commit('app/setIsMobile')//
this.$store.dispatch('fetchAirList')// this.$store.dispatch('fetchAirList')//
@ -69,6 +67,8 @@ export default {
this.$store.dispatch('fetchSkuList')// sku this.$store.dispatch('fetchSkuList')// sku
this.$store.dispatch('fetchOrderList')// this.$store.dispatch('fetchOrderList')//
}, },
created () {
},
watch: { watch: {
/** /**
* @description: 异步拿到飞机列表之后 再进行一些初始化操作 * @description: 异步拿到飞机列表之后 再进行一些初始化操作