Browse Source

no message

featrue/v4.1
xpz2018 5 years ago
parent
commit
bdce1f6fdf
23 changed files with 220 additions and 345 deletions
  1. 1
      app.json
  2. 17
      pages/agent/detail/index.js
  3. 16
      pages/agent/edit/index.js
  4. 7
      pages/agent/factory/index.js
  5. 6
      pages/agent/order/index.js
  6. 52
      pages/agent/vehicles/index.js
  7. 7
      pages/agent/vehicles/index.json
  8. 25
      pages/agent/vehicles/index.wxml
  9. 1
      pages/agent/vehicles/index.wxss
  10. 75
      pages/api/ztb.js
  11. 2
      pages/article/article-item/index.wxml
  12. 2
      pages/article/detail/index.wxml
  13. 2
      pages/article/list/index.wxml
  14. 8
      pages/goods/ablility/index.js
  15. 127
      pages/goods/create/index.js
  16. 27
      pages/goods/detail/index.js
  17. 28
      pages/goods/index/index.js
  18. 9
      pages/mall/index/index.js
  19. 8
      pages/purchase/ability/index.js
  20. 23
      pages/purchase/create/index.js
  21. 37
      pages/shop/create/index.js
  22. 77
      pages/shop/detail/index.js
  23. 8
      pages/shop/index/index.js

1
app.json

@ -47,7 +47,6 @@
"pages/agent/order/index",
"pages/agent/detail/index",
"pages/agent/result/index",
"pages/agent/vehicles/index",
"pages/bank/index/index",
"pages/bank/vindex/index",
"pages/bank/create/index",

17
pages/agent/detail/index.js

@ -1,5 +1,5 @@
// pages/agent/detail/index.js
const request = require('../../../utils/request') //导入模块
import { getProxyOrderInfo, cancelProxyOrder, cancelReservation, cancelProxyOrderItem } from "../../api/ztb"
const util = require('../../../utils/util')
const event = require('../../../utils/event.js')
const app = getApp()
@ -27,9 +27,7 @@ Page({
},
fetchOrderInfo: function(){
wx.showLoading({ title: '加载中', mask: true })
// /proxy-sell/get/proxy-order/{orderId}客户查看订单详情
request.get('/recycle-service/proxy-sell/get/proxy-order/' + this.data.id).then(result => {
//成功回调
getProxyOrderInfo(this.data.id).then(result => {
this.data.cancel = true
for (let index = 0; index < result.data.orderItems.length; index++) {
const element = result.data.orderItems[index]
@ -41,7 +39,6 @@ Page({
this.setData({orderInfo: result.data, safeBottom: app.globalData.safeBottom, cancel: this.data.cancel })
wx.hideLoading()
}).catch(err => {
//异常回调
wx.hideLoading()
util.showToast(err)
})
@ -60,7 +57,7 @@ Page({
type: 'primary',
onTap(e) {
wx.showLoading({ title: '处理中', mask: true })
request.post('/recycle-service/proxy-sell/cancel/order/' + that.data.orderInfo.orderId).then(result => {
cancelProxyOrder(that.data.orderInfo.orderId).then(result => {
//成功回调
wx.hideLoading()
that.setData({ ['orderInfo.status']: 55 })
@ -89,14 +86,12 @@ Page({
type: 'primary',
onTap(e) {
wx.showLoading({ title: '处理中', mask: true })
request.post('/recycle-service/proxy-sell/cancel/reservation/' + that.data.orderInfo.orderId).then(result => {
//成功回调
cancelReservation(that.data.orderInfo.orderId).then(result => {
wx.hideLoading()
that.setData({ ['orderInfo.status']: 50 })
event.emit('ProxyMessage', { what: 400, desc: 'ProxyChange' })
util.showToast('订单预约已经取消')
}).catch(err => {
//异常回调
wx.hideLoading()
util.showToast(err)
})
@ -119,14 +114,12 @@ Page({
type: 'primary',
onTap(e) {
wx.showLoading({ title: '处理中', mask: true })
request.post('/recycle-service/proxy-sell/cancel/order-item/' + orderItem.id).then(result => {
//成功回调
cancelProxyOrderItem(orderItem.id).then(result => {
wx.hideLoading()
// 如果全部都关闭了,那么订单也就关闭了
util.showToast('送货已经取消')
that.fetchOrderInfo()
}).catch(err => {
//异常回调
wx.hideLoading()
util.showToast(err)
})

16
pages/agent/edit/index.js

@ -1,5 +1,5 @@
// pages/order/create/index.js
const request = require('../../../utils/request') //导入模块
import { getVehicleList, getFactoryPriceDetail, getRelation, postRelation, getProxyOrderInfo, createProxyOrder } from "../../api/ztb"
const util = require('../../../utils/util')
const math = require('../../../utils/math')
const event = require('../../../utils/event.js')
@ -38,7 +38,7 @@ Page({
if(options.id){
this.data.form.paperCategoryId = options.categoryId
wx.showLoading({ title: '加载中', mask: true })
request.get('/recycle-service/proxy-sell/get/his-car-info').then(result => {
getVehicleList().then(result => {
this.data.plateList = result.data.records
if(this.data.plateList.length <= 7){
this.setData({ vateList: this.data.plateList })
@ -50,7 +50,7 @@ Page({
}).catch(err => {
//异常回调
})
request.get('/recycle-service/get/paper-mill-paper-category-price-details/' + options.id).then(result => {
getFactoryPriceDetail(options.id).then(result => {
//成功回调
this.data.cateList = []
if(result.data.paperCategoryList && result.data.paperCategoryList.length){
@ -82,8 +82,7 @@ Page({
})
} else if(options.orderId){
wx.showLoading({ title: '加载中', mask: true })
// /proxy-sell/get/proxy-order/{orderId}客户查看订单详情
request.get('/recycle-service/proxy-sell/get/proxy-order/' + options.orderId).then(result => {
getProxyOrderInfo(options.orderId).then(result => {
//成功回调
this.setData({
form: result.data,
@ -98,8 +97,7 @@ Page({
util.showToast(err)
})
}
// /proxy-sell/get/relation 查询客户业务人员绑定信息接口
request.get('/recycle-service/proxy-sell/get/relation').then(result => {
getRelation().then(result => {
//成功回调
if(util.isEmpty(result.data) || util.isEmpty(result.data.bizUserId)){
this.showDialog()
@ -138,7 +136,7 @@ Page({
},
bindRelation: function(code){
wx.showLoading({ title: '处理中', mask: true })
request.post('/recycle-service/proxy-sell/bind/relation?code=' + code).then(result => {
postRelation(code).then(result => {
//成功回调
wx.hideLoading()
}).catch(err => {
@ -277,7 +275,7 @@ Page({
that.data.form.carInfos = vehicleList
that.setData({ requesting: true })
wx.showLoading({ title: '加载中', mask: true })
request.post('/recycle-service/proxy-sell/create/order', that.data.form).then(result => {
createProxyOrder(that.data.form).then(result => {
//成功回调
wx.hideLoading()
wx.redirectTo({ url: '/pages/agent/result/index' })

7
pages/agent/factory/index.js

@ -1,5 +1,6 @@
// pages/mall/factory/index.js
const request = require('../../../utils/request') //导入模块
import { getFactoryPriceDetail } from "../../api/ztb"
import { getPreferList } from "../../api/moment"
const event = require('../../../utils/event')
const util = require('../../../utils/util')
const app = getApp()
@ -48,7 +49,7 @@ Page({
this.data.id = options.id
this.data.form.millPaperId = options.id
wx.showLoading({ title: '加载中', mask: true })
request.get('/recycle-service/get/paper-mill-paper-category-price-details/' + options.id).then(result => {
getFactoryPriceDetail(options.id).then(result => {
//成功回调
if(result.data.paperCategoryList && result.data.paperCategoryList.length){
this.data.cateId = result.data.paperCategoryList[this.data.cateIndex].categoryId
@ -127,7 +128,7 @@ Page({
return
}
this.setData({ requesting: true })
request.get('/information-center/article/get/Article-list/', this.data.form).then(result => {
getPreferList(this.data.form).then(result => {
//成功回调
if (result.data.records.length) {
var respList = result.data.records

6
pages/agent/order/index.js

@ -1,5 +1,5 @@
// pages/bidding/index/index.js
const request = require('../../../utils/request') //导入模块
import { getProxyOrderList } from "../../api/ztb"
const util = require('../../../utils/util')
const event = require('../../../utils/event.js')
const app = getApp()
@ -64,9 +64,7 @@ Page({
requesting: true
})
}
// /product/cheapList特价产品列表
request.get('/recycle-service/proxy-sell/get/proxy-order-list', this.data.form).then(result => {
//成功回调
getProxyOrderList(this.data.form).then(result => {
if (result.data.records.length) {
var respList = result.data.records
let nowList = `orderList[${this.data.orderList.length}]`

52
pages/agent/vehicles/index.js

@ -1,52 +0,0 @@
// pages/agent/vehicles/index.js
const request = require('../../../utils/request') //导入模块
const util = require('../../../utils/util')
const event = require('../../../utils/event.js')
const app = getApp()
Page({
/**
* 页面的初始数据
*/
data: {
height: app.globalData.fragmentHeight,
loading: true,
plateList: []
},
/**
* 生命周期函数--监听页面加载
*/
onLoad: function (options) {
this.setData({ height: app.globalData.fragmentHeight })
// /proxy-sell/get/his-car-info客户查看历史车辆
request.get('/recycle-service/proxy-sell/get/his-car-info').then(result => {
this.setData({ plateList: result.data.records, loading: false })
}).catch(err => {
//异常回调
this.setData({ loading: false })
util.showToast(err)
})
},
selectItem: function (e) {
var item = this.data.plateList[e.currentTarget.dataset.index]
event.emit('EventMessage', { what: 402, obj: item, desc: 'PlateChoose' })
wx.navigateBack({ delta: 1 })
},
deleteItem: function (e) {
var item = this.data.plateList[e.currentTarget.dataset.index]
wx.showLoading({ title: '加载中', mask: true })
// /proxy-sell/get/his-car-info客户查看历史车辆
request.get('/recycle-service/proxy-sell/delete/his-car-info', { id: item.id }).then(result => {
this.data.plateList.splice(e.currentTarget.dataset.index, 1)
this.setData({ plateList: this.data.plateList })
wx.hideLoading()
}).catch(err => {
//异常回调
wx.hideLoading()
util.showToast(err)
})
}
})

7
pages/agent/vehicles/index.json

@ -1,7 +0,0 @@
{
"usingComponents": {
"wux-cell-group": "/components/cell-group/index",
"wux-cell": "/components/cell/index",
"wux-button": "/components/button/index"
}
}

25
pages/agent/vehicles/index.wxml

@ -1,25 +0,0 @@
<!--pages/agent/vehicles/index.wxml-->
<cu-custom bgColor="bg-white" isBack="{{true}}">
<view slot="content" style="color:black;font-size:36rpx">历史车辆</view>
</cu-custom>
<scroll-view scroll-y style="height: {{height}}rpx">
<view class="bg-white list-empty" style="height:{{height}}rpx" wx:if="{{!plateList.length}}">
<view class="load-spinner text-gray" style="margin-bottom:24px" wx:if="{{loading}}" />
<image class="img-empty" src="/assets/image/list_empty.png" wx:else></image>
<view class="text-empty">{{loading? '正在加载' : '暂无数据'}}</view>
</view>
<wux-cell-group wx:else>
<wux-cell wx:for="{{plateList}}" wx:key="index" data-index="{{index}}" bind:click="selectItem">
<view slot="header">
<view class="text-sg text-black text-bold" style="line-height:30rpx;">{{item.plateNumber}}</view>
<view class="flex" style="margin-top:18rpx">
<view class="text-sg text-gray" style="line-height: 30rpx;width:150rpx">{{item.driverName}}</view>
<view class="text-sg text-gray" style="line-height: 30rpx;">{{item.driverPhone}}</view>
</view>
</view>
<wux-button slot="footer" outline type="assertive" size="small" data-index="{{index}}" bind:click="deleteItem">删除
</wux-button>
</wux-cell>
</wux-cell-group>
</scroll-view>

1
pages/agent/vehicles/index.wxss

@ -1 +0,0 @@
/* pages/agent/vehicles/index.wxss */

75
pages/api/ztb.js

@ -16,6 +16,8 @@ const getBaseInfo = () => mGet(`/recycle-service/user/get/base-info`, null, zcon
const getAllFactoryList = () => mGet(`/recycle-service/get/all-paper-mill`, null, zconfig)
// /get/paper-mill-paper-category-price-list 获取纸厂品类价格信息列表
const getFactoryPrice = () => mGet(`/recycle-service/get/paper-mill-paper-category-price-list`, null, zconfig)
// /get/paper-mill-paper-category-price-details/{id} 获取纸厂品类价格信息详情
const getFactoryPriceDetail = (id) => mGet(`/recycle-service/get/paper-mill-paper-category-price-details/${id}`, null, zconfig)
// /get/paper-mill-city 获取纸厂所有地区列表
const getFactoryCity = () => mGet(`/recycle-service/get/paper-mill-city`, null, zconfig)
// /get/index-info-id 首页获取公告id接口
@ -24,6 +26,46 @@ const getIndexInfoId = () => mGet(`/recycle-service/get/index-info-id`, null, zc
const getFactoryList = () => mGet(`/recycle-service/get/paper-mill-list`, null, zconfig)
// /get/paper-mill-received-weight-list/on-today 获取纸厂今日收货量(排队)列表
const getFactoryTodayList = (params) => mGet(`/recycle-service/get/paper-mill-received-weight-list/on-today`, params, zconfig)
// /proxy-sell/get/his-car-info 客户查看历史车辆
const getVehicleList = () => mGet(`/recycle-service/proxy-sell/get/his-car-info`, null, zconfig)
// /proxy-sell/get/relation 查询客户业务人员绑定信息接口
const getRelation = () => mGet(`/recycle-service/proxy-sell/get/relation`, null, zconfig)
// /recycle-service/proxy-sell/bind/relation
const postRelation = (code) => mPost(`/recycle-service/proxy-sell/bind/relation?code=${code}`, null, zconfig)
// /proxy-sell/get/proxy-order/{orderId}客户查看订单详情
const getProxyOrderInfo = (id) => mGet(`/recycle-service/proxy-sell/get/proxy-order/${id}`, null, zconfig)
// recycle-service/proxy-sell/get/proxy-order-list
const getProxyOrderList = (params) => mGet(`/recycle-service/proxy-sell/get/proxy-order-list`, params, zconfig)
// recycle-service/proxy-sell/create/order
const createProxyOrder = (params) => mPost(`/recycle-service/proxy-sell/create/order`, params, zconfig)
const cancelProxyOrder = (id) => mPost(`/recycle-service/proxy-sell/cancel/order/${id}`, null, zconfig)
const cancelReservation = (id) => mPost(`/recycle-service/proxy-sell/cancel/reservation/${id}`, null, zconfig)
const cancelProxyOrderItem = (id) => mPost(`/recycle-service/proxy-sell/cancel/order-item/${id}`, null, zconfig)
// /purchase/get/product-list 获取店铺采购商品列表接口
const getProductList = (params) => mGet(`/recycle-service/purchase/get/product-list`, params, zconfig)
// /recycle-service/get/store-product-list
const getStoreProductList = (params) => mGet(`/recycle-service/get/store-product-list`, params, zconfig)
const getStoreInfo = (id) => mGet(`/recycle-service/get/store-information/${id}`, null, zconfig)
const getStoreOverView = () => mGet(`/recycle-service/get/store-overview`, null, zconfig)
const updateStore = (params) => mPost(`/recycle-service/update/store-information`, params, zconfig)
const editStore = (params) => mPost(`/recycle-service/edit/store-information`, params, zconfig)
const depositStore = (params) => mPost(`/recycle-service/create/store-deposit-order`, params, zconfig)
const updatePurchase = (params) => mPost(`/recycle-service/purchase/update/product`, params, zconfig)
const createPurchase = (params) => mPost(`/recycle-service/purchase/create/product`, params, zconfig)
const paperCategoryList = (params) => mPost(`/recycle-service/paperCategoryList`, params, zconfig)
const getPurchaseInfo = (id) => mGet(`/recycle-service/purchase/get/product/${id}`, null, zconfig)
const getMiniProxyList = (params) => mGet(`/recycle-service/get/product-index-list/for/mini`, params, zconfig)
const getProductInfo = (id) => mGet(`/recycle-service/get/product/${id}`, null, zconfig)
const createProductInfo = (params) => mPost(`/recycle-service/create/product`, params, zconfig)
const updateProductInfo = (params) => mPost(`/recycle-service/update/product`, params, zconfig)
const getWaterRate = () => mGet(`/recycle-service/get/water-rate`, null, zconfig)
const getDopantRate = () => mGet(`/recycle-service/get/dopant-rate`, null, zconfig)
const getBiddingInterval = () => mGet(`/recycle-service/get/bidding-interval`, null, zconfig)
const getGoodProductList = (params) => mGet(`/recycle-service/get/product-list`, params, zconfig)
// /recycle-service/update/product-status
const statusProductInfo = (params) => mPost(`/recycle-service/update/product-status`, params, zconfig)
const deleteProduct = (params) => mPost(`/recycle-service/delete/product`, params, zconfig)
export {
zconfig,
@ -34,5 +76,36 @@ export {
getFactoryCity,
getIndexInfoId,
getFactoryList,
getFactoryTodayList
getFactoryTodayList,
getVehicleList,
getFactoryPriceDetail,
getRelation,
postRelation,
getProxyOrderInfo,
getProxyOrderList,
createProxyOrder,
cancelProxyOrder,
cancelReservation,
cancelProxyOrderItem,
getProductList,
getStoreProductList,
getStoreInfo,
getStoreOverView,
depositStore,
updateStore,
editStore,
updatePurchase,
createPurchase,
paperCategoryList,
getPurchaseInfo,
getMiniProxyList,
getProductInfo,
createProductInfo,
updateProductInfo,
getWaterRate,
getDopantRate,
getBiddingInterval,
getGoodProductList,
statusProductInfo,
deleteProduct
}

2
pages/article/article-item/index.wxml

@ -1,5 +1,5 @@
<!--pages/main/index.wxml-->
<wxs module="moment" src="../../moment/index.wxs"></wxs>
<wxs module="moment" src="../index.wxs"></wxs>
<view class="cu-item shadow bg-white" bindtap="lookItem">
<view class="flex flex-justify" style="padding:20rpx 32rpx">
<view class="flex" style="justify-content: flex-start;">

2
pages/article/detail/index.wxml

@ -1,5 +1,5 @@
<!--pages/moment/detail/index.wxml-->
<wxs module="moment" src="../../moment/index.wxs"></wxs>
<wxs module="moment" src="../index.wxs"></wxs>
<cu-custom bgColor="bg-white" isBack="{{true}}">
<view slot="content">帖子详情</view>
</cu-custom>

2
pages/article/list/index.wxml

@ -1,5 +1,5 @@
<!--pages/moment/list/index.wxml-->
<wxs module="moment" src="../../moment/index.wxs"></wxs>
<wxs module="moment" src="../index.wxs"></wxs>
<cu-custom bgColor="bg-white" isBack="{{true}}">
<view slot="content">我的帖子</view>
</cu-custom>

8
pages/goods/ablility/index.js

@ -1,6 +1,5 @@
// pages/agent/index/index.js
const request = require('../../../utils/request') //导入模块
const util = require('../../../utils/util')
import { paperCategoryList, getMiniProxyList } from "../../api/ztb"
const app = getApp()
const statusList = [1, 2]
@ -41,8 +40,7 @@ Page({
this.fetchGoodsList()
},
fetchCateList: function(){
request.post('/recycle-service/paperCategoryList', { type: 1 }).then(result => {
//成功回调
paperCategoryList({ type: 1 }).then(result => {
var tabList = ['全部']
var size = 0
for (let index = 0; index < result.data.length; index++) {
@ -97,7 +95,7 @@ Page({
} else {
this.setData({ requesting: true })
}
request.get('/recycle-service/get/product-index-list/for/mini', this.data.form).then(result => {
getMiniProxyList(this.data.form).then(result => {
//成功回调
if (result.data.records.length) {
var respList = result.data.records

127
pages/goods/create/index.js

@ -1,7 +1,7 @@
// pages/goods/create/index.js
import { paperCategoryList, getProductInfo, createProductInfo, updateProductInfo, getWaterRate, getDopantRate, getBiddingInterval } from "../../api/ztb"
import regions from '../../../utils/region'
const math = require('../../../utils/math')
const request = require('../../../utils/request') //导入模块
const util = require('../../../utils/util')
const event = require('../../../utils/event.js')
const app = getApp()
@ -60,55 +60,29 @@ Page({
})
this.cascaderView = this.cascaderView || this.selectComponent('#wux-cascader')
this.pickerView = this.pickerView || this.selectComponent('#picker-view')
wx.showLoading({
title: '加载中',
mask: true
})
// /recycle-service/get/dopant-rate 含杂比
request.get('/recycle-service/get/dopant-rate').then(result => {
//成功回调
wx.showLoading({ title: '加载中', mask: true })
getDopantRate().then(result => {
var list = []
result.data.forEach((item) => {
list.push({
text: item.name,
value: item.id
})
})
this.setData({
dopantList: list
list.push({ text: item.name, value: item.id })
})
this.setData({ dopantList: list })
})
// /recycle-service/get/water-rate 含水比
request.get('/recycle-service/get/water-rate').then(result => {
//成功回调
getWaterRate().then(result => {
var list = []
result.data.forEach((item) => {
list.push({
text: item.name,
value: item.id
})
})
this.setData({
waterList: list
list.push({ text: item.name, value: item.id })
})
this.setData({ waterList: list })
})
// /recycle-service/get/bidding-interval 含水比
request.get('/recycle-service/get/bidding-interval').then(result => {
//成功回调
getBiddingInterval().then(result => {
var list = []
result.data.forEach((item) => {
list.push({
text: item.name,
value: item.id
})
})
this.setData({
intervalList: list
list.push({ text: item.name, value: item.id })
})
this.setData({ intervalList: list })
})
// /paperCategoryList 获取纸品列表
request.post('/recycle-service/paperCategoryList', { type: 1 }).then(result => {
//成功回调
paperCategoryList({ type: 1 }).then(result => {
var cateList = []
result.data.forEach((item) => {
cateList.push({
@ -130,9 +104,7 @@ Page({
}
})
if (options.id) {
// /paperCategoryList 获取纸品列表
request.get('/recycle-service/get/product/' + options.id).then(result => {
//成功回调
getProductInfo(options.id).then(result => {
var fileList = []
if (result.data.imgList && result.data.imgList.length) {
result.data.imgList.forEach(element => {
@ -207,24 +179,13 @@ Page({
}
},
InputFocus(e) {
this.setData({
focus: true,
toView: 'textarea',
keyboard: e.detail.height
})
this.setData({ focus: true, toView: 'textarea', keyboard: e.detail.height })
},
InputBlur(e) {
this.setData({
keyboard: 0,
focus: false,
toView: null
})
this.setData({ keyboard: 0, focus: false, toView: null })
},
textareaFocus: function(e){
this.setData({
focus: true,
toView: 'textarea'
})
this.setData({ focus: true, toView: 'textarea' })
},
onVideoChange: function (e) {
if (e.detail && e.detail.length) {
@ -257,18 +218,12 @@ Page({
const { value } = e.detail
const options = [...this.data.cateList]
var typeId = parseInt(value[value.length - 1])
wx.showLoading({
title: '加载中',
mask: true
})
request.post('/recycle-service/paperCategoryList', { type: 2, firstCategoryId: typeId}).then(result => {
wx.showLoading({ title: '加载中', mask: true })
paperCategoryList({ type: 2, firstCategoryId: typeId}).then(result => {
//成功回调
var list = []
result.data.forEach((item) => {
list.push({
label: item.name,
value: item.id
})
list.push({ label: item.name, value: item.id })
})
options.forEach((element) => {
if (parseInt(element.value) === typeId) {
@ -287,9 +242,7 @@ Page({
return
}
this.cascaderView.showPicker(this.data.region)
this.setData({
picking: true
})
this.setData({ picking: true })
},
onRegionInit: function (e) {
if (this.data.form.locDistrictId && e.detail.length == 3) {
@ -311,16 +264,10 @@ Page({
this.data.form['locDistrictId'] = e.detail.value[2]
this.data.form['locDistrictName'] = e.detail.options[2].label
}
this.setData({
picking: false
})
this.setData({ picking: false })
},
showPaperPicker: function (e) {
// this.pickerView.showPicker(this.data.cateList, this.data.form.secondCategoryId, 0)
this.setData({
visible: true,
picking: true
})
this.setData({ visible: true, picking: true })
var list = [this.data.cateList[0].value]
if(!this.data.cateList[0].children){
this.onLoadOptions({detail: { value: list}})
@ -459,14 +406,8 @@ Page({
util.showToast('请输入商品描述')
return
}
this.setData({
requesting: true
})
wx.showLoading({
title: '加载中',
mask: true
})
// /paperCategoryList 获取纸品列表
this.setData({ requesting: true })
wx.showLoading({ title: '加载中', mask: true })
if(!app.globalData.kg){
this.data.form.unitPrice = math.divide(this.data.form.unitPrice, 1000)
this.data.form.stock = math.times(this.data.form.stock, 1000)
@ -475,33 +416,23 @@ Page({
}
}
if (this.data.form.productId) {
request.post('/recycle-service/update/product', this.data.form).then(result => {
//成功回调
updateProductInfo(this.data.form).then(result => {
wx.hideLoading()
event.emit('EventMessage', {
what: 102,
desc: 'GoodsCreate'
})
event.emit('EventMessage', { what: 102, desc: 'GoodsCreate' })
util.showBackToast('商品发布成功!')
}).catch(err => {
//异常回调
wx.hideLoading()
this.setData({
requesting: false
})
this.setData({ requesting: false })
util.showToast(err)
})
} else {
request.post('/recycle-service/create/product', this.data.form).then(result => {
//成功回调
createProductInfo(this.data.form).then(result => {
wx.hideLoading()
util.showBackToast('商品创建成功!')
}).catch(err => {
//异常回调
wx.hideLoading()
this.setData({
requesting: false
})
this.setData({ requesting: false })
util.showToast(err)
})
}

27
pages/goods/detail/index.js

@ -1,8 +1,8 @@
// pages/order/order-info/index.js
const request = require('../../../utils/request'); //导入模块
const util = require('../../../utils/util');
const math = require('../../../utils/math');
const event = require('../../../utils/event.js')
import { getProductInfo } from "../../api/ztb"
const util = require('../../../utils/util')
const math = require('../../../utils/math')
const event = require('../../../utils/event')
const app = getApp()
Page({
@ -42,13 +42,8 @@ Page({
})
event.on('EventMessage', this, this.onEvent)
if (options.id) {
wx.showLoading({
title: '加载中',
mask: true
})
// /product/{id}产品详情
request.get('/recycle-service/get/product/' + options.id).then(result => {
//成功回调
wx.showLoading({ title: '加载中', mask: true })
getProductInfo(options.id).then(result => {
wx.hideLoading()
var vurl = null
var imgList = []
@ -282,15 +277,7 @@ Page({
this.data.form.outline = this.data.orderInfo.outline
this.data.form.litimgUrl = this.data.orderInfo.litimgUrl
this.data.form.unit = this.data.orderInfo.unit
wx.navigateTo({
url: '/pages/mall/order-offer/index?json=' + JSON.stringify(this.data.form)
})
},
// 就行登录流程;然后进入下一步的支付操作
onGotPhoneNumber: function (e) {
request.loginWechat(e.detail).then(data => {
this.offerProject()
})
wx.navigateTo({ url: '/pages/mall/order-offer/index?json=' + JSON.stringify(this.data.form) })
},
onShareAppMessage: function () {
return {

28
pages/goods/index/index.js

@ -1,7 +1,7 @@
// pages/goods/index/index.js
const request = require('../../../utils/request'); //导入模块
const util = require('../../../utils/util');
const event = require('../../../utils/event.js')
import { paperCategoryList, getGoodProductList, statusProductInfo, deleteProduct } from "../../api/ztb"
const util = require('../../../utils/util')
const event = require('../../../utils/event')
const app = getApp()
const statusList = [1, 2]
@ -64,7 +64,7 @@ Page({
this.fetchGoodsList()
},
fetchCateList: function(){
request.post('/recycle-service/paperCategoryList', { type: 1 }).then(result => {
paperCategoryList({ type: 1 }).then(result => {
//成功回调
var tabList = ['全部']
var size = 0
@ -95,13 +95,9 @@ Page({
if (this.data.loading) {
this.data.requesting = true
} else {
this.setData({
requesting: true
})
this.setData({ requesting: true })
}
// /recycle-service/get/product-list
request.get('/recycle-service/get/product-list', this.data.form).then(result => {
//成功回调
getGoodProductList(this.data.form).then(result => {
if (result.data.records.length) {
var respList = result.data.records
let nowList = `orderList[${this.data.orderList.length}]`
@ -151,9 +147,7 @@ Page({
},
editItem: function (e) {
var item = this.data.orderList[e.currentTarget.dataset.page][e.currentTarget.dataset.index]
wx.navigateTo({
url: '/pages/goods/create/index?id=' + item.id
})
wx.navigateTo({ url: '/pages/goods/create/index?id=' + item.id })
},
shelvesItem: function (e) {
var page = e.currentTarget.dataset.page
@ -181,9 +175,7 @@ Page({
},
statusItem: function(item, page, index, status){
wx.showLoading({ title: '处理中', mask: true })
// /paperCategoryList 获取纸品列表
request.post('/recycle-service/update/product-status', {productId: item.id, status}).then(result => {
//成功回调
statusProductInfo({productId: item.id, status}).then(result => {
this.setData({ ['orderList[' + page + '][' + index + '].status']: status })
wx.hideLoading()
if(status == 2){
@ -217,9 +209,7 @@ Page({
},
deleteItem: function(item){
wx.showLoading({ title: '处理中', mask: true })
// /paperCategoryList 获取纸品列表
request.post('/recycle-service/delete/product', {productId: item.id}).then(result => {
//成功回调
deleteProduct({productId: item.id}).then(result => {
wx.hideLoading()
this.onRefreshList()
util.showToast('商品删除成功!')

9
pages/mall/index/index.js

@ -1,5 +1,5 @@
// pages/message/index.js
import { getFactoryPrice } from "../../api/ztb"
import { getFactoryPrice, getProductList, getMiniProxyList } from "../../api/ztb"
const request = require('../../../utils/request') //导入模块
const event = require('../../../utils/event')
const util = require('../../../utils/util')
@ -253,8 +253,7 @@ Component({
} else {
this.setData({ ['requesting[' + this.data.tabIndex + ']']: true })
}
request.get('/recycle-service/get/product-index-list/for/mini', this.data.form[0]).then(result => {
//成功回调
getMiniProxyList(this.data.form[0]).then(result => {
if (result.data.records.length) {
var respList = result.data.records
let nowList = `orderList[${this.data.orderList.length}]`
@ -275,7 +274,6 @@ Component({
})
}
}).catch(err => {
//异常回调
this.setData({
['requesting[0]']: false,
['finished[0]']: true,
@ -293,8 +291,7 @@ Component({
} else {
this.setData({ ['requesting[1]']: true })
}
// /purchase/get/product-list 获取店铺采购商品列表接口
request.get('/recycle-service/purchase/get/product-list', this.data.form[1]).then(result => {
getProductList(this.data.form[1]).then(result => {
//成功回调
if (result.data.records.length) {
var respList = result.data.records

8
pages/purchase/ability/index.js

@ -1,6 +1,5 @@
// pages/agent/index/index.js
const request = require('../../../utils/request') //导入模块
const util = require('../../../utils/util')
import { paperCategoryList } from "../../api/ztb"
const app = getApp()
Page({
@ -31,7 +30,7 @@ Page({
this.fetchGoodsList()
},
fetchCateList: function(){
request.post('/recycle-service/paperCategoryList', { type: 1 }).then(result => {
paperCategoryList({ type: 1 }).then(result => {
//成功回调
var cateList = [{id: '', name: '全部'}].concat(result.data)
this.setData({ cateList: cateList, cateScroll: cateList.length >= 5 })
@ -64,8 +63,7 @@ Page({
} else {
this.setData({ requesting: true })
}
// /purchase/get/product-list 获取店铺采购商品列表接口
request.get('/recycle-service/purchase/get/product-list', this.data.form).then(result => {
getProductList(this.data.form).then(result => {
//成功回调
if (result.data.records.length) {
var respList = result.data.records

23
pages/purchase/create/index.js

@ -1,9 +1,8 @@
// pages/goods/create/index.js
import { updatePurchase, createPurchase, paperCategoryList, getPurchaseInfo } from "../../api/ztb"
import regions from '../../../utils/region'
const math = require('../../../utils/math')
const request = require('../../../utils/request') //导入模块
const util = require('../../../utils/util')
const event = require('../../../utils/event.js')
const app = getApp()
Page({
@ -35,7 +34,7 @@ Page({
this.cascaderView = this.cascaderView || this.selectComponent('#wux-cascader')
wx.showLoading({ title: '加载中', mask: true })
if (options.id) {
request.get('/recycle-service/purchase/get/product/' + options.id).then(result => {
getPurchaseInfo(options.id).then(result => {
//成功回调
var fileList = []
if (result.data.imgList && result.data.imgList.length) {
@ -78,9 +77,7 @@ Page({
util.showToast(err)
})
}
// /paperCategoryList 获取纸品列表
request.post('/recycle-service/paperCategoryList', { type: 1 }).then(result => {
//成功回调
paperCategoryList({ type: 1 }).then(result => {
var cateList = []
result.data.forEach((item) => {
cateList.push({ label: item.name, value: item.id, isLeaf: false })
@ -90,7 +87,6 @@ Page({
wx.hideLoading()
}
}).catch(err => {
//异常回调
if (!options.id) {
wx.hideLoading()
}
@ -128,12 +124,8 @@ Page({
const { value } = e.detail
const options = [...this.data.cateList]
var typeId = parseInt(value[value.length - 1])
wx.showLoading({
title: '加载中',
mask: true
})
request.post('/recycle-service/paperCategoryList', { type: 2, firstCategoryId: typeId }).then(result => {
//成功回调
wx.showLoading({ title: '加载中', mask: true })
paperCategoryList({ type: 2, firstCategoryId: typeId }).then(result => {
var list = []
result.data.forEach((item) => {
list.push({ label: item.name, value: item.id })
@ -146,7 +138,6 @@ Page({
this.setData({ cateList: options })
wx.hideLoading()
}).catch(err => {
//异常回调
wx.hideLoading()
})
},
@ -221,7 +212,7 @@ Page({
this.setData({ requesting: true })
wx.showLoading({ title: '加载中', mask: true })
if (this.data.form.productId) {
request.post('/recycle-service/purchase/update/product', this.data.form).then(result => {
updatePurchase(this.data.form).then(result => {
//成功回调
wx.hideLoading()
util.showBackToast('修改成功!')
@ -232,7 +223,7 @@ Page({
util.showToast(err)
})
} else {
request.post('/recycle-service/purchase/create/product', this.data.form).then(result => {
createPurchase(this.data.form).then(result => {
//成功回调
wx.hideLoading()
util.showBackToast('发布采购成功!')

37
pages/shop/create/index.js

@ -1,10 +1,9 @@
// pages/shop/apply/index.js
const request = require('../../../utils/request')//导入模块
import { updateStore, getStoreInfo, editStore } from "../../api/ztb"
const util = require('../../../utils/util')
import regions from '../../../utils/region'
Page({
/**
* 页面的初始数据
*/
@ -33,9 +32,7 @@ Page({
if(options.storeId){
this.data.form['storeId'] = options.storeId
wx.showLoading({ title: '加载中', mask: true })
// /paperCategoryList 获取纸品列表
request.get('/recycle-service/get/store-information/' + options.storeId).then(result => {
//成功回调
getStoreInfo(options.storeId).then(result => {
var fileList = []
if(result.data.coverImgUrlList && result.data.coverImgUrlList.length){
result.data.coverImgUrlList.forEach(element => {
@ -113,21 +110,25 @@ Page({
}
this.setData({requesting: true})
wx.showLoading({ title: '加载中', mask: true })
// /paperCategoryList 获取纸品列表
var url = '/recycle-service/update/store-information'
if(!util.isEmpty(this.data.form.storeId)){
url = '/recycle-service/edit/store-information'
editStore(this.data.form).then(result => {
wx.hideLoading()
util.showBackToast('店铺完善成功')
}).catch(err => {
wx.hideLoading()
util.showToast(err)
this.setData({requesting: false})
})
} else {
updateStore(this.data.form).then(result => {
wx.hideLoading()
util.showBackToast('店铺完善成功')
}).catch(err => {
wx.hideLoading()
util.showToast(err)
this.setData({requesting: false})
})
}
request.post(url, this.data.form).then(result => {
//成功回调
wx.hideLoading()
util.showBackToast('店铺完善成功')
}).catch(err => {
//异常回调
wx.hideLoading()
util.showToast(err)
this.setData({requesting: false})
})
}
})

77
pages/shop/detail/index.js

@ -1,9 +1,8 @@
// pages/shop/detail/index.js
const request = require('../../../utils/request')//导入模块
import { getProductList, getStoreProductList } from "../../api/ztb"
const math = require('../../../utils/math')
const util = require('../../../utils/util')
const app = getApp()
const urlList = ['/recycle-service/get/store-product-list', '/recycle-service/purchase/get/product-list']
Page({
/**
@ -33,7 +32,7 @@ Page({
onLoad: function (options) {
this.data.form.storeId = options.storeId
wx.showLoading({ title: '加载中', mask: true })
request.get('/recycle-service/get/store-information/' + options.storeId).then(result => {
getStoreInfo(options.storeId).then(result => {
//成功回调
this.setData({
detail: result.data,
@ -86,49 +85,55 @@ Page({
} else {
this.setData({ requesting: true })
}
// /product/cheapList特价产品列表
request.get(urlList[this.data.tabIndex], this.data.form).then(result => {
//成功回调
if (result.data.records.length) {
var respList = result.data.records
let nowList = `orderList[${this.data.orderList.length}]`
var num = this.data.form.pageNum
var finished = this.data.form.pageNum >= result.data.pages
if(this.data.form.pageNum == 1){
this.setData({
[nowList]: respList,
total: result.data.total,
['form.pageNum']: (num + 1),
top: 0,
finished,
requesting: false,
loading: false
})
} else {
this.setData({
[nowList]: respList,
total: result.data.total,
['form.pageNum']: (num + 1),
finished,
requesting: false,
loading: false
})
}
if(this.data.tabIndex == 0){
getStoreProductList(this.data.form).then(result => {
this.doResult(result)
}).catch(err => {
this.setData({ requesting: false, loading: false })
util.showToast(err)
})
} else if(this.data.tabIndex == 1){
getProductList(this.data.form).then(result => {
this.doResult(result)
}).catch(err => {
this.setData({ requesting: false, loading: false })
util.showToast(err)
})
}
},
doResult: function(result){
if (result.data.records.length) {
var respList = result.data.records
let nowList = `orderList[${this.data.orderList.length}]`
var num = this.data.form.pageNum
var finished = this.data.form.pageNum >= result.data.pages
if(this.data.form.pageNum == 1){
this.setData({
[nowList]: respList,
total: result.data.total,
['form.pageNum']: (num + 1),
top: 0,
finished,
requesting: false,
loading: false
})
} else {
this.setData({
finished: true,
[nowList]: respList,
total: result.data.total,
['form.pageNum']: (num + 1),
finished,
requesting: false,
loading: false
})
}
}).catch(err => {
//异常回调
} else {
this.setData({
finished: true,
requesting: false,
loading: false
})
util.showToast(err)
})
}
},
lookItem: function(event){
var item = this.data.orderList[event.currentTarget.dataset.page][event.currentTarget.dataset.index]

8
pages/shop/index/index.js

@ -1,5 +1,5 @@
// pages/shop/index/index.js
const request = require('../../../utils/request') //导入模块
import { getStoreOverView, getStoreInfo } from "../../api/ztb"
const math = require('../../../utils/math')
const util = require('../../../utils/util')
const app = getApp()
@ -35,7 +35,7 @@ Page({
onShow: function () {
wx.showLoading({ title: '加载中', mask: true })
// get/store-overview
request.get('/recycle-service/get/store-overview').then(result => {
getStoreOverView().then(result => {
//成功回调
app.globalData.userInfo.hasStore = result.data.hasStore
this.setData({ form: result.data, hasStore: result.data.hasStore, status: result.data.status })
@ -44,7 +44,7 @@ Page({
this.showDialog()
}
if(this.data.form.storeId){
request.get('/recycle-service/get/store-information/' + this.data.form.storeId).then(res => {
getStoreInfo(this.data.form.storeId).then(res => {
this.setData({ detail: res.data, imgList: res.data.coverImgUrlList, imageHeight: math.divide(math.times(750, 9), 16)})
wx.hideLoading()
}).catch(err => {
@ -112,7 +112,7 @@ Page({
wx.navigateTo({ url: '/pages/shop/create/index' })
} else {
wx.showLoading({ title: '加载中', mask: true })
request.post('/recycle-service/create/store-deposit-order').then(result => {
depositStore().then(result => {
//成功回调
app.globalData.userInfo.hasStore = 1
this.data.form.status == 1

Loading…
Cancel
Save