From b39c5a8010dae46662f251082a008c4fb398288d Mon Sep 17 00:00:00 2001 From: xpz2018 <107107461@qq.com> Date: Mon, 11 Oct 2021 20:11:19 +0800 Subject: [PATCH] no message --- app.json | 6 +- pages/purchase/fragment/index.js | 2 +- pages/purchase/purchase-item/index.js | 2 +- pages/shop/detail/index.js | 2 +- pages/shop/index/index.js | 4 +- .../pages}/purchase/create/index.js | 10 +- .../pages}/purchase/create/index.json | 0 .../pages}/purchase/create/index.wxml | 1 - .../pages}/purchase/create/index.wxss | 1 - .../pages}/purchase/detail/index.js | 11 +- .../pages}/purchase/detail/index.json | 0 .../pages}/purchase/detail/index.wxml | 3 +- .../pages}/purchase/detail/index.wxss | 1 - submodel/pages/purchase/fragment/index.js | 131 ++++++++++++++++++ submodel/pages/purchase/fragment/index.json | 12 ++ submodel/pages/purchase/fragment/index.wxml | 32 +++++ submodel/pages/purchase/fragment/index.wxss | 0 .../pages}/purchase/index/index.js | 8 +- .../pages}/purchase/index/index.json | 0 .../pages}/purchase/index/index.wxml | 2 +- .../pages}/purchase/index/index.wxss | 2 - .../pages/purchase/purchase-item/index.js | 31 +++++ .../pages/purchase/purchase-item/index.json | 6 + .../pages/purchase/purchase-item/index.wxml | 28 ++++ .../pages/purchase/purchase-item/index.wxss | 58 ++++++++ 25 files changed, 322 insertions(+), 31 deletions(-) rename {pages => submodel/pages}/purchase/create/index.js (96%) rename {pages => submodel/pages}/purchase/create/index.json (100%) rename {pages => submodel/pages}/purchase/create/index.wxml (98%) rename {pages => submodel/pages}/purchase/create/index.wxss (75%) rename {pages => submodel/pages}/purchase/detail/index.js (90%) rename {pages => submodel/pages}/purchase/detail/index.json (100%) rename {pages => submodel/pages}/purchase/detail/index.wxml (96%) rename {pages => submodel/pages}/purchase/detail/index.wxss (95%) create mode 100644 submodel/pages/purchase/fragment/index.js create mode 100644 submodel/pages/purchase/fragment/index.json create mode 100644 submodel/pages/purchase/fragment/index.wxml create mode 100644 submodel/pages/purchase/fragment/index.wxss rename {pages => submodel/pages}/purchase/index/index.js (96%) rename {pages => submodel/pages}/purchase/index/index.json (100%) rename {pages => submodel/pages}/purchase/index/index.wxml (97%) rename {pages => submodel/pages}/purchase/index/index.wxss (96%) create mode 100644 submodel/pages/purchase/purchase-item/index.js create mode 100644 submodel/pages/purchase/purchase-item/index.json create mode 100644 submodel/pages/purchase/purchase-item/index.wxml create mode 100644 submodel/pages/purchase/purchase-item/index.wxss diff --git a/app.json b/app.json index fa62ffa..04695cc 100644 --- a/app.json +++ b/app.json @@ -50,9 +50,6 @@ "pages/withdrawal/balance/index", "pages/withdrawal/vcheckout/index", "pages/withdrawal/payment/index", - "pages/purchase/index/index", - "pages/purchase/create/index", - "pages/purchase/detail/index", "pages/html/message/index", "pages/html/banner/index", "pages/html/html/index", @@ -80,6 +77,9 @@ "pages/morder/index/index", "pages/morder/create/index", "pages/morder/detail/index", + "pages/purchase/index/index", + "pages/purchase/create/index", + "pages/purchase/detail/index", "pages/bidding/index/index", "pages/bidding/detail/index" ] diff --git a/pages/purchase/fragment/index.js b/pages/purchase/fragment/index.js index 5dd228d..a317938 100644 --- a/pages/purchase/fragment/index.js +++ b/pages/purchase/fragment/index.js @@ -125,7 +125,7 @@ Component({ }, lookItem: function (e) { var item = this.data.orderList[e.currentTarget.dataset.page][e.currentTarget.dataset.index] - wx.navigateTo({ url: '/pages/purchase/detail/index?id=' + item.id }) + wx.navigateTo({ url: '/submodel/pages/purchase/detail/index?id=' + item.id }) } } }) \ No newline at end of file diff --git a/pages/purchase/purchase-item/index.js b/pages/purchase/purchase-item/index.js index 73d9e42..83b5daf 100644 --- a/pages/purchase/purchase-item/index.js +++ b/pages/purchase/purchase-item/index.js @@ -30,7 +30,7 @@ Component({ } }, lookItem: function (e) { - wx.navigateTo({ url: '/pages/purchase/detail/index?id=' + this.data.item.id }) + wx.navigateTo({ url: '/submodel/pages/purchase/detail/index?id=' + this.data.item.id }) } } diff --git a/pages/shop/detail/index.js b/pages/shop/detail/index.js index 4591f9a..bcd7541 100644 --- a/pages/shop/detail/index.js +++ b/pages/shop/detail/index.js @@ -141,7 +141,7 @@ Page({ lookItem: function(event){ var item = this.data.orderList[event.currentTarget.dataset.page][event.currentTarget.dataset.index] if(item.bidType == 3){ - wx.navigateTo({ url: '/pages/purchase/detail/index?id=' + item.id }) + wx.navigateTo({ url: '/submodel/pages/purchase/detail/index?id=' + item.id }) } else { wx.navigateTo({ url: '/pages/mall/detail/index?id=' + item.id }) } diff --git a/pages/shop/index/index.js b/pages/shop/index/index.js index 9336c96..891d22e 100644 --- a/pages/shop/index/index.js +++ b/pages/shop/index/index.js @@ -159,9 +159,9 @@ Page({ } else if (index === 6) { wx.navigateTo({ url: '/pages/shop/bill/index' }) } else if (index === 7) { - wx.navigateTo({ url: '/pages/purchase/create/index' }) + wx.navigateTo({ url: '/submodel/pages/purchase/create/index' }) } else if (index === 8) { - wx.navigateTo({ url: '/pages/purchase/index/index?storeId=' + this.data.form.storeId }) + wx.navigateTo({ url: '/submodel/pages/purchase/index/index?storeId=' + this.data.form.storeId }) } }, viewImage: function(e){ diff --git a/pages/purchase/create/index.js b/submodel/pages/purchase/create/index.js similarity index 96% rename from pages/purchase/create/index.js rename to submodel/pages/purchase/create/index.js index 71db5a0..a0a8f5c 100644 --- a/pages/purchase/create/index.js +++ b/submodel/pages/purchase/create/index.js @@ -1,9 +1,9 @@ // pages/goods/create/index.js -import { updatePurchase, createPurchase, paperCategoryList, getPurchaseInfo } from "../../../api/ztb" -import regions from '../../../const/region' -const math = require('../../../utils/math') -const util = require('../../../utils/util') -const event = require('../../../utils/event.js') +import { updatePurchase, createPurchase, paperCategoryList, getPurchaseInfo } from "../../../../api/ztb" +import regions from '../../../../const/region' +const math = require('../../../../utils/math') +const util = require('../../../../utils/util') +const event = require('../../../../utils/event.js') const app = getApp() Page({ diff --git a/pages/purchase/create/index.json b/submodel/pages/purchase/create/index.json similarity index 100% rename from pages/purchase/create/index.json rename to submodel/pages/purchase/create/index.json diff --git a/pages/purchase/create/index.wxml b/submodel/pages/purchase/create/index.wxml similarity index 98% rename from pages/purchase/create/index.wxml rename to submodel/pages/purchase/create/index.wxml index 6988bf6..083db96 100644 --- a/pages/purchase/create/index.wxml +++ b/submodel/pages/purchase/create/index.wxml @@ -1,4 +1,3 @@ - 发布采购 diff --git a/pages/purchase/create/index.wxss b/submodel/pages/purchase/create/index.wxss similarity index 75% rename from pages/purchase/create/index.wxss rename to submodel/pages/purchase/create/index.wxss index 5f1007c..35d0cd0 100644 --- a/pages/purchase/create/index.wxss +++ b/submodel/pages/purchase/create/index.wxss @@ -1,4 +1,3 @@ -/* pages/purchase/create/index.wxss */ .margin-top{ margin-top: 18rpx; } diff --git a/pages/purchase/detail/index.js b/submodel/pages/purchase/detail/index.js similarity index 90% rename from pages/purchase/detail/index.js rename to submodel/pages/purchase/detail/index.js index a9b9b2d..795eddb 100644 --- a/pages/purchase/detail/index.js +++ b/submodel/pages/purchase/detail/index.js @@ -1,7 +1,6 @@ -// pages/order/order-info/index.js -import { getPurchaseInfo } from "../../../api/ztb" -const util = require('../../../utils/util') -const tdsdk = require('../../../libs/tdweapp') +import { getPurchaseInfo } from "../../../../api/ztb" +const util = require('../../../../utils/util') +const tdsdk = require('../../../../libs/tdweapp') const app = getApp() Page({ @@ -122,7 +121,7 @@ Page({ } return { title: title, - path: 'pages/index/index?url=/pages/purchase/detail/index&key=id&value=' + this.data.orderInfo.productId, + path: 'pages/index/index?url=/submodel/pages/purchase/detail/index&key=id&value=' + this.data.orderInfo.productId, imageUrl: imageUrl, success: function (res) {} } @@ -140,7 +139,7 @@ Page({ } return { title: title, - path: 'pages/index/index?url=/pages/purchase/detail/index&key=id&value=' + this.data.orderInfo.productId, + path: 'pages/index/index?url=/submodel/pages/purchase/detail/index&key=id&value=' + this.data.orderInfo.productId, imageUrl: imageUrl, success: function (res) {} } diff --git a/pages/purchase/detail/index.json b/submodel/pages/purchase/detail/index.json similarity index 100% rename from pages/purchase/detail/index.json rename to submodel/pages/purchase/detail/index.json diff --git a/pages/purchase/detail/index.wxml b/submodel/pages/purchase/detail/index.wxml similarity index 96% rename from pages/purchase/detail/index.wxml rename to submodel/pages/purchase/detail/index.wxml index 491dc0d..b26dc3f 100644 --- a/pages/purchase/detail/index.wxml +++ b/submodel/pages/purchase/detail/index.wxml @@ -1,5 +1,4 @@ - - + 采购详情 diff --git a/pages/purchase/detail/index.wxss b/submodel/pages/purchase/detail/index.wxss similarity index 95% rename from pages/purchase/detail/index.wxss rename to submodel/pages/purchase/detail/index.wxss index 7db5b0e..133cb96 100644 --- a/pages/purchase/detail/index.wxss +++ b/submodel/pages/purchase/detail/index.wxss @@ -1,4 +1,3 @@ -/* pages/order/order-info/index.wxss */ .margin-top { margin-top: 18rpx; } diff --git a/submodel/pages/purchase/fragment/index.js b/submodel/pages/purchase/fragment/index.js new file mode 100644 index 0000000..7248102 --- /dev/null +++ b/submodel/pages/purchase/fragment/index.js @@ -0,0 +1,131 @@ +// pages/goods/index/index.js +import { paperCategoryList, getProductList } from "../../../../api/ztb" +const event = require('../../../../utils/event') +const app = getApp() + +Component({ + options: { + addGlobalClass: true, + multipleSlots: true + }, + /** + * 页面的初始数据 + */ + data: { + height: app.globalData.fragmentHeight - 90, + kg: app.globalData.kg, + loading: true, + requesting: false, + finished: false, + cateList: [], + tabList: [], + tabIndex: 0, + cateScroll: false, + top: 0, + orderList: [], + form: { + firstCategoryId: '', + pageNum: 1, + pageSize:15 + } + }, + lifetimes: { + // 生命周期函数,可以为函数,或一个在methods段中定义的方法名 + attached: function () { + event.on('EventMessage', this, this.onEvent) + }, + detached: function () { + event.remove('EventMessage', this) + } + }, + methods: { + onRestart: function(){ + if (!this.data.firstShow) { + this.setData({ height: app.globalData.fragmentHeight - 90, kg: app.globalData.kg }) + this.fetchCateList() + this.fetchGoodsList() + } + this.data.firstShow = true + }, + fetchCateList: function(){ + paperCategoryList({ type: 1 }).then(result => { + var tabList = ['全部'] + var size = 0 + for (let index = 0; index < result.data.length; index++) { + tabList.push(result.data[index].name) + size += result.data[index].name.length + } + this.data.cateList = result.data + this.setData({ tabList: tabList, cateScroll: size > 14 }) + }) + }, + onCategoryChange: function ({detail}) { + if(this.data.tabIndex == Number(detail.index)){ + return + } + this.data.tabIndex = Number(detail.index) + if(this.data.tabIndex == 0){ + this.data.form.firstCategoryId = '' + } else { + this.data.form.firstCategoryId = this.data.cateList[this.data.tabIndex - 1].id + } + this.onRefreshList() + }, + // 下拉刷新... + onRefreshList: function () { + if (this.data.requesting) { + return + } + this.setData({ orderList: [], ['form.pageNum']: 1, loading: true, finished: false }) + this.fetchGoodsList() + }, + // 获取特价列表 + fetchGoodsList: function () { + if (this.data.requesting || this.data.finished) { + return + } + if (this.data.loading) { + this.data.requesting = true + } else { + this.setData({ requesting: true }) + } + getProductList(this.data.form).then(result => { + //成功回调 + if (result.data.records.length) { + var respList = result.data.records + let nowList = `orderList[${this.data.orderList.length}]` + var num = result.data.current + var finished = result.data.current >= 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 + }) + } + } else { + this.setData({ finished: true, requesting: false, loading: false }) + } + }).catch(err => { + this.setData({ requesting: false, loading: false }) + }) + }, + lookItem: function (e) { + var item = this.data.orderList[e.currentTarget.dataset.page][e.currentTarget.dataset.index] + wx.navigateTo({ url: '/submodel/pages/purchase/detail/index?id=' + item.id }) + } + } +}) \ No newline at end of file diff --git a/submodel/pages/purchase/fragment/index.json b/submodel/pages/purchase/fragment/index.json new file mode 100644 index 0000000..3d1cd13 --- /dev/null +++ b/submodel/pages/purchase/fragment/index.json @@ -0,0 +1,12 @@ +{ + "usingComponents": { + "wux-skeleton": "/components/skeleton/index", + "wux-skeleton-avatar": "/components/skeleton-avatar/index", + "wux-skeleton-paragraph": "/components/skeleton-paragraph/index", + "wux-tabi": "/components/tabi/index", + "refresh-view": "/components/refresher/index", + "wux-image": "/components/image/index", + "wux-divider": "/components/divider/index", + "purchase-item": "/submodel/pages/purchase/purchase-item/index" + } +} \ No newline at end of file diff --git a/submodel/pages/purchase/fragment/index.wxml b/submodel/pages/purchase/fragment/index.wxml new file mode 100644 index 0000000..4d3e36d --- /dev/null +++ b/submodel/pages/purchase/fragment/index.wxml @@ -0,0 +1,32 @@ + + + + + + + + + + {{loading? '正在加载' : '暂无数据'}} + + + + + + + + + + + + + + + + + {{finished?'到底啦~':'加载中...'}} + + + + + \ No newline at end of file diff --git a/submodel/pages/purchase/fragment/index.wxss b/submodel/pages/purchase/fragment/index.wxss new file mode 100644 index 0000000..e69de29 diff --git a/pages/purchase/index/index.js b/submodel/pages/purchase/index/index.js similarity index 96% rename from pages/purchase/index/index.js rename to submodel/pages/purchase/index/index.js index 0bf2079..9eb9bde 100644 --- a/pages/purchase/index/index.js +++ b/submodel/pages/purchase/index/index.js @@ -1,7 +1,7 @@ // pages/goods/index/index.js -import { paperCategoryList, getStorePurchaseList, deletePurchase, updatePurchaseStatus } from "../../../api/ztb" -const util = require('../../../utils/util') -const event = require('../../../utils/event') +import { paperCategoryList, getStorePurchaseList, deletePurchase, updatePurchaseStatus } from "../../../../api/ztb" +const util = require('../../../../utils/util') +const event = require('../../../../utils/event') const app = getApp() Page({ @@ -129,7 +129,7 @@ Page({ }, editItem: function (e) { var item = this.data.orderList[e.currentTarget.dataset.page][e.currentTarget.dataset.index] - wx.navigateTo({ url: '/pages/purchase/create/index?id=' + item.id }) + wx.navigateTo({ url: '/submodel/pages/purchase/create/index?id=' + item.id }) }, shelvesItem: function (e) { var page = e.currentTarget.dataset.page diff --git a/pages/purchase/index/index.json b/submodel/pages/purchase/index/index.json similarity index 100% rename from pages/purchase/index/index.json rename to submodel/pages/purchase/index/index.json diff --git a/pages/purchase/index/index.wxml b/submodel/pages/purchase/index/index.wxml similarity index 97% rename from pages/purchase/index/index.wxml rename to submodel/pages/purchase/index/index.wxml index 593f7e1..8f196cd 100644 --- a/pages/purchase/index/index.wxml +++ b/submodel/pages/purchase/index/index.wxml @@ -1,5 +1,5 @@ - + 采购管理 diff --git a/pages/purchase/index/index.wxss b/submodel/pages/purchase/index/index.wxss similarity index 96% rename from pages/purchase/index/index.wxss rename to submodel/pages/purchase/index/index.wxss index 5280fcb..92c4183 100644 --- a/pages/purchase/index/index.wxss +++ b/submodel/pages/purchase/index/index.wxss @@ -1,5 +1,3 @@ -/* pages/goods/index/index.wxss */ - .item-content { height: 120px; background: rgba(255, 255, 255, 1); diff --git a/submodel/pages/purchase/purchase-item/index.js b/submodel/pages/purchase/purchase-item/index.js new file mode 100644 index 0000000..c507a55 --- /dev/null +++ b/submodel/pages/purchase/purchase-item/index.js @@ -0,0 +1,31 @@ +const app = getApp() + +Component({ + options: { + addGlobalClass: true, + multipleSlots: true + }, + properties: { + item: { type: Object, value: null } + }, + data: { + kg: app.globalData.kg + }, + lifetimes: { + // 生命周期函数,可以为函数,或一个在methods段中定义的方法名 + attached: function () { + this.setData({ kg: app.globalData.kg }) + } + }, + methods: { + onEvent: function (message) { + if(message.what == 1001){ + this.setData({ kg: app.globalData.kg }) + } + }, + lookItem: function (e) { + wx.navigateTo({ url: '/submodel/pages/purchase/detail/index?id=' + this.data.item.id }) + } + } + +}) \ No newline at end of file diff --git a/submodel/pages/purchase/purchase-item/index.json b/submodel/pages/purchase/purchase-item/index.json new file mode 100644 index 0000000..8dee24a --- /dev/null +++ b/submodel/pages/purchase/purchase-item/index.json @@ -0,0 +1,6 @@ +{ + "component": true, + "usingComponents": { + "wux-image": "/components/image/index" + } +} \ No newline at end of file diff --git a/submodel/pages/purchase/purchase-item/index.wxml b/submodel/pages/purchase/purchase-item/index.wxml new file mode 100644 index 0000000..e8335e0 --- /dev/null +++ b/submodel/pages/purchase/purchase-item/index.wxml @@ -0,0 +1,28 @@ + + + + + + + + + + + + {{item.secondCategoryName || item.firstCategoryName}} + + + + {{item.locProvinceName + item.locCityName}} + + + + ¥{{formate.formatePrice2(item.unitPrice, kg)}} + + 价格面议 + + + {{item.description || ''}} + + + \ No newline at end of file diff --git a/submodel/pages/purchase/purchase-item/index.wxss b/submodel/pages/purchase/purchase-item/index.wxss new file mode 100644 index 0000000..518d701 --- /dev/null +++ b/submodel/pages/purchase/purchase-item/index.wxss @@ -0,0 +1,58 @@ +/* pages/mall/shops/index.wxss */ +.item-content { + background: rgba(255, 255, 255, 1); + padding:32rpx +} + +.page-name { + font-size: 36rpx; + font-weight: bold; + color: rgba(51, 51, 51, 1); + line-height: 20px; +} + +.page-num { + font-size: 24rpx; + font-family: PingFang-SC-Regular, PingFang-SC; + font-weight: 400; + color: #040404; +} + +.page-outline { + margin-top: 8rpx; + font-size: 24rpx; + font-family: PingFang-SC-Regular, PingFang-SC; + font-weight: 400; + color: #999999; + display: -webkit-box; + overflow: hidden; + text-overflow: ellipsis; + word-wrap: break-word; + white-space: normal !important; + -webkit-line-clamp: 2; + -webkit-box-orient: vertical; +} + +.page-price { + line-height: 30rpx; + font-size: 34rpx; + font-family: DINAlternate-Bold, DINAlternate; + font-weight: bold; + color: rgba(255, 66, 43, 1); +} + +.page-stock { + font-size: 20rpx; + line-height: 20rpx; + font-family: PingFang-SC-Regular, PingFang-SC; + font-weight: 400; + color: rgba(153, 153, 153, 1); +} + +.image-load { + width: 100px; + height: 100px; + display: flex; + align-items: center; + justify-content: center; +}