Browse Source

no message

feature/v1.0
xpz2018 5 years ago
parent
commit
3479f68e14
13 changed files with 137 additions and 77 deletions
  1. 16
      api/saas.js
  2. 2
      app.json
  3. BIN
      assets/image/icon_payfor.png
  4. 2
      components/button/index.wxml
  5. 2
      pages/login/index.js
  6. 24
      pages/process/order-info/index.js
  7. 36
      pages/process/order-info/index.wxml
  8. 33
      pages/process/order-list/index.js
  9. 28
      pages/process/order-list/index.wxml
  10. 47
      pages/process/order-price/index.js
  11. 2
      pages/process/order-price/index.json
  12. 22
      pages/process/order-price/index.wxml
  13. 0
      pages/process/order-price/index.wxss

16
api/saas.js

@ -3,7 +3,7 @@
*/
import { mGet, mPost } from "./request"
const app = getApp()
const urls = [`http://47.113.118.47:9000`, `http://47.113.118.47:9000`, `https://api-client-ztb.qniao.cn`]
const urls = [`https://api-client-ztb-dev.qniao.cn`, `https://api-client-ztb-test.qniao.cn`, `https://api-client-ztb.qniao.cn`]
const sconfig = {
baseUrl: urls[app.release % 3]
@ -13,12 +13,14 @@ const loginToken = (params) => mPost(`/recycle-user-center/authorize/get/product
const getBaseInfo = () => mGet(`/ztb-factory/get/self-enterprise-profile-detail`, null, sconfig)
const getOrderList = (params) => mGet(`/ztb-factory/factory-customer/get/order-list`, params, sconfig)
const getOrderInfo = (id) => mGet(`/ztb-factory/factory-customer/get/order-detail/${id}`, null, sconfig)
const pricingOrder = (params) => mPost(`/ztb-factory/factory/edit/order-price`, params, sconfig)
const cancelOrder = (params) => mPost(`/ztb-factory/factory/cancel/order`, params, sconfig)
const checkingOrder = (params) => mPost(`/ztb-factory/factory/edit/order-status`, params, sconfig)
const pricingOrder = (params) => mPost(`/ztb-factory/factory/submit/order-price`, params, sconfig)
const cancelOrder = (id) => mPost(`/ztb-factory/factory/cancel/order/${id}`, null, sconfig)
const repeatOrder = (id) => mPost(`/ztb-factory/factory/renew/empty-weight/${id}`, null, sconfig)
const checkingOrder = (params) => mPost(`/ztb-factory/factory/audit-pass/order`, params, sconfig)
const createOrder = (params) => mPost(`/ztb-factory/factory-customer/save/order`, params, sconfig)
const getFactoryOrderList = (status, params) => mGet(`/ztb-factory/factory/wechat-applet/get/order-list/${status}`, params, sconfig)
const getFactoryOrderList = (params) => mGet(`/ztb-factory/factory/wechat-applet/get/order-list`, params, sconfig)
const getFactoryOrderInfo = (id) => mGet(`/ztb-factory/factory/wechat-applet/get/order-detail/${id}`, null, sconfig)
const getPaperList = (params) => mGet(`/ztb-factory/factory/get/all-product`, params, sconfig)
const getPaperPrice = (params) => mGet(`/ztb-factory/factory/get/product-price-list`, params, sconfig)
const savePaperPrice = (params) => mPost(`/ztb-factory/factory/save/product-price`, params, sconfig)
const updatePaperPrice = (params) => mPost(`/ztb-factory/factory/update/product-price`, params, sconfig)
@ -45,5 +47,7 @@ export {
getCustomerList,
editCustomer,
deleteCustomer,
getCustomerInfo
getCustomerInfo,
getPaperList,
repeatOrder
}

2
app.json

@ -6,7 +6,7 @@
"pages/home/employee/index",
"pages/home/authory/index",
"pages/process/order-list/index",
"pages/process/order-check/index",
"pages/process/order-price/index",
"pages/process/order-info/index",
"pages/htmls/agreement/index",
"pages/message/detail/index"

BIN
assets/image/icon_payfor.png

Before After
Width: 40  |  Height: 40  |  Size: 981 B

2
components/button/index.wxml

@ -6,7 +6,7 @@
open-type="{{ openType }}" business-id="{{ businessId }}" session-from="{{ sessionFrom }}"
send-message-title="{{ sendMessageTitle }}" send-message-path="{{ sendMessagePath }}"
send-message-img="{{ sendMessageImg }}" show-message-card="{{ showMessageCard }}" app-parameter="{{ appParameter }}"
aria-label="{{ ariaLabel }}" bindtap="{{ !disabled ? 'onClick' : 'noop' }}"
aria-label="{{ ariaLabel }}" catchtap="{{ !disabled ? 'onClick' : 'noop' }}"
bindgetuserinfo="{{ !disabled ? 'bindGetUserInfo' : 'noop' }}" bindcontact="{{ !disabled ? 'bindContact' : 'noop' }}"
bindgetphonenumber="{{ !disabled ? 'bindGetPhoneNumber' : 'noop' }}"
binderror="{{ !disabled ? 'bindError' : 'noop' }}" bindlaunchapp="{{ !disabled ? 'bindLaunchApp' : 'noop' }}"

2
pages/login/index.js

@ -88,7 +88,7 @@ Page({
},
/************************************** 获取用户信息,进行登录 ********************************************/
fetchUserInfo: function(authorization){
config.header = { 'Authorization': 'QNT ' + authorization }
// config.header = { 'Authorization': 'QNT ' + authorization }
loginToken({loginToken: authorization}).then(result => {
// token 切换流程
sconfig.header = { 'Authorization': 'QNT ' + result.data }

24
pages/process/order-info/index.js

@ -2,6 +2,7 @@
import Dialog from '../../../components/dialog/dialog'
import { cancelOrder, getFactoryOrderInfo, checkingOrder} from "../../../api/saas"
const event = require('../../../utils/event')
const math = require('../../../utils/math')
const util = require('../../../utils/util')
const app = getApp()
@ -11,7 +12,8 @@ Page({
*/
data: {
safeBottom: app.globalData.safeBottom,
form: null
form: null,
title: '过磅详情'
},
/**
* 生命周期函数--监听页面加载
@ -21,9 +23,16 @@ Page({
wx.showLoading({ title: '正在获取', mask: true })
getFactoryOrderInfo(options.id).then(result => {
wx.hideLoading()
this.setData({ safeBottom: app.globalData.safeBottom, form: result.data })
result.data.amount = math.times(math.minus(result.data.netWeight, result.data.deductWeight), result.data.settleUnitPrice)
if(result.data.status == 4){
this.data.title = '待付款'
} else if(result.data.status == 5){
this.data.title = '已完成'
}
this.setData({ safeBottom: app.globalData.safeBottom, form: result.data, title: this.data.title })
}).catch(err => {
wx.hideLoading()
this.setData({ safeBottom: app.globalData.safeBottom })
util.showToast(err)
})
}
@ -36,9 +45,6 @@ Page({
if(detail && detail.plateNumber){
this.setData({ ['form.plateNumber']: detail.plateNumber })
}
},
showCategory: function(){
},
bindInput: function (e) {
this.data.form[e.target.id] = e.detail.value
@ -50,12 +56,12 @@ Page({
paddingOrder: function(){
this.setData({ ['form.checking']: !this.data.form.checking })
},
cancelOrder: function(e){
Dialog.confirm({ title: '温馨提示', message: '确定取消该订单?' }).then(() => {
repeatOrder: function(e){
Dialog.confirm({ title: '温馨提示', message: '确定重新过皮重?' }).then(() => {
wx.showLoading({ title: '正在获取', mask: true })
cancelOrder({ id: this.data.form.id }).then(result => {
repeatOrder(this.data.form.id).then(result => {
wx.hideLoading()
util.showBackToast('订单已经删除')
util.showBackToast('订单已经处理')
event.emit('OrderMessage', { what: 12, desc: 'cancelOrder' })
}).catch(err => {
wx.hideLoading()

36
pages/process/order-info/index.wxml

@ -1,13 +1,21 @@
<!--pages/process/order-check/index.wxml-->
<cu-custom bgColor="bg-white" isBack="{{true}}">
<view slot="content">过磅详情</view>
<view slot="content">{{title}}</view>
</cu-custom>
<view wx:if="{{form}}">
<view class="flex flex-center info_status" style="justify-content: flex-start;">
<view class="flex flex-center info_status" style="justify-content: flex-start;" wx:if="{{form.status == 3}}">
<image style="height:42rpx;width:42rpx" src="/assets/image/icon_uncheck.png"></image>
<view class="text-white text-sg" style="margin-left:12rpx">待过磅审核</view>
</view>
<view class="flex flex-center info_status" style="justify-content: flex-start;" wx:if="{{form.status == 4}}">
<image style="height:42rpx;width:42rpx" src="/assets/image/icon_payfor.png"></image>
<view class="text-white text-sg" style="margin-left:12rpx">待付款(请前往后台支付)</view>
</view>
<view class="flex flex-center info_status" style="justify-content: flex-start;" wx:if="{{form.status == 5}}">
<image style="height:42rpx;width:42rpx" src="/assets/image/icon_payfor.png"></image>
<view class="text-white text-sg" style="margin-left:12rpx">已完成</view>
</view>
<van-cell>
<view slot="title" class="flex flex-justify">
<view class="text-black">客户姓名</view>
@ -23,7 +31,7 @@
<van-cell>
<view slot="title" class="flex flex-justify">
<view class="text-black">废纸品类</view>
<view class="text-gray">{{form.productId}}</view>
<view class="text-gray">{{form.productCategoryName}}</view>
</view>
</van-cell>
<van-cell>
@ -47,13 +55,13 @@
<van-cell>
<view slot="title" class="flex flex-justify">
<view class="text-black">定价员</view>
<view class="text-gray">{{form.inspectorName}}</view>
<view class="text-gray">{{form.inspectorName || ''}}</view>
</view>
</van-cell>
<van-cell>
<view slot="title" class="flex flex-justify">
<view class="text-black">定价时间</view>
<view class="text-gray">{{form.inspectionTime}}</view>
<view class="text-gray">{{form.inspectionTime || ''}}</view>
</view>
</van-cell>
<van-cell>
@ -93,28 +101,28 @@
<van-cell>
<view slot="title" class="flex flex-justify">
<view class="text-black">金额(元)</view>
<view class="text-gray">{{form.createTime}}</view>
<view class="text-gray">{{form.amount}}</view>
</view>
</van-cell>
<van-cell>
<view slot="title" class="flex flex-justify">
<view class="text-black">订单时间</view>
<view class="text-gray">{{form.createTime}}</view>
<view class="text-gray">{{form.createTime || ''}}</view>
</view>
</van-cell>
<van-cell>
<view slot="title" class="flex flex-justify">
<view class="text-black">订单编号</view>
<view class="text-gray">{{form.createTime}}</view>
<view class="text-gray">{{form.id}}</view>
</view>
</van-cell>
</view>
<view style="height:{{136 + safeBottom}}rpx;"></view>
<view class="cu-bar bg-white foot" style="height:{{120 + safeBottom}}rpx;padding:0rpx 32rpx {{safeBottom}}rpx 32rpx;"
wx:if="{{form}}">
<van-button plain type="default" custom-style="height:88rpx;width:254rpx" bind:click="cancelOrder">重新过皮重</van-button>
<van-button type="info" custom-style="margin-left:32rpx;height:88rpx;width:400rpx" bind:click="checkOrder">通过审核
</van-button>
<view style="height:{{16 + safeBottom}}rpx;"></view>
<view style="height:120rpx;" wx:if="{{form && form.status == 3}}"></view>
<view class="cu-bar bg-white foot" style="height:{{120 + safeBottom}}rpx;padding:0rpx 32rpx {{safeBottom}}rpx 32rpx;"
wx:if="{{form && form.status == 3}}">
<van-button plain type="default" custom-style="height:88rpx;width:254rpx" bind:click="repeatOrder">重新过皮重</van-button>
<van-button type="info" custom-style="margin-left:32rpx;height:88rpx;width:400rpx" bind:click="checkOrder">通过审核</van-button>
</view>
<van-dialog id="van-dialog" />

33
pages/process/order-list/index.js

@ -15,24 +15,25 @@ Page({
top: 0,
orderList: [],
form: {
status: 0,
pageNum: 1
funcType: 0,
pageNum: 1,
pageSize: 10
},
title: '全部'
},
// * 生命周期函数--监听页面加载
onLoad: function (options) {
if(options.status){
this.data.form.status = Number(options.status)
if(this.data.form.status == 1){
this.data.form.funcType = Number(options.status)
if(this.data.form.funcType == 1){
this.data.title = '待定价订单'
} else if(this.data.form.status == 2){
this.data.title = '过磅审核订单'
} else if(this.data.form.status == 3){
} else if(this.data.form.funcType == 2){
this.data.title = '过磅审核订单'
} else if(this.data.form.funcType == 3){
this.data.title = '待付款订单'
} else if(this.data.form.status == 4){
} else if(this.data.form.funcType == 4){
this.data.title = '已完成订单'
} else if(this.data.form.status == 5){
} else if(this.data.form.funcType == 5){
this.data.title = '已关闭订单'
}
}
@ -54,6 +55,7 @@ Page({
})
this.fetchOrderList()
},
//1:待定价,2:待过皮重,3:待过磅审核,4:待付款,5:已完成
fetchOrderList: function () {
if (this.data.requesting || this.data.finished) {
return
@ -63,7 +65,7 @@ Page({
} else {
this.setData({ requesting: true })
}
getFactoryOrderList(this.data.form.status, this.data.form).then(result => {
getFactoryOrderList(this.data.form).then(result => {
if (result.data && result.data.records.length) {
var respList = result.data.records
let nowList = `orderList[${this.data.orderList.length}]`
@ -98,7 +100,7 @@ Page({
cancelOrder: function(e){
Dialog.confirm({ title: '温馨提示', message: '确定取消该订单?' }).then(() => {
wx.showLoading({ title: '正在获取', mask: true })
cancelOrder({ id: this.data.form.id }).then(result => {
cancelOrder(this.data.form.id).then(result => {
wx.hideLoading()
util.showToast('订单已经删除')
this.onRefreshList()
@ -108,7 +110,16 @@ Page({
})
})
},
lookItem: function (e) {
var item = this.data.orderList[e.currentTarget.dataset.page][e.currentTarget.dataset.index]
if(item.status == 3 || item.status == 4 || item.status == 5){
wx.navigateTo({ url: '/pages/process/order-info/index?id=' + item.id })
}
},
priceOrder: function(e){
wx.navigateTo({ url: '/pages/process/order-price/index?id=' + e.currentTarget.dataset.id })
},
checkOrder: function(e){
wx.navigateTo({ url: '/pages/process/order-info/index?id=' + e.currentTarget.dataset.id })
},
onUnload: function(){

28
pages/process/order-list/index.wxml

@ -12,18 +12,30 @@
<view class="text-empty">{{loading? '正在加载' : '暂无数据'}}</view>
</view>
<van-index-bar index-list="{{null}}" wx:else>
<view wx:for="{{6}}" wx:key="index">
<van-index-anchor index="01月13日" />
<van-cell wx:for="{{4}}" wx:key="index">
<view slot="title" class="flex flex-justify">
<view>
<view class="text-sg text-black">客户名称:刘财顺</view>
<view class="text-sm text-gray">毛重:2000.00KG</view>
<van-index-anchor index="01月13日" />
<view wx:for-item="pageItem" wx:for-index="pageIndex" wx:for="{{orderList}}" wx:key="pageIndex">
<van-cell wx:for="{{pageItem}}" wx:key="index" data-page="{{pageIndex}}" data-index="{{index}}" bind:click="lookItem">
<view slot="title" class="flex flex-justify" style="align-items: flex-start">
<view style="height: 100rpx">
<view class="flex" class="text-sg text-black">
<text>客户名称:{{item.factoryCustomerName}}</text>
<text wx:if="{{item.status != 1}}"></text>
</view>
<view class="text-sm text-gray">毛重:{{item.totalWeight}}KG</view>
</view>
<view class="flex flex-center">
<view class="flex flex-center" wx:if="{{item.status == 1}}" style="height: 100rpx">
<van-button plain type="default" custom-style="height:64rpx;width:132rpx" data-id="{{item.id}}" bind:click="cancelOrder">取消</van-button>
<van-button plain type="info" custom-style="margin-left:24rpx;height:64rpx;width:132rpx" data-id="{{item.id}}" bind:click="priceOrder">定价</van-button>
</view>
<view class="flex flex-center" wx:if="{{item.status == 3}}" style="height: 100rpx">
<van-button plain type="info" custom-style="height:64rpx;width:132rpx" data-id="{{item.id}}" bind:click="checkOrder">审核</van-button>
</view>
<view class="flex flex-center" wx:if="{{item.status == 4}}">
<view class="text-df" style="color:#FA541C">待付款</view>
</view>
<view class="flex flex-center" wx:if="{{item.status == 5}}">
<view class="text-df" style="color:#028A00">已完成</view>
</view>
</view>
</van-cell>
</view>

pages/process/order-check/index.js → pages/process/order-price/index.js

@ -1,6 +1,6 @@
// pages/process/order-check/index.js
import Dialog from '../../../components/dialog/dialog'
import { pricingOrder, cancelOrder, getFactoryOrderInfo, getPaperPrice} from "../../../api/saas"
import { pricingOrder, cancelOrder, getFactoryOrderInfo, getPaperList} from "../../../api/saas"
const event = require('../../../utils/event')
const util = require('../../../utils/util')
const app = getApp()
@ -23,10 +23,16 @@ Page({
onLoad: function (options) {
if(options.id){
wx.showLoading({ title: '正在获取', mask: true })
getPaperPrice().then(result => {
this.setData({ safeBottom: app.globalData.safeBottom, paperList: result.data })
getPaperList().then(result => {
this.data.paperList = result.data.records
this.data.columns = []
for (let index = 0; index < this.data.paperList.length; index++) {
this.data.columns.push(this.data.paperList[index].name)
}
this.setData({ safeBottom: app.globalData.safeBottom, columns: this.data.columns })
}).catch(err => {
wx.hideLoading()
this.setData({ safeBottom: app.globalData.safeBottom })
util.showToast(err)
})
getFactoryOrderInfo(options.id).then(result => {
@ -50,33 +56,30 @@ Page({
showCategory: function(){
this.setData({ visible: true })
},
onConfirm: function({ picker, value, index }){
this.setData({ visible: false })
onConfirm: function({detail}){
this.data.form.productId = this.data.paperList[detail.index].categoryId
this.setData({ visible: false, ['form.productCategoryName']: detail.value })
},
onHide: function(){
this.setData({ visible: false })
},
changeDeductType: function(e){
if(e.currentTarget.dataset.type == 1){
this.setData({ deductType: e.currentTarget.dataset.type, [form.deductPercent]: null })
if(Number(e.currentTarget.dataset.type) == 1){
this.setData({ deductType: e.currentTarget.dataset.type, ['form.deductPercent']: null })
} else {
this.setData({ deductType: e.currentTarget.dataset.type, [form.deductWeight]: null })
this.setData({ deductType: e.currentTarget.dataset.type, ['form.deductWeight']: null })
}
},
bindInput: function (e) {
this.data.form[e.target.id] = e.detail.value
},
onChange: function({ detail }) {
// 需要手动对 checked 状态进行更新
this.setData({ ['form.isDefault']: detail ? 1 : 0 })
},
paddingOrder: function(){
this.setData({ ['form.weighingType']: !this.data.form.weighingType })
this.setData({ ['form.isWithoutTare']: !this.data.form.isWithoutTare })
},
cancelOrder: function(e){
Dialog.confirm({ title: '温馨提示', message: '确定取消该订单?' }).then(() => {
wx.showLoading({ title: '处理中', mask: true })
cancelOrder({ id: this.data.form.id }).then(result => {
cancelOrder(this.data.form.id).then(result => {
wx.hideLoading()
util.showBackToast('订单已经删除')
event.emit('OrderMessage', { what: 12, desc: 'cancelOrder' })
@ -87,6 +90,22 @@ Page({
})
},
priceOrder: function(){
if(util.isEmpty(this.data.form.productId) || Number(this.data.form.productId) <= 0){
util.showToast('请选择废纸品类')
return
}
if(util.isEmpty(this.data.form.unitPrice) || Number(this.data.form.unitPrice) <= 0){
util.showToast('请输入单价')
return
}
if(this.data.deductType == 1 && (util.isEmpty(this.data.form.deductWeight) || Number(this.data.form.deductWeight) <= 0)){
util.showToast('请输入扣重')
return
}
if(this.data.deductType == 2 && (util.isEmpty(this.data.form.deductPercent) || Number(this.data.form.deductPercent) <= 0)){
util.showToast('请输入扣点')
return
}
wx.showLoading({ title: '处理中', mask: true })
pricingOrder(this.data.form).then(result => {
wx.hideLoading()

pages/process/order-check/index.json → pages/process/order-price/index.json

@ -6,6 +6,8 @@
"van-checkbox": "/components/checkbox/index",
"van-loading": "/components/loading/index",
"van-image": "/components/image/index",
"van-picker": "/components/picker/index",
"van-popup": "/components/popup/index",
"van-dialog": "/components/dialog/index",
"vehicle-keyboard": "/components/vehicle-keyboard/index"
}

pages/process/order-check/index.wxml → pages/process/order-price/index.wxml

@ -23,7 +23,7 @@
<text>废纸品类</text>
<text class="text-red text-xl">*</text>
</view>
<view class="text-gray">请选择废纸品类</view>
<view class="text-gray">{{form.productCategoryName || '请选择废纸品类'}}</view>
</view>
</van-cell>
<van-index-anchor index="定价信息" />
@ -33,13 +33,13 @@
<text>单价(元/KG)</text>
<text class="text-red text-xl">*</text>
</view>
<input id="settleUnitPrice" type="number" placeholder-style="color:#aaa" style="text-align: right" maxlength="8"
placeholder="请输单价" value="{{form.settleUnitPrice}}" bindinput="bindInput" />
<input id="unitPrice" type="number" placeholder-style="color:#aaa" style="text-align: right" maxlength="8"
placeholder="请输单价" value="{{form.unitPrice || ''}}" bindinput="bindInput" />
</view>
</van-cell>
<van-cell>
<view slot="title" class="flex flex-justify">
<view class="flex flex-center" class="text-black" data-type="1" bindtap="changeDeductType">
<view class="flex flex-center text-black" data-type="1" bindtap="changeDeductType">
<van-checkbox value="{{ deductType == 1 }}"></van-checkbox>
<text style="margin-left:8rpx">扣重(KG)</text>
<text class="text-red text-xl">*</text>
@ -49,8 +49,8 @@
</view>
</van-cell>
<van-cell>
<view slot="title" class="flex flex-justify" data-type="2" bindtap="changeDeductType">
<view class="flex flex-center" class="text-black">
<view slot="title" class="flex flex-justify">
<view class="flex flex-center text-black" data-type="2" bindtap="changeDeductType">
<van-checkbox value="{{ deductType == 2 }}"></van-checkbox>
<text style="margin-left:8rpx">扣点(%)</text>
<text class="text-red text-xl">*</text>
@ -62,14 +62,14 @@
<van-cell bind:click="paddingOrder">
<view slot="title" class="flex flex-justify">
<view class="text-black">是否无皮过磅</view>
<van-checkbox value="{{ form.weighingType }}"></van-checkbox>
<van-checkbox value="{{ form.isWithoutTare }}"></van-checkbox>
</view>
</van-cell>
<van-index-anchor index="过磅信息" />
<van-cell>
<view slot="title" class="flex flex-justify">
<view class="text-black">毛重(KG)</view>
<view class="text-gray">2000.00</view>
<view class="text-gray">{{form.totalWeight}}</view>
</view>
</van-cell>
<van-cell>
@ -87,11 +87,9 @@
</van-cell>
</view>
<view style="height:{{136 + safeBottom}}rpx;"></view>
<view class="cu-bar bg-white foot" style="height:{{120 + safeBottom}}rpx;padding:0rpx 32rpx {{safeBottom}}rpx 32rpx;"
wx:if="{{form}}">
<view class="cu-bar bg-white foot" style="height:{{120 + safeBottom}}rpx;padding:0rpx 32rpx {{safeBottom}}rpx 32rpx;" wx:if="{{form}}">
<van-button plain type="default" custom-style="height:88rpx;width:254rpx" bind:click="cancelOrder">取消</van-button>
<van-button type="info" custom-style="margin-left:32rpx;height:88rpx;width:400rpx" bind:click="priceOrder">提交
</van-button>
<van-button type="info" custom-style="margin-left:32rpx;height:88rpx;width:400rpx" bind:click="priceOrder">提交</van-button>
</view>
<van-dialog id="van-dialog" />

pages/process/order-check/index.wxss → pages/process/order-price/index.wxss

Loading…
Cancel
Save