| | |
| | | 'shopping': 0, |
| | | 'follow': 0, |
| | | 'delivery': 0, |
| | | 'order':0 |
| | | 'order': 0 |
| | | }, |
| | | defaultaddress: {} |
| | | }, |
| | |
| | | state |
| | | }, data) { |
| | | { |
| | | const resp = await http.request('post', '/api/login/customer' + ((data.phoneNumber || data.tel) ? '/phone' : ''), { |
| | | const resp = await http.request('post', '/api/login/customer' + ((data.phoneNumber || data |
| | | .tel) ? '/phone' : ''), { |
| | | data: { |
| | | username: (data.phoneNumber || data.tel) ? (data.phoneNumber || |
| | | data.tel) : data.username, |
| | |
| | | }, |
| | | submitShopping: async function({ |
| | | commit, |
| | | dispatch |
| | | dispatch, |
| | | state |
| | | }, data) { |
| | | const resp = await http.request('post', '/api/customer/flower/cart/change-num', { |
| | | data: { |
| | | id: data.id, |
| | | num: 1 |
| | | } |
| | | }) |
| | | if (resp && resp.code === 0) { |
| | | message.showToast('添加购物车成功') |
| | | dispatch('sign_add', 'shopping') |
| | | } else { |
| | | |
| | | if(!state.currentInfo.id){ |
| | | message.showToast('请先登录') |
| | | return |
| | | } |
| | | return resp |
| | | //输入要添加多少个 |
| | | const res = await message.confirm('', { |
| | | editable: true, |
| | | title: '请输入购买数目' |
| | | }) |
| | | if (res.content && res.confirm) { |
| | | var t = res.content |
| | | if (!isNaN(parseInt(t)) && t > 0) { |
| | | message.showLoading() |
| | | const resp = await http.request('post', '/api/customer/flower/cart/change-num', { |
| | | data: { |
| | | id: data.id, |
| | | num: parseInt(t) |
| | | } |
| | | }) |
| | | message.hideLoading() |
| | | |
| | | if (resp && resp.code === 0) { |
| | | message.showToast('添加购物车成功') |
| | | dispatch('sign_add', 'shopping') |
| | | return resp |
| | | } else { |
| | | |
| | | } |
| | | return resp |
| | | } else { |
| | | message.showToast('输入数目需要大于0') |
| | | } |
| | | } |
| | | |
| | | return { |
| | | code: 1, |
| | | data: {} |
| | | } |
| | | }, |
| | | countShopping: async function({ |
| | | commit, |
| | | dispatch, |
| | | state |
| | | }, data) { |
| | | if(state.currentInfo.id){ |
| | | if (state.currentInfo.id) { |
| | | const resp = await http.request('get', '/api/customer/flower/cart/flower/count', {}) |
| | | if (resp && resp.code === 0) { |
| | | return resp.data || 0 |