Blame view

src/store/modules/order.js 779 Bytes
323398550   范牧   若干功能添加
1
2
3
4
  import urlAlias from '../url'
  import request from '../request'
  
  const { orderBuild } = urlAlias
87eade409   范牧   验光数据填充检测
5
  const state = { list: [], param: {} }
323398550   范牧   若干功能添加
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
  
  const mutations = {
    LIST: (state, list) => {
      state.list = list
    },
    SAVE: (state, param) => {
      state.param = param
    }
  }
  
  const actions = {
    build({ commit }, param) {
      return new Promise((resolve, reject) => request({
        url: orderBuild,
        data: param,
        success: (res) => {
          resolve()
        },
        fail: () => {
          uni.showModal({
            content: '订单生成失败',
            showCancel: false
          })
        }
      }))
    },
    saveParams({ commit }, param) {
      console.log('save', param)
      commit('SAVE', param)
    }
  }
  
  export default {
    namespaced: true,
    state,
    mutations,
    actions
  }