Browse Source

no message

featrue/v4.5
xpz2018 4 years ago
parent
commit
b39c5a8010
25 changed files with 322 additions and 31 deletions
  1. 6
      app.json
  2. 2
      pages/purchase/fragment/index.js
  3. 2
      pages/purchase/purchase-item/index.js
  4. 2
      pages/shop/detail/index.js
  5. 4
      pages/shop/index/index.js
  6. 10
      submodel/pages/purchase/create/index.js
  7. 0
      submodel/pages/purchase/create/index.json
  8. 1
      submodel/pages/purchase/create/index.wxml
  9. 1
      submodel/pages/purchase/create/index.wxss
  10. 11
      submodel/pages/purchase/detail/index.js
  11. 0
      submodel/pages/purchase/detail/index.json
  12. 3
      submodel/pages/purchase/detail/index.wxml
  13. 1
      submodel/pages/purchase/detail/index.wxss
  14. 131
      submodel/pages/purchase/fragment/index.js
  15. 12
      submodel/pages/purchase/fragment/index.json
  16. 32
      submodel/pages/purchase/fragment/index.wxml
  17. 0
      submodel/pages/purchase/fragment/index.wxss
  18. 8
      submodel/pages/purchase/index/index.js
  19. 0
      submodel/pages/purchase/index/index.json
  20. 2
      submodel/pages/purchase/index/index.wxml
  21. 2
      submodel/pages/purchase/index/index.wxss
  22. 31
      submodel/pages/purchase/purchase-item/index.js
  23. 6
      submodel/pages/purchase/purchase-item/index.json
  24. 28
      submodel/pages/purchase/purchase-item/index.wxml
  25. 58
      submodel/pages/purchase/purchase-item/index.wxss

6
app.json

@ -50,9 +50,6 @@
"pages/withdrawal/balance/index", "pages/withdrawal/balance/index",
"pages/withdrawal/vcheckout/index", "pages/withdrawal/vcheckout/index",
"pages/withdrawal/payment/index", "pages/withdrawal/payment/index",
"pages/purchase/index/index",
"pages/purchase/create/index",
"pages/purchase/detail/index",
"pages/html/message/index", "pages/html/message/index",
"pages/html/banner/index", "pages/html/banner/index",
"pages/html/html/index", "pages/html/html/index",
@ -80,6 +77,9 @@
"pages/morder/index/index", "pages/morder/index/index",
"pages/morder/create/index", "pages/morder/create/index",
"pages/morder/detail/index", "pages/morder/detail/index",
"pages/purchase/index/index",
"pages/purchase/create/index",
"pages/purchase/detail/index",
"pages/bidding/index/index", "pages/bidding/index/index",
"pages/bidding/detail/index" "pages/bidding/detail/index"
] ]

2
pages/purchase/fragment/index.js

@ -125,7 +125,7 @@ Component({
}, },
lookItem: function (e) { lookItem: function (e) {
var item = this.data.orderList[e.currentTarget.dataset.page][e.currentTarget.dataset.index] 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 })
} }
} }
}) })

2
pages/purchase/purchase-item/index.js

@ -30,7 +30,7 @@ Component({
} }
}, },
lookItem: function (e) { 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 })
} }
} }

2
pages/shop/detail/index.js

@ -141,7 +141,7 @@ Page({
lookItem: function(event){ lookItem: function(event){
var item = this.data.orderList[event.currentTarget.dataset.page][event.currentTarget.dataset.index] var item = this.data.orderList[event.currentTarget.dataset.page][event.currentTarget.dataset.index]
if(item.bidType == 3){ 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 { } else {
wx.navigateTo({ url: '/pages/mall/detail/index?id=' + item.id }) wx.navigateTo({ url: '/pages/mall/detail/index?id=' + item.id })
} }

4
pages/shop/index/index.js

@ -159,9 +159,9 @@ Page({
} else if (index === 6) { } else if (index === 6) {
wx.navigateTo({ url: '/pages/shop/bill/index' }) wx.navigateTo({ url: '/pages/shop/bill/index' })
} else if (index === 7) { } else if (index === 7) {
wx.navigateTo({ url: '/pages/purchase/create/index' })
wx.navigateTo({ url: '/submodel/pages/purchase/create/index' })
} else if (index === 8) { } 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){ viewImage: function(e){

pages/purchase/create/index.js → submodel/pages/purchase/create/index.js

@ -1,9 +1,9 @@
// pages/goods/create/index.js // 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() const app = getApp()
Page({ Page({

pages/purchase/create/index.json → submodel/pages/purchase/create/index.json

pages/purchase/create/index.wxml → submodel/pages/purchase/create/index.wxml

@ -1,4 +1,3 @@
<!--pages/purchase/create/index.wxml-->
<cu-custom bgColor="bg-white" isBack="{{true}}"> <cu-custom bgColor="bg-white" isBack="{{true}}">
<view slot="content">发布采购</view> <view slot="content">发布采购</view>
</cu-custom> </cu-custom>

pages/purchase/create/index.wxss → submodel/pages/purchase/create/index.wxss

@ -1,4 +1,3 @@
/* pages/purchase/create/index.wxss */
.margin-top{ .margin-top{
margin-top: 18rpx; margin-top: 18rpx;
} }

pages/purchase/detail/index.js → 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() const app = getApp()
Page({ Page({
@ -122,7 +121,7 @@ Page({
} }
return { return {
title: title, 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, imageUrl: imageUrl,
success: function (res) {} success: function (res) {}
} }
@ -140,7 +139,7 @@ Page({
} }
return { return {
title: title, 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, imageUrl: imageUrl,
success: function (res) {} success: function (res) {}
} }

pages/purchase/detail/index.json → submodel/pages/purchase/detail/index.json

pages/purchase/detail/index.wxml → submodel/pages/purchase/detail/index.wxml

@ -1,5 +1,4 @@
<!--pages/order/order-info/index.wxml-->
<wxs module="formate" src="../../../pages/formate.wxs"></wxs>
<wxs module="formate" src="../../../../pages/formate.wxs"></wxs>
<cu-custom bgColor="bg-white" isBack="{{true}}"> <cu-custom bgColor="bg-white" isBack="{{true}}">
<view slot="content" style="color:black;font-size:36rpx">采购详情</view> <view slot="content" style="color:black;font-size:36rpx">采购详情</view>
</cu-custom> </cu-custom>

pages/purchase/detail/index.wxss → submodel/pages/purchase/detail/index.wxss

@ -1,4 +1,3 @@
/* pages/order/order-info/index.wxss */
.margin-top { .margin-top {
margin-top: 18rpx; margin-top: 18rpx;
} }

131
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 })
}
}
})

12
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"
}
}

32
submodel/pages/purchase/fragment/index.wxml

@ -0,0 +1,32 @@
<wxs module="formate" src="../../../pages/formate.wxs"></wxs>
<view class="bg-white" style="height:90rpx;border-bottom: 2rpx solid #eee">
<wux-tabi scroll="{{cateScroll}}" tab-data="{{tabList}}" tab-index="{{tabIndex}}" bind:change="onCategoryChange"></wux-tabi>
</view>
<refresh-view bind:refresh="onRefreshList" height="{{height}}" triggered="{{requesting}}" scrollTop="{{top}}" bind:scrolltolower="fetchGoodsList">
<view class="bg-white list-empty" style="height:{{height}}rpx" wx:if="{{!orderList.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>
<view wx:else>
<view wx:for-item="pageItem" wx:for-index="pageIndex" wx:for="{{orderList}}" wx:key="pageIndex">
<view wx:for="{{pageItem}}" wx:key="index">
<view class="bg-white" style="padding: 0rpx 32rpx" wx:if="{{pageIndex != 0 || index != 0 }}">
<wux-divider show-text="{{ false }}"></wux-divider>
</view>
<!-- <wux-divider show-text="{{ false }}" wx:if="{{pageIndex != 0 || index != 0 }}"></wux-divider> -->
<purchase-item item="{{item}}"></purchase-item>
</view>
</view>
<!--加载更多的UI-->
<view wx:if="{{form.pageNum>1}}" style="padding:20rpx">
<wux-divider>
<view class="loadmore">
<text class="icon--refresher" wx:if="{{!finished}}"></text>
<text class="text-sm" style="margin-left:8rpx">{{finished?'到底啦~':'加载中...'}}</text>
</view>
</wux-divider>
</view>
</view>
</refresh-view>

0
submodel/pages/purchase/fragment/index.wxss

pages/purchase/index/index.js → submodel/pages/purchase/index/index.js

@ -1,7 +1,7 @@
// pages/goods/index/index.js // 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() const app = getApp()
Page({ Page({
@ -129,7 +129,7 @@ Page({
}, },
editItem: function (e) { editItem: function (e) {
var item = this.data.orderList[e.currentTarget.dataset.page][e.currentTarget.dataset.index] 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) { shelvesItem: function (e) {
var page = e.currentTarget.dataset.page var page = e.currentTarget.dataset.page

pages/purchase/index/index.json → submodel/pages/purchase/index/index.json

pages/purchase/index/index.wxml → submodel/pages/purchase/index/index.wxml

@ -1,5 +1,5 @@
<!--pages/goods/index/index.wxml--> <!--pages/goods/index/index.wxml-->
<wxs module="formate" src="../../../pages/formate.wxs"></wxs>
<wxs module="formate" src="../../../../pages/formate.wxs"></wxs>
<cu-custom bgColor="bg-white" isBack="{{true}}"> <cu-custom bgColor="bg-white" isBack="{{true}}">
<view slot="content">采购管理</view> <view slot="content">采购管理</view>
</cu-custom> </cu-custom>

pages/purchase/index/index.wxss → submodel/pages/purchase/index/index.wxss

@ -1,5 +1,3 @@
/* pages/goods/index/index.wxss */
.item-content { .item-content {
height: 120px; height: 120px;
background: rgba(255, 255, 255, 1); background: rgba(255, 255, 255, 1);

31
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 })
}
}
})

6
submodel/pages/purchase/purchase-item/index.json

@ -0,0 +1,6 @@
{
"component": true,
"usingComponents": {
"wux-image": "/components/image/index"
}
}

28
submodel/pages/purchase/purchase-item/index.wxml

@ -0,0 +1,28 @@
<!--pages/message/index.wxml-->
<wxs module="formate" src="../../../../pages/formate.wxs"></wxs>
<view class="flex item-content" bindtap="lookItem">
<wux-image width="{{100}}" height="{{100}}" lazyLoad="true" src="{{item.coverImgUrl}}" mode="aspectFill">
<image class="image-load" slot="loading" src="/assets/image/def_image.png"></image>
<image class="image-load" slot="error" src="/assets/image/def_image.png"></image>
<image class="image-load" slot="empty" src="/assets/image/def_image.png"></image>
</wux-image>
<view style="flex:1;padding-left:24rpx;height:100px">
<view class="flex" style="height:20px;align-items: center">
<image style="width:40px;height:20px;margin-right:12rpx" src="/assets/image/ico_tag3.png"></image>
<view class="page-name">{{item.secondCategoryName || item.firstCategoryName}}</view>
</view>
<view class="flex page-num" style="margin-top:8rpx">
<view class="text-cut" style="font-size:24rpx;max-width: 240rpx">
{{item.locProvinceName + item.locCityName}}</view>
</view>
<view class="flex" style="margin-top:16rpx;align-items: center">
<text wx:if="{{item.unitPrice}}">
<text class="page-price">¥{{formate.formatePrice2(item.unitPrice, kg)}}</text>
</text>
<text class="page-price" wx:else>价格面议</text>
</view>
<view style="height:32px">
<view class="page-outline">{{item.description || ''}}</view>
</view>
</view>
</view>

58
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;
}
Loading…
Cancel
Save