22 changed files with 398 additions and 565 deletions
Unified View
Diff Options
-
20components/count-down/index.js
-
32pages/api/saas.js
-
110pages/enterprise/address-new/index.js
-
8pages/enterprise/address-new/index.json
-
38pages/enterprise/address-new/index.wxml
-
1pages/enterprise/address-new/index.wxss
-
81pages/enterprise/address/index.js
-
8pages/enterprise/address/index.json
-
32pages/enterprise/address/index.wxml
-
1pages/enterprise/address/index.wxss
-
2pages/login/index.js
-
2pages/login/index.wxml
-
73pages/process/index.wxs
-
10pages/process/index/index.js
-
6pages/process/index/index.wxml
-
74pages/process/order-check/index.js
-
163pages/process/order-check/index.wxml
-
51pages/process/order-info/index.js
-
4pages/process/order-info/index.json
-
204pages/process/order-info/index.wxml
-
41pages/process/order-list/index.js
-
2pages/process/order-list/index.wxml
@ -1,110 +0,0 @@ |
|||||
// pages/enterprise/address-new/index.js
|
|
||||
import { deleteAddress, saveAddress } from "../../api/user" |
|
||||
const util = require('../../../utils/util') |
|
||||
const region = require('../../../utils/area') |
|
||||
const storage = require('../../../utils/storage') |
|
||||
const event = require('../../../utils/event') |
|
||||
const app = getApp() |
|
||||
|
|
||||
Page({ |
|
||||
/** |
|
||||
* 页面的初始数据 |
|
||||
*/ |
|
||||
data: { |
|
||||
id: null, |
|
||||
show: false, |
|
||||
areaList: region.default, |
|
||||
form: { |
|
||||
receiver:'', |
|
||||
receiverMobile:'', |
|
||||
detail:'', |
|
||||
isDefault: 0, |
|
||||
provinceId: '', |
|
||||
provinceName: '', |
|
||||
cityId: '', |
|
||||
cityName: '', |
|
||||
districtId: '', |
|
||||
districtName: '' |
|
||||
}, |
|
||||
requesting: false |
|
||||
}, |
|
||||
/** |
|
||||
* 生命周期函数--监听页面加载 |
|
||||
*/ |
|
||||
onLoad: function (options) { |
|
||||
if(options.id){ |
|
||||
this.setData({ id: Number(options.id)}) |
|
||||
} |
|
||||
var json = storage.get('gdw-address') |
|
||||
if(json){ |
|
||||
storage.remove('gdw-address') |
|
||||
var form = JSON.parse(json) |
|
||||
form.areaStr = form.provinceName + ' ' + form.cityName + ' ' + form.districtName |
|
||||
this.setData({ form: form}) |
|
||||
} |
|
||||
}, |
|
||||
showRegion: function(){ |
|
||||
if(this.data.disabled){ |
|
||||
return |
|
||||
} |
|
||||
this.setData({ show: true }) |
|
||||
}, |
|
||||
bindinput: function(e){ |
|
||||
this.data.form[e.target.id] = e.detail.value |
|
||||
}, |
|
||||
onChange: function({ detail }) { |
|
||||
// 需要手动对 checked 状态进行更新
|
|
||||
this.setData({ ['form.isDefault']: detail ? 1 : 0 }) |
|
||||
}, |
|
||||
onConfirm: function({ detail }){ |
|
||||
this.data.form.enterpriseId = app.accountInfo.enterpriseId |
|
||||
this.data.form.provinceId = detail.values[0].code |
|
||||
this.data.form.provinceName = detail.values[0].name |
|
||||
this.data.form.cityId = detail.values[1].code |
|
||||
this.data.form.cityName = detail.values[1].name |
|
||||
this.data.form.districtId = detail.values[2].code |
|
||||
this.data.form.districtName = detail.values[2].name |
|
||||
var areaStr = detail.values[0].name + ' ' + detail.values[1].name + ' ' + detail.values[2].name |
|
||||
this.setData({ show: false, ['form.areaStr']: areaStr }) |
|
||||
}, |
|
||||
deleteForm: function(){ |
|
||||
wx.showLoading({ title: '处理中', mask: true }) |
|
||||
deleteAddress(this.data.form.id).then(result => { |
|
||||
wx.hideLoading() |
|
||||
event.emit('EventMessage', { what: 40, desc: 'Address' }) |
|
||||
util.showBackToast('地址已删除') |
|
||||
}).catch(err => { |
|
||||
wx.hideLoading() |
|
||||
}) |
|
||||
}, |
|
||||
submitForm: function () { |
|
||||
if(util.isEmpty(this.data.form.receiver)){ |
|
||||
util.showToast('请输入联系人') |
|
||||
return |
|
||||
} |
|
||||
if(util.isEmpty(this.data.form.receiverMobile)){ |
|
||||
util.showToast('请输入联系电话') |
|
||||
return |
|
||||
} |
|
||||
if(util.isEmpty(this.data.form.districtId)){ |
|
||||
util.showToast('请选择所在地区') |
|
||||
return |
|
||||
} |
|
||||
if(util.isEmpty(this.data.form.detail)){ |
|
||||
util.showToast('请输入详细地址') |
|
||||
return |
|
||||
} |
|
||||
wx.showLoading({ title: '处理中', mask: true }) |
|
||||
saveAddress(this.data.form).then(result => { |
|
||||
wx.hideLoading() |
|
||||
event.emit('EventMessage', { what: 40, desc: 'Address' }) |
|
||||
util.showBackToast('添加成功') |
|
||||
}).catch(err => { |
|
||||
wx.hideLoading() |
|
||||
util.showToast(err) |
|
||||
}) |
|
||||
}, |
|
||||
onClose: function() { |
|
||||
this.setData({ show: false }) |
|
||||
} |
|
||||
}) |
|
||||
@ -1,8 +0,0 @@ |
|||||
{ |
|
||||
"usingComponents": { |
|
||||
"van-switch": "/components/switch/index", |
|
||||
"van-popup": "/components/popup/index", |
|
||||
"van-area": "/components/area/index", |
|
||||
"van-button": "/components/button/index" |
|
||||
} |
|
||||
} |
|
||||
@ -1,38 +0,0 @@ |
|||||
<!--pages/enterprise/address-new/index.wxml--> |
|
||||
<cu-custom bgColor="bg-white" isBack="{{true}}"> |
|
||||
<view slot="content">{{ id ? '编辑' : '新增' }}地址</view> |
|
||||
</cu-custom> |
|
||||
|
|
||||
|
|
||||
<view class="cu-form-group margin-top"> |
|
||||
<view class="title">收货人:</view> |
|
||||
<input id="receiver" disabled="{{disabled}}" placeholder-style="color:#aaa" placeholder="请输入收货人" value="{{form.receiver}}" bindinput="bindinput"></input> |
|
||||
</view> |
|
||||
<view class="cu-form-group"> |
|
||||
<view class="title">手机号码:</view> |
|
||||
<input id="receiverMobile" disabled="{{disabled}}" placeholder-style="color:#aaa" placeholder="请输入手机号码" value="{{form.receiverMobile}}" bindinput="bindinput"></input> |
|
||||
</view> |
|
||||
<view class="cu-form-group" data-index="1" style="border-top: 1px solid #f3f3f3" bindtap="showRegion"> |
|
||||
<view class="flex text-sg">所在地区: |
|
||||
<view class="{{form.areaStr||'input-grey'}}">{{form.areaStr||'请选择所在地区'}}</view> |
|
||||
</view> |
|
||||
<text class="cuIcon-right text-gray" wx:if="{{!disabled}}"></text> |
|
||||
</view> |
|
||||
<view class="cu-form-group" style="border-top: 1rpx solid #f3f3f3"> |
|
||||
<view class="title">详细地址:</view> |
|
||||
<input id="detail" disabled="{{disabled}}" placeholder-style="color:#aaa" placeholder="请输入详细地址" value="{{form.detail}}" bindinput="bindinput"></input> |
|
||||
</view> |
|
||||
|
|
||||
<view class="cu-form-group" style="border-top: 1rpx solid #f3f3f3"> |
|
||||
<view class="title">设为默认地址:</view> |
|
||||
<van-switch checked="{{ form.isDefault ? true : false }}" bind:change="onChange" /> |
|
||||
</view> |
|
||||
|
|
||||
<view style="margin-top:48rpx;padding:30rpx 60rpx;"> |
|
||||
<van-button block type="danger" loading="{{requesting}}" wx:if="{{id}}" bind:click="deleteForm" custom-style="margin-bottom: 24rpx">删除</van-button> |
|
||||
<van-button block type="info" loading="{{requesting}}" bind:click="submitForm">保存</van-button> |
|
||||
</view> |
|
||||
|
|
||||
<van-popup show="{{ show }}" position="bottom" bind:close="onClose"> |
|
||||
<van-area area-list="{{ areaList }}" value="{{form.districtId}}" bind:confirm="onConfirm" bind:cancel="onClose"/> |
|
||||
</van-popup> |
|
||||
@ -1 +0,0 @@ |
|||||
/* pages/enterprise/address-new/index.wxss */ |
|
||||
@ -1,81 +0,0 @@ |
|||||
// pages/enterprise/address/index.js
|
|
||||
import Dialog from '../../../components/dialog/dialog' |
|
||||
import { getAddressList, deleteAddress } from "../../api/user" |
|
||||
const event = require('../../../utils/event') |
|
||||
const util = require('../../../utils/util') |
|
||||
const storage = require('../../../utils/storage') |
|
||||
|
|
||||
Page({ |
|
||||
/** |
|
||||
* 页面的初始数据 |
|
||||
*/ |
|
||||
data: { |
|
||||
type: 0, |
|
||||
addressList: [] |
|
||||
}, |
|
||||
/** |
|
||||
* 生命周期函数--监听页面加载 |
|
||||
*/ |
|
||||
onLoad: function (options) { |
|
||||
if(options.type){ |
|
||||
this.data.type = Number(options.type) |
|
||||
} |
|
||||
event.on('EventMessage', this, this.onEvent) |
|
||||
this.fetchAddressList() |
|
||||
}, |
|
||||
onEvent: function (message) { |
|
||||
if (message.what == 40) { |
|
||||
this.fetchAddressList() |
|
||||
} |
|
||||
}, |
|
||||
fetchAddressList: function(){ |
|
||||
wx.showLoading({ title: '加载中', mask: true }) |
|
||||
// /product/{id}产品详情
|
|
||||
getAddressList().then(result => { |
|
||||
wx.hideLoading() |
|
||||
this.setData({ addressList: result.data}) |
|
||||
}).catch(err => { |
|
||||
wx.hideLoading() |
|
||||
}) |
|
||||
}, |
|
||||
lookItem: function(e){ |
|
||||
var item = this.data.addressList[e.currentTarget.dataset.index] |
|
||||
if(this.data.type == 1){ |
|
||||
event.emit('EventMessage', { what: 41, obj: item, desc: 'Address' }) |
|
||||
wx.navigateBack() |
|
||||
} else { |
|
||||
storage.put('gdw-address', JSON.stringify(item), 1) |
|
||||
wx.navigateTo({ url: '/pages/enterprise/address-new/index?id=' + item.id }) |
|
||||
} |
|
||||
}, |
|
||||
/** |
|
||||
* 生命周期函数--监听页面初次渲染完成 |
|
||||
*/ |
|
||||
addAddress: function (e) { |
|
||||
if(e.currentTarget.dataset.index >= 0){ |
|
||||
var item = this.data.addressList[e.currentTarget.dataset.index] |
|
||||
storage.put('gdw-address', JSON.stringify(item), 1) |
|
||||
wx.navigateTo({ url: '/pages/enterprise/address-new/index?id=' + item.id }) |
|
||||
} else { |
|
||||
wx.navigateTo({ url: '/pages/enterprise/address-new/index' }) |
|
||||
} |
|
||||
}, |
|
||||
delAddress: function(e){ |
|
||||
var item = this.data.addressList[e.currentTarget.dataset.index] |
|
||||
var that = this |
|
||||
Dialog.confirm({ title: '温馨提示', message: '确定删除该地址?' }).then(() => { |
|
||||
wx.showLoading({ title: '处理中', mask: true }) |
|
||||
deleteAddress(item.id).then(result => { |
|
||||
wx.hideLoading() |
|
||||
util.showToast('地址已删除') |
|
||||
that.fetchAddressList() |
|
||||
}).catch(err => { |
|
||||
console.log(err) |
|
||||
wx.hideLoading() |
|
||||
}) |
|
||||
}) |
|
||||
}, |
|
||||
onUnload: function(){ |
|
||||
event.remove('EventMessage', this) |
|
||||
} |
|
||||
}) |
|
||||
@ -1,8 +0,0 @@ |
|||||
{ |
|
||||
"usingComponents": { |
|
||||
"van-cell": "/components/cell/index", |
|
||||
"van-checkbox": "/components/checkbox/index", |
|
||||
"van-button": "/components/button/index", |
|
||||
"van-dialog": "/components/dialog/index" |
|
||||
} |
|
||||
} |
|
||||
@ -1,32 +0,0 @@ |
|||||
<!--pages/enterprise/address/index.wxml--> |
|
||||
<cu-custom bgColor="bg-white" isBack="{{true}}"> |
|
||||
<view slot="content" style="color:black;font-size:36rpx">地址管理</view> |
|
||||
</cu-custom> |
|
||||
|
|
||||
<view wx:for="{{ addressList }}" wx:key="index" style="margin-top:{{index > 0 ? 16: 0}}rpx"> |
|
||||
<van-cell clickable data-index="{{index}}" bind:click="lookItem"> |
|
||||
<view slot="title" class="flex flex-column"> |
|
||||
<text class="flex"> |
|
||||
<text class="text-sg text-bold">{{item.receiver}}</text> |
|
||||
<text class="text-df text-gray" style="margin-left:8rpx">{{item.receiverMobile}}</text> |
|
||||
</text> |
|
||||
<text class="text-df text-gray">{{item.provinceName + item.cityName + item.districtName + item.detail}}</text> |
|
||||
</view> |
|
||||
</van-cell> |
|
||||
<view class="bg-white flex flex-justify" style="padding:16rpx"> |
|
||||
<view class="flex flex-center" style="padding-left:12rpx"> |
|
||||
<van-checkbox value="true" icon-size="32rpx" wx:if="{{ item.isDefault == 1 }}"></van-checkbox> |
|
||||
<text class="text-blue" style="margin-left:12rpx" wx:if="{{ item.isDefault == 1 }}">已设为默认</text> |
|
||||
</view> |
|
||||
<view class="flex"> |
|
||||
<view class="text-gray" style="padding:4rpx 20rpx" data-index="{{index}}" catchtap="delAddress">删除</view> |
|
||||
<view class="text-gray" style="padding:4rpx 20rpx;margin-left:24rpx" data-index="{{index}}" catchtap="addAddress">编辑</view> |
|
||||
</view> |
|
||||
</view> |
|
||||
</view> |
|
||||
|
|
||||
<view style="margin-top:30rpx;padding:30rpx 60rpx;"> |
|
||||
<van-button block type="info" bind:click="addAddress">新增地址</van-button> |
|
||||
</view> |
|
||||
|
|
||||
<van-dialog id="van-dialog" /> |
|
||||
@ -1 +0,0 @@ |
|||||
/* pages/enterprise/address/index.wxss */ |
|
||||
@ -1,66 +1,31 @@ |
|||||
function itemStatus(status) { |
|
||||
if(status == -1){ |
|
||||
return '待设计工序' |
|
||||
} else if(status == 0){ |
|
||||
return '生产中' |
|
||||
|
// 订单状态。0:待接单,10:待反馈, 1:待验货,2:待确认,23:待厂长审核 3:待付款,30:待运营审核,31:待会计审核 4:已完成,5:已取消,6:不通过 |
||||
|
function orderStatus(status) { |
||||
|
if(status == 0){ |
||||
|
return '待接单' |
||||
|
} else if(status == 10){ |
||||
|
return '待反馈' |
||||
} else if(status == 1){ |
} else if(status == 1){ |
||||
return '待生产' |
|
||||
|
return '待验货' |
||||
|
} else if(status == 2){ |
||||
|
return '待确认' |
||||
|
} else if(status == 23){ |
||||
|
return '待厂长审核' |
||||
} else if(status == 3){ |
} else if(status == 3){ |
||||
return '已完成' |
|
||||
|
return '待付款' |
||||
|
} else if(status == 30){ |
||||
|
return '待运营审核' |
||||
|
} else if(status == 31){ |
||||
|
return '待会计审核' |
||||
} else if(status == 4){ |
} else if(status == 4){ |
||||
return '待分配' |
|
||||
} |
|
||||
return '' |
|
||||
} |
|
||||
|
|
||||
// 已完成:3;已发货:5;生成中:0 |
|
||||
function orderStatus(status, type) { |
|
||||
if(status == -1){ |
|
||||
return '待提交' |
|
||||
} else if(status == 0 || status == 4){ |
|
||||
if(type == 1){ |
|
||||
return '采购中' |
|
||||
} else { |
|
||||
return '进行中' |
|
||||
} |
|
||||
} else if(status == 3){ |
|
||||
return '已完成' |
return '已完成' |
||||
} else if(status == 5){ |
} else if(status == 5){ |
||||
return '' |
|
||||
|
return '已取消' |
||||
} else if(status == 6){ |
} else if(status == 6){ |
||||
return '已终止' |
|
||||
} |
|
||||
return '' |
|
||||
} |
|
||||
|
|
||||
// 生产单状态:待生产:1;已完成:3;生产中:0;已终止:6 |
|
||||
function prodStatus(status) { |
|
||||
if(status == 1){ |
|
||||
return '待生产' |
|
||||
} else if(status == 0){ |
|
||||
return '生产中' |
|
||||
} else if(status == 3){ |
|
||||
return '已完成' |
|
||||
} else if(status == 6){ |
|
||||
return '已终止' |
|
||||
} |
|
||||
return '' |
|
||||
} |
|
||||
|
|
||||
function orderType(type) { |
|
||||
if(type == 0){ |
|
||||
return '加工件' |
|
||||
} else if(type == 1){ |
|
||||
return '物料' |
|
||||
} else if(type == 2){ |
|
||||
return '成品' |
|
||||
|
return '不通过' |
||||
} |
} |
||||
return '' |
return '' |
||||
} |
} |
||||
|
|
||||
module.exports = { |
module.exports = { |
||||
itemStatus: itemStatus, |
|
||||
orderStatus: orderStatus, |
|
||||
prodStatus: prodStatus, |
|
||||
orderType: orderType |
|
||||
|
orderStatus: orderStatus |
||||
} |
} |
||||
Write
Preview
Loading…
Cancel
Save