Commit 74d48874 by 肖康

x

parent e1afbf5a
......@@ -31,7 +31,6 @@ const actions = {
var params = {
order_id: payload.order_id
}
state.againBuy.isShow=0
Services.rebuy(qs.stringify(params)).then((res) => {
state.loading = false;
......
import Vue from 'vue'
import { services as Services, productionUrlApi } from '../../../api/index'
import { Dialog, Toast } from 'vant'
import Util from "../../../util"
Vue.use(Dialog);
var qs = require('qs');
const state = {
loading: false,
lists: {},
currentList: [],
isUpdateList: false,
}
const mutations = {
orderLists(state, payload) {
state.lists[payload.status] = payload.data
state.currentList = payload.data
}
}
const actions = {
//确认收货
sureSend1({ commit }, payload) {
state.loading = true;
var params = {
order_id: payload.order_id
}
Services.sureSend(qs.stringify(params)).then((res) => {
state.loading = false;
Toast(res.data.err_msg)
if (res.data.err_code == 0) {
state.isUpdateList = true
}
}).catch(function (err) {
state.loading = false;
});
},
//获取订单列表
orderLists1({ commit }, payload) {
//当前状态数据加载过 且没有强制更新
//参数变动 数据清空
if (payload.isGet) {
this.state.lists = {}
}
if (state.lists[payload.status] && !payload.isGet) {
//已经加载过
state.currentList = state.lists[payload.status];
return
}
state.loading = true;
var params = {
p: 1,
limit: 100
}
Object.keys(payload).forEach((item) => {
if (item != "type" && item != "isGet") {
params[item] = payload[item]
}
})
Services.orderLists(qs.stringify(params)).then((res) => {
let data = res.data;
state.loading = false;
state.isUpdateList = false
commit("orderLists", {
data: data.data.list || [],
status: payload.status,
})
}).catch(function (err) {
state.loading = false;
});
},
}
const getters = {}
export default {
state,
mutations,
actions,
getters
}
......@@ -24,6 +24,7 @@ import user from './modules/user/index'
import coupon from './modules/user/coupon'
import userInfo from './modules/user/userInfo'
import userOrder from './modules/user/order'
import shiplist from './modules/user/shiplist'
import orderDetail from './modules/user/orderDetail'
import message from './modules/user/message'
......@@ -73,6 +74,7 @@ export default new Vuex.Store({
coupon,
address,
userOrder,
shiplist,
orderDetail,
message,
history,
......
......@@ -237,6 +237,7 @@
if (val) {
this.isGet = true
this.getData()
}
},
currentList(item) {
......
......@@ -101,10 +101,10 @@
},
computed: {
...mapState({
loading: state => state.userOrder.loading,
lists: state => state.userOrder.lists,
currentList: state => state.userOrder.currentList,
isUpdateList: state => state.userOrder.isUpdateList,
loading: state => state.shiplist.loading,
lists: state => state.shiplist.lists,
currentList: state => state.shiplist.currentList,
isUpdateList: state => state.shiplist.isUpdateList,
}),
......@@ -223,7 +223,7 @@
.then(() => {
// on confirm
var datap = {
type: 'sureSend',
type: 'sureSend1',
order_id: order_id,
}
this.$store.dispatch(datap)
......@@ -252,7 +252,7 @@
getData() {
var datap = {
type: 'orderLists',
type: 'orderLists1',
status: this.orderStatus,
isGet: this.isGet || "" //是否强制更新接口
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment