Browse Source

bug修改

master
xpz2018 6 years ago
parent
commit
719b742d5b
23 changed files with 374 additions and 156 deletions
  1. 2
      app.js
  2. 38
      components/button/index.wxss
  3. 2
      components/image/index.wxss
  4. 4
      components/refresher/index.js
  5. 2
      components/refresher/index.wxml
  6. 6
      components/skeleton-avatar/index.wxss
  7. 22
      components/tab/index.js
  8. 1
      components/tab/index.wxss
  9. 85
      pages/mall/order-info/index.js
  10. 2
      pages/mall/order-info/index.json
  11. 9
      pages/mall/order-info/index.wxml
  12. 8
      pages/mall/order-list/index.wxml
  13. 12
      pages/mall/order-offer/index.js
  14. 24
      pages/mall/order-offer/index.wxml
  15. 15
      pages/mall/order-offer/index.wxss
  16. 2
      pages/mall/search-list/index.js
  17. 10
      pages/mall/search-list/index.wxml
  18. 15
      pages/mall/search-list/index.wxss
  19. 63
      pages/mall/shops/index.js
  20. 186
      pages/mall/shops/index.wxml
  21. 17
      pages/mall/shops/index.wxss
  22. 1
      pages/refresh/refresh.js
  23. 4
      pages/refresh/refresh.wxml

2
app.js

@ -21,7 +21,7 @@ App({
if (this.release) {
this.httpUrl = 'https://api.qniao.cn'
} else {
this.httpUrl = 'https://api-test.qniao.cn'
this.httpUrl = 'http://192.168.0.24:9000'
}
wx.getSystemInfo({
success: e => {

38
components/button/index.wxss

@ -55,6 +55,13 @@
.wux-button--disabled {
opacity: .4!important
}
.wux-button--tag {
padding: 4rpx 24rpx 2rpx 24rpx;
min-width: 50rpx;
min-height: 40rpx!important;
font-size: 24rpx;
line-height: 40rpx
}
.wux-button--small {
padding: 4rpx 8rpx 2rpx;
min-width: 56rpx;
@ -354,4 +361,35 @@
.wux-button--stable.wux-button--hover {
background-color: #dfdfdf!important;
color: #fff!important
}
.wux-button--tag,
.wux-button--tag--disabled {
border-color: transparent!important;
background-color: #999999!important;
color: #fff!important;
}
.wux-button--tag.wux-button--outline {
border-color: #999999!important;
background-color: transparent!important;
color: #999999!important;
}
.wux-button--tag.wux-button--outline.wux-button--disabled {
border-color: #999999!important;
background-color: transparent!important;
color: #999999!important;
text-decoration:line-through;
}
.wux-button--tag.wux-button--clear,
.wux-button--tag.wux-button--clear.wux-button--disabled {
background-color: transparent!important;
color: #999999!important
}
.wux-button--tag.wux-button--clear.wux-button--hover {
background-color: rgba(0,0,0,0)!important;
color: #999999!important
}
.wux-button--tag.wux-button--hover {
background-color: #999999!important;
color: #fff!important
}

2
components/image/index.wxss

@ -49,7 +49,7 @@
.wux-image--widthFix .wux-image__inner {
position: relative
}
.wux-image image,
.wux-image,
.wux-image__thumb {
display: inline-block;
overflow: hidden;

4
components/refresher/index.js

@ -15,6 +15,10 @@ let options = janComponent({
},
properties: {
height: {
type: Number,
value: 500
},
refresherTextStyle: {
type: String,
value: "black"

2
components/refresher/index.wxml

@ -1,4 +1,4 @@
<scroll-view class="jan-refresher {{ customClass }}" scroll-y enable-back-to-top refresher-enabled refresher-threshold="{{ threshold }}" refresher-default-style="{{ !useSlotStyle ? refresherTextStyle : 'null' }}" refresher-background="{{ refresherBackground }}" refresher-triggered="{{ triggered }}" bindscrolltoupper="on2Upper" bindscrolltolower="on2Lower" bindscroll="onScroll" bindrefresherpulling="onPulling" bindrefresherrefresh="onRefreshed" bindrefresherrestore="onRestored" bindrefresherabort="onAbort" scroll-x="{{ scrollX }}" scroll-y="{{ scrollY }}" upper-threshold="{{ upperThreshold }}" lower-threshold="{{ lowerThreshold }}" scroll-top="{{ scrollTop }}" scroll-left="{{ scrollLeft }}" scroll-into-view="{{ scrollIntoView }}" scroll-with-animation="{{ scrollWithAnimation }}" enable-back-to-top="{{ enableBackToTop }}" enable-flex="{{ enableFlex }}" scroll-anchoring="{{ scrollAnchoring }}">
<scroll-view class="jan-refresher {{ customClass }}" style="height:{{height}}rpx" scroll-y enable-back-to-top refresher-enabled refresher-threshold="{{ threshold }}" refresher-default-style="{{ !useSlotStyle ? refresherTextStyle : 'null' }}" refresher-background="{{ refresherBackground }}" refresher-triggered="{{ triggered }}" bindscrolltoupper="on2Upper" bindscrolltolower="on2Lower" bindscroll="onScroll" bindrefresherpulling="onPulling" bindrefresherrefresh="onRefreshed" bindrefresherrestore="onRestored" bindrefresherabort="onAbort" scroll-x="{{ scrollX }}" scroll-y="{{ scrollY }}" upper-threshold="{{ upperThreshold }}" lower-threshold="{{ lowerThreshold }}" scroll-top="{{ scrollTop }}" scroll-left="{{ scrollLeft }}" scroll-into-view="{{ scrollIntoView }}" scroll-with-animation="{{ scrollWithAnimation }}" enable-back-to-top="{{ enableBackToTop }}" enable-flex="{{ enableFlex }}" scroll-anchoring="{{ scrollAnchoring }}">
<view wx:if="{{ useSlotStyle }}" slot="refresher" class="jan-refresh--node">
<view wx:if="{{ _state }}" class="jan-refresher--icon {{ _stateCode === 2 ? 'refreshing' : '' }}" style="font-weight: 600 !important;margin-right: 16rpx;transform: rotate({{ (_process > 1 ? 1 : _process) * 360 }}deg);margin-top:8rpx">
<text class="cuIcon-refresh text-black"></text>

6
components/skeleton-avatar/index.wxss

@ -28,6 +28,12 @@
line-height: 120rpx
}
.wux-skeleton-avatar--tab {
width: 100%;
height: 60rpx;
line-height: 60rpx
}
.wux-skeleton-avatar--full {
width: 100%;
height: 240rpx;

22
components/tab/index.js

@ -17,6 +17,11 @@ Component({
type: Boolean,
value: false
},
// view宽度
padding: {
type: Number,
value: 0,
},
// tab高度
size: {
type: Number,
@ -31,9 +36,7 @@ Component({
},
data: {
/* 未渲染数据 */
windowWidth: 0, // 屏幕宽度
tabItems: [], // 所有 tab 节点信息
/* 渲染数据 */
scrolling: true, // 控制 scroll-view 滚动以在异步加载数据的时候能正确获得 dom 信息
needTransition: false, // 下划线是否需要过渡动画
@ -61,11 +64,13 @@ Component({
itemLeft = item.left || 0;
this.setData({needTransition: needTransition});
if(this.data.padding){
itemLeft -= this.data.padding
}
if (this.data.scroll) { // 超出滚动的情况
// 保持滚动后当前 item '尽可能' 在屏幕中间
let scrollLeft = itemLeft - (this.data.windowWidth - itemWidth) / 2;
console.log('scrollLeft>>>' + scrollLeft)
this.setData({
tabCur: tabCur,
scrollLeft: scrollLeft,
@ -100,17 +105,16 @@ Component({
* 监听 tab 高度变化, 最小值为80rpx
*/
sizeChange(newVal, oldVal) {
if (newVal <= 80) {
this.setData({size: 80});
if (newVal <= 60) {
this.setData({size: 60});
}
},
/**
* 初始化函数
*/
init() {
const {windowWidth} = wx.getSystemInfoSync();
this.setData({windowWidth: windowWidth || 375});
const {windowWidth} = wx.getSystemInfoSync()
this.setData({windowWidth: windowWidth || 375})
this.createSelectorQuery().selectAll(".tabs__item-child").boundingClientRect((res) => {
this.setData({
scrolling: true,

1
components/tab/index.wxss

@ -35,6 +35,7 @@
padding: 0 10rpx;
box-sizing: border-box;
transition: color 0.3s ease-in-out;
font-size: 14px;
}
.tabs__item--cur {
color: #008AFF;

85
pages/mall/order-info/index.js

@ -13,6 +13,7 @@ Page({
token: app.globalData.token,
backStr: '返回',
orderInfo: null,
matchTag: null,
sukList: [],
form: {
productId: null,
@ -20,7 +21,6 @@ Page({
number: 1,
unitPrice: 0
},
skuJson: '',
amount: null
},
/**
@ -78,26 +78,26 @@ Page({
current: e.currentTarget.dataset.url
});
},
// 根据
checkDisableTag: function(sukId, match, element){
match[sukId] = element.id
for (let index = 0; index < this.data.orderInfo.skuList.length; index++) {
const item = this.data.orderInfo.skuList[index];
if(this.checkSkuPrice(match, item)){
delete match[sukId]
return false
}
}
delete match[sukId]
return true
},
// tag 点击事件
tagClick: function (e) {
this.data.matchTag = null
var sukId = e.currentTarget.dataset.suk// 对应的是一级列表的Id
var id = e.currentTarget.dataset.index// 对应的是二级列表的Id,相应是有价格计算的
var attributeList = this.data.orderInfo.attributeList
for (let i = 0; i < attributeList.length; i++) {
if (attributeList[i].id == sukId) {
for (let k = 0; k < attributeList[i].values.length; k++) {
const element = attributeList[i].values[k];
element.select = false
if (element.id == id) {
element.select = true
}
}
}
}
this.setData({
['orderInfo.attributeList']: attributeList,
amount: null
})
// 检查是否需要跟新,或者修改;
//------------------------------sukList-------------------------------------------
// 检查是否需要跟新,或者修改,跟新sukList;
var push_flag = true
for (let index = 0; index < this.data.sukList.length; index++) {
const element = this.data.sukList[index];
@ -113,16 +113,53 @@ Page({
id: id
})
}
//------------------------------attributeList-------------------------------------------
var match = {}
for (let index = 0; index < this.data.sukList.length; index++) {
const element = this.data.sukList[index];
match[element.skuId] = element.id
}
var attributeList = this.data.orderInfo.attributeList
for (let i = 0; i < attributeList.length; i++) {
for (let k = 0; k < attributeList[i].values.length; k++) {
const element = attributeList[i].values[k];
// 点击的列判断 对应的是一级列表,肯定是可以点击的
if (attributeList[i].id == sukId) {
element.select = false
if (element.id == id) {
element.select = true
}
} else {
// 如果其余的规格没有价格的,进行处理;无法点击
element.disabled = this.checkDisableTag(attributeList[i].id, match, element)
}
}
}
this.setData({
['orderInfo.attributeList']: attributeList,
amount: null
})
//------------------------------matchTag-------------------------------------------
if (this.data.sukList.length == this.data.orderInfo.attributeList.length) {
var match = {}
this.data.matchTag = {}
for (let index = 0; index < this.data.sukList.length; index++) {
const element = this.data.sukList[index];
match[element.skuId] = element.id
this.data.matchTag[element.skuId] = element.id
}
this.data.skuJson = JSON.stringify(match)
this.data.skuJson = this.data.skuJson.substring(1, this.data.skuJson.length - 1)
this.onNumChange(null)
}
},
// 根据所有选择的规格校验获取价格
checkSkuPrice: function(tag, element){
if(!tag){
return false
}
for (var key in tag) {
if(element.price <=0 || tag[key] != element[key]){
return false
}
}
return true
},
// 数量变化的函数监听
onNumChange: function (e) {
@ -140,7 +177,7 @@ Page({
// 根据规格,克重,以及其他筛选价格
for (let index = 0; index < this.data.orderInfo.skuList.length; index++) {
const element = this.data.orderInfo.skuList[index];
if(JSON.stringify(element).indexOf(this.data.skuJson) >= 0){
if(this.checkSkuPrice(this.data.matchTag, element)){
this.data.form.unitPrice = Number(element.price)
this.data.form.dividePrice = Number(element.dividePrice)
this.data.form.skuId = element.id
@ -176,6 +213,7 @@ Page({
this.data.form.summary = this.data.orderInfo.summary
this.data.form.sellMode = this.data.orderInfo.sellMode
this.data.form.name = this.data.orderInfo.name
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({
@ -194,7 +232,6 @@ Page({
path: '/pages/mall/order-info/index?id=' + this.data.orderInfo.id,
imageUrl: this.data.orderInfo.litimgUrl,
success: function(res) {
console.log(res)
}
}
},

2
pages/mall/order-info/index.json

@ -1,6 +1,6 @@
{
"usingComponents": {
"wux-tag": "/components/tag/index",
"wux-button": "/components/button/index",
"wux-input-number": "/components/input-number/index"
}
}

9
pages/mall/order-info/index.wxml

@ -24,13 +24,14 @@
</view>
<view class="bg-white text-name" style="padding:0rpx 32rpx">{{orderInfo.name}}</view>
<view class="bg-white text-gray" style="font-size:14px;padding:12rpx 32rpx">{{orderInfo.outline}}</view>
<view class="bg-white" style="padding:0rpx 32rpx 32rpx 32rpx">
<view wx:for-item="sukItem" wx:for="{{orderInfo.attributeList}}" wx:key="sukIndex" style="padding-top:12rpx">
<view class="text-gray" style="font-size:14px">选择{{sukItem.name}}</view>
<view class="flex flex-wrap" style="margin-top:16rpx">
<view wx:for-item="item" wx:for="{{sukItem.values}}" wx:key="index">
<wux-tag wx:if="{{item.select}}" color="#008AFF" data-suk="{{sukItem.id}}" data-index="{{item.id}}" bind:click="tagClick">{{item.val}}</wux-tag>
<wux-tag wx:else data-suk="{{sukItem.id}}" data-index="{{item.id}}" bind:click="tagClick">{{item.val}}</wux-tag>
<view wx:for-item="item" wx:for="{{sukItem.values}}" wx:key="index" style="margin-right:24rpx">
<wux-button size="tag" disabled="{{item.disabled}}" outline="{{!item.select}}" type="tag" data-suk="{{sukItem.id}}" data-index="{{item.id}}" bind:click="tagClick">{{item.val}}</wux-button>
</view>
</view>
</view>
@ -46,7 +47,7 @@
<view class="bg-white" style="padding:32rpx;margin-top:32rpx">
<view class="text-black" style="font-size:16px">商品描述</view>
<view class="text-gray" style="font-size:14px;margin-top:32rpx">{{orderInfo.summary}}</view>
<view class="text-gray" style="font-size:14px;margin-top:32rpx">{{orderInfo.detail}}</view>
</view>
<view class="bg-white">
<view style="height:1px;width:100%;background-color:#F3F3F3;margin-left:32rpx"></view>

8
pages/mall/order-list/index.wxml

@ -5,13 +5,15 @@
</cu-custom>
<view class="nav bg-white fixed" style="top:{{CustomBar}}px;">
<!-- <view class="cu-bar bg-white search">
<view class="cu-bar bg-white search">
<view class="search-form round" bindtap="searchList">
<text class="cuIcon-search"></text>
<input type="text" disabled="true" placeholder="输入搜索的关键词" confirm-type="search"></input>
</view>
</view> -->
<wux-tab scroll tab-data="{{tabs}}" tab-cur="{{index}}" size="{{60}}" bindchange="onTabChange"></wux-tab>
</view>
<view style="height:80rpx;padding: 10rpx 32rpx">
<wux-tab scroll tab-data="{{tabs}}" tab-cur="{{pageIndex}}" size="{{60}}" bindchange="onTabChange"></wux-tab>
</view>
</view>
<view style="padding-top: 80rpx">

12
pages/mall/order-offer/index.js

@ -25,7 +25,8 @@ Page({
var form = JSON.parse(options.json)
form.payType = 1
// form.totalPrice = float.accAdd(float.accMul(form.unitPrice, form.number), form.dividePrice)
form.totalPrice = float.accMul(form.unitPrice, form.number)
form.totalPrice = float.accMul(form.unitPrice, form.number).toFixed(2)
form.preAmount = float.accMul(float.accMul(form.unitPrice, form.number), 0.1).toFixed(2)
this.setData({
form: form
})
@ -49,8 +50,15 @@ Page({
},
checkMode: function (e) {
var preAmount = 0
if(e.currentTarget.dataset.index == 1){
preAmount = float.accMul(float.accMul(this.data.form.unitPrice, this.data.form.number), 0.1).toFixed(2)
} else if(e.currentTarget.dataset.index == 2){
preAmount = float.accMul(this.data.form.unitPrice, this.data.form.number).toFixed(2)
}
this.setData({
['form.payType']: e.currentTarget.dataset.index
['form.payType']: Number(e.currentTarget.dataset.index),
['form.preAmount']: preAmount
})
},

24
pages/mall/order-offer/index.wxml

@ -1,4 +1,3 @@
<!--pages/task/task-detail/index.wxml-->
<!-- <wxs module="mall" src="../index.wxs"></wxs> -->
<cu-custom bgColor="bg-white" isBack="{{true}}">
<view slot="backText">返回</view>
@ -29,12 +28,15 @@
<view class="flex content">
<wux-image shape="offer" width="{{60}}" height="{{60}}" src="{{form.litimgUrl}}">
<view class="image-load" slot="loading">
<text class="icon--refresher"></text>
</view>
<text class="icon--refresher"></text>
</view>
</wux-image>
<view style="flex:1;margin-left:24rpx">
<view class="page-name">{{form.name}}</view>
<view class="page-num" style="height:60rpx">{{form.summary}}</view>
<view style="height:60rpx">
<view class="page-outline">{{form.outline}}</view>
<view class="page-outline" style="margin-top: 8rpx">{{form.summary}}</view>
</view>
</view>
</view>
<view class="flex flex-justify" style="height:60rpx;margin-top:12rpx">
@ -54,8 +56,8 @@
<view class="offer-val">¥{{form.dividePrice}}</view>
</view>
<view class="flex flex-justify" style="height:60rpx">
<view class="offer-label" style="color:#333333;font-size:14px">应付金额</view>
<view class="offer-val" style="color:#008AFF;font-size:14px">¥{{form.totalPrice}}</view>
<view class="offer-label" style="color:#333333;font-size:14px">{{form.payType == 1 ? '预付金额' : '应付金额'}}</view>
<view class="offer-val" style="color:#008AFF;font-size:14px">¥{{form.preAmount}}</view>
</view>
</view>
@ -66,13 +68,13 @@
</view>
<view class="flex flex-justify" style="height:80rpx" data-index="1" bindtap="checkMode">
<view class="flex align-end">
<text>预付定金</text>
<text class="offer-hint" style="margin-left:10rpx">预付款50%,余款货到付款</text>
<text style="font-size:14px">预付定金</text>
<text class="offer-hint" style="margin-left:10rpx">预付款10%,余款货到付款</text>
</view>
<text class="cuIcon-{{form.payType==1?'roundcheckfill':'roundcheck'}} text-{{form.payType==1?'blue':'grey'}}" style="font-size:18px"></text>
</view>
<view class="flex flex-justify" style="height:80rpx" data-index="2" bindtap="checkMode">
<view>货到付款</view>
<view style="font-size:14px">货到付款</view>
<text class="cuIcon-{{form.payType==2?'roundcheckfill':'roundcheck'}} text-{{form.payType==2?'blue':'grey'}}" style="font-size:18px"></text>
</view>
</view>
@ -86,8 +88,8 @@
<image style="width:48rpx;height:48rpx" src="/assets/image/icon_kefu.png"></image>
</button>
<view class="flex align-end">
<view class="text-gray" style="font-size:12px">共{{form.number}}{{form.unit}}</view>
<view class="text-black" style="font-size:14px">合计:</view>
<!-- <view class="text-gray" style="font-size:12px">共{{form.number}}{{form.unit}}</view> -->
<view class="text-black" style="font-size:14px;margin-left:24rpx">合计:</view>
<view class="text-blue" style="font-size:14px">¥{{form.totalPrice}}</view>
<button class="cu-btn offer-btn" bindtap="offerProject">立即购买</button>
</view>

15
pages/mall/order-offer/index.wxss

@ -82,4 +82,19 @@ button::after {
display: flex;
align-items: center;
justify-content: center;
}
.page-outline {
margin-top: 8rpx;
font-size: 10px;
font-family: PingFang-SC-Regular, PingFang-SC;
font-weight: 400;
color: rgba(51, 51, 51, 1);
display: -webkit-box;
overflow: hidden;
text-overflow: ellipsis;
word-wrap: break-word;
white-space: normal !important;
-webkit-line-clamp: 1;
-webkit-box-orient: vertical;
}

2
pages/mall/search-list/index.js

@ -31,7 +31,7 @@ Page({
*/
onLoad: function (options) {
this.setData({
height: app.globalData.fragmentHeight,
height: app.globalData.fragmentHeight - 100,
CustomBar: app.globalData.CustomBar,
})
var that = this

10
pages/mall/search-list/index.wxml

@ -45,11 +45,15 @@
</view>
</wux-image>
<view style="flex:1;padding:16rpx">
<view class="flex flex-justify">
<view class="flex flex-justify" >
<view class="page-name">{{item.name}}</view>
<view class="page-num">已拼{{item.soldNum}}{{item.unit}}</view>
<view wx:if="{{item.sellMode==2}}" class="page-num">已拼{{item.soldNum}}{{item.unit}}</view>
<view wx:elif="{{item.sellMode==1}}" class="page-num">{{item.viewNum}} 浏览</view>
</view>
<view style="height:100rpx">
<view class="page-outline">{{item.outline}}</view>
<view class="page-outline" style="margin-top: 8rpx">{{item.summary}}</view>
</view>
<view class="page-num" style="height:100rpx">{{item.summary}}</view>
<view class="flex flex-justify" style="align-items:flex-end">
<view class="page-price">¥{{item.price}}</view>
<view class="page-stock" style="margin-bottom:6rpx">库存:{{item.stockNumber}}{{item.unit}}</view>

15
pages/mall/search-list/index.wxss

@ -62,6 +62,21 @@
color: rgba(51, 51, 51, 1);
}
.page-outline {
margin-top: 8rpx;
font-size: 10px;
font-family: PingFang-SC-Regular, PingFang-SC;
font-weight: 400;
color: rgba(51, 51, 51, 1);
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-btn {
height: 27px;
background: rgba(255, 66, 43, 1);

63
pages/mall/shops/index.js

@ -10,15 +10,20 @@ Page({
* 页面的初始数据
*/
data: {
height: app.globalData.fragmentHeight - 100,
firstShow: false,
height: app.globalData.fragmentHeight - 180,
CustomBar: app.globalData.CustomBar,
tabs: ['待出车', '进行中', '已完成', '进行中', '已完成', '进行中', '已完成', '进行中', '已完成'],
scroll: true,
pageIndex: 0,
pageList: [],
tabs: [],
loading: true,
finished: false,
requesting: false,
cheapList: [],
taskList: [],
form: {
productTypeId: '',
pageSize: 10,
pageNum: 1
},
@ -31,7 +36,7 @@ Page({
onLoad: function (options) {
this.checkLogin()
this.setData({
height: app.globalData.fragmentHeight,
height: app.globalData.fragmentHeight - 200,
CustomBar: app.globalData.CustomBar,
token: app.globalData.token
})
@ -43,16 +48,50 @@ Page({
if(message.what == 1 && util.isEmpty(this.data.token)){
this.setData({ token: app.globalData.token })
}
this.fetchTabList()
this.fetchCheapList()
this.fetchTaskList()
},
/**
* 生命周期函数--监听页面初次渲染完成
*/
onReady: function () {
onShow: function(){
if(this.data.firstShow){
this.onRefreshList()
}
if (!this.data.firstShow) {
this.fetchCheapList()
this.fetchTaskList()
this.data.firstShow = true
}
},
// 获取特价列表
fetchTabList: function () {
// /product/type/list产品分类列表
request.get('/bxe-mall/product/type/list').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.pageList = result.data
this.setData({ tabs: tabList, scroll: size > 14 })
})
},
// Tab 点击切换,并刷新列表;
onTabChange: function (e) {
if(this.data.pageIndex == Number(e.detail.index)){
return
}
this.data.pageIndex = Number(e.detail.index)
if(this.data.pageIndex == 0){
this.data.form.productTypeId = ''
} else {
this.data.form.productTypeId = this.data.pageList[this.data.pageIndex - 1].id
}
this.onRefreshList()
},
// 下拉刷新...
onRefreshList: function(){
this.setData({
cheapList: [],
@ -66,13 +105,9 @@ Page({
},
// 获取特价列表
fetchCheapList: function () {
request.get('/bxe-mall/product/cheapList').then(result => {
request.get('/bxe-mall/product/cheapList', this.data.form).then(result => {
//成功回调
this.setData({ loading: false, cheapList: result.data })
}).catch(err => {
//异常回调
this.setData({ loading: false })
util.showToast(err)
})
},
// 获取团购列表
@ -80,7 +115,11 @@ Page({
if (this.data.requesting || this.data.finished) {
return
}
this.data.requesting = true
if(this.data.loading){
this.data.requesting = true
} else {
this.setData({ requesting: true })
}
// /product/cheapList特价产品列表
request.get('/bxe-mall/product/groupList', this.data.form).then(result => {
//成功回调

186
pages/mall/shops/index.wxml

@ -3,86 +3,105 @@
<view slot="content" style="color:black;font-size:18px">原纸商城</view>
</cu-custom>
<view wx:if="{{loading}}" class="page__bd page__bd_spacing">
<view class="sub-title"></view>
<wux-skeleton active>
<wux-row>
<wux-skeleton-avatar shape="rounded" size="full" />
</wux-row>
</wux-skeleton>
<view class="sub-title"></view>
<wux-skeleton active>
<wux-row>
<wux-skeleton-avatar shape="rounded" size="title" />
</wux-row>
</wux-skeleton>
<view class="sub-title"></view>
<wux-skeleton active>
<wux-row>
<wux-col span="4">
<wux-skeleton-avatar shape="rounded" size="page" />
</wux-col>
<wux-col span="1">
</wux-col>
<wux-col span="8">
<view style="margin-left:16rpx">
<wux-skeleton-paragraph rounded rows="4" />
</view>
</wux-col>
</wux-row>
</wux-skeleton>
<view class="sub-title"></view>
<wux-skeleton active>
<wux-row>
<wux-skeleton-avatar shape="rounded" size="title" />
</wux-row>
</wux-skeleton>
<view class="sub-title"></view>
<wux-skeleton active>
<wux-row>
<wux-col span="4">
<wux-skeleton-avatar shape="rounded" size="page" />
</wux-col>
<wux-col span="1">
</wux-col>
<wux-col span="8">
<view style="margin-left:16rpx">
<wux-skeleton-paragraph rounded rows="4" />
</view>
</wux-col>
</wux-row>
</wux-skeleton>
<view class="sub-title"></view>
<wux-skeleton active>
<wux-row>
<wux-col span="4">
<wux-skeleton-avatar shape="rounded" size="page" />
</wux-col>
<wux-col span="1">
</wux-col>
<wux-col span="8">
<view style="margin-left:16rpx">
<wux-skeleton-paragraph rounded rows="4" />
</view>
</wux-col>
</wux-row>
</wux-skeleton>
</view>
<view class="flex list-empty" wx:elif="{{!taskList.length && !cheapList.length}}" style="height:{{height}}rpx">
<image class="img-empty" src="/assets/image/list_empty.png"></image>
<view class="text-empty">暂无数据</view>
<view class="cu-bar bg-white search fixed" style="top:{{CustomBar}}px;">
<view class="search-form" style="border-radius: 12rpx" bindtap="searchList">
<text class="cuIcon-search"></text>
<input type="text" disabled="true" placeholder="请输入要搜索的商品" confirm-type="search"></input>
</view>
</view>
<view wx:else>
<view class="cu-bar bg-white search fixed" style="top:{{CustomBar}}px;">
<view class="nav bg-white fixed" style="top:{{CustomBar}}px;">
<view class="cu-bar bg-white search">
<view class="search-form" style="border-radius: 12rpx" bindtap="searchList">
<text class="cuIcon-search"></text>
<input type="text" disabled="true" placeholder="请输入要搜索的商品" confirm-type="search"></input>
</view>
</view>
<view style="height:100rpx;width:100%"></view>
<scroll-view scroll-y style="height:{{height}}rpx;padding: 0rpx 24rpx" bindscrolltolower="fetchTaskList">
<view style="height:100rpx;padding: 0rpx 32rpx" wx:if="{{tabs.length}}">
<wux-tab scroll="{{scroll}}" tab-data="{{tabs}}" tab-cur="{{pageIndex}}" padding="{{16}}" size="{{80}}" bindchange="onTabChange"></wux-tab>
</view>
<view wx:else style="height:100rpx;padding: 10rpx 48rpx">
<wux-skeleton active>
<wux-skeleton-avatar shape="rounded" size="tab" />
</wux-skeleton>
</view>
</view>
<view style="height:200rpx;width:100%"></view>
<refresh-view bind:refresh="onRefreshList" height="{{height}}" triggered="{{ requesting }}" bind:scrolltolower="fetchTaskList">
<view wx:if="{{loading}}" class="page__bd page__bd_spacing">
<view class="sub-title"></view>
<wux-skeleton active>
<wux-row>
<wux-skeleton-avatar shape="rounded" size="full" />
</wux-row>
</wux-skeleton>
<view class="sub-title"></view>
<wux-skeleton active>
<wux-row>
<wux-skeleton-avatar shape="rounded" size="title" />
</wux-row>
</wux-skeleton>
<view class="sub-title"></view>
<wux-skeleton active>
<wux-row>
<wux-col span="4">
<wux-skeleton-avatar shape="rounded" size="page" />
</wux-col>
<wux-col span="1">
</wux-col>
<wux-col span="8">
<view style="margin-left:16rpx">
<wux-skeleton-paragraph rounded rows="4" />
</view>
</wux-col>
</wux-row>
</wux-skeleton>
<view class="sub-title"></view>
<wux-skeleton active>
<wux-row>
<wux-skeleton-avatar shape="rounded" size="title" />
</wux-row>
</wux-skeleton>
<view class="sub-title"></view>
<wux-skeleton active>
<wux-row>
<wux-col span="4">
<wux-skeleton-avatar shape="rounded" size="page" />
</wux-col>
<wux-col span="1">
</wux-col>
<wux-col span="8">
<view style="margin-left:16rpx">
<wux-skeleton-paragraph rounded rows="4" />
</view>
</wux-col>
</wux-row>
</wux-skeleton>
<view class="sub-title"></view>
<wux-skeleton active>
<wux-row>
<wux-col span="4">
<wux-skeleton-avatar shape="rounded" size="page" />
</wux-col>
<wux-col span="1">
</wux-col>
<wux-col span="8">
<view style="margin-left:16rpx">
<wux-skeleton-paragraph rounded rows="4" />
</view>
</wux-col>
</wux-row>
</wux-skeleton>
</view>
<view class="flex list-empty" wx:elif="{{!taskList.length && !cheapList.length}}" style="height:{{height}}rpx">
<image class="img-empty" src="/assets/image/list_empty.png"></image>
<view class="text-empty">暂无数据</view>
</view>
<view wx:else style="padding: 0rpx 24rpx">
<image src="https://image.weilanwl.com/img/4x3-1.jpg" class="swiper-image" mode="aspectFill" lazy-load="{{true}}" style="margin-top:24rpx"></image>
<view wx:if="{{cheapList.length}}">
<view class="flex nav-li">
@ -94,7 +113,7 @@
<view class="flex content" wx:for="{{cheapList}}" wx:key="index" data-index="{{index}}" bindtap="lookCheapItem">
<wux-image width="{{119}}" height="{{119}}" wux-class="page-icon" lazyLoad="true" src="{{item.litimgUrl}}" mode="aspectFill">
<view class="image-load" slot="loading">
<text class="icon--refresher"></text>
<text class="icon--refresher"></text>
</view>
</wux-image>
<view style="flex:1;padding:16rpx 20rpx">
@ -102,7 +121,10 @@
<view class="page-name">{{item.name}}</view>
<view class="page-num">{{item.viewNum}} 浏览</view>
</view>
<view class="page-num" style="height:100rpx">{{item.summary}}</view>
<view style="height:100rpx">
<view class="page-outline">{{item.outline}}</view>
<view class="page-outline" style="margin-top: 8rpx">{{item.summary}}</view>
</view>
<view class="flex flex-justify" style="align-items:flex-end">
<view class="page-price">¥{{item.price}}</view>
<view class="page-stock" style="margin-bottom:6rpx">库存:{{item.stockNumber}}{{item.unit}}</view>
@ -121,10 +143,9 @@
</view>
<view wx:for-item="pageItem" wx:for-index="pageIndex" wx:for="{{taskList}}" wx:key="pageIndex">
<view class="flex content" wx:for="{{pageItem}}" wx:key="index" data-page="{{pageIndex}}" data-index="{{index}}" bindtap="lookGroupItem">
<!-- <image class="page-icon" src="{{item.litimgUrl}}" lazy-load="{{true}}" mode="aspectFill"></image> -->
<wux-image width="{{120}}" height="{{120}}" lazyLoad="{{true}}" wux-class="page-icon" src="{{item.litimgUrl}}" mode="aspectFill">
<view class="image-load" slot="loading">
<text class="icon--refresher"></text>
<view class="image-load" slot="loading">
<text class="icon--refresher"></text>
</view>
</wux-image>
<view style="flex:1;padding:16rpx 20rpx">
@ -132,7 +153,10 @@
<view class="page-name">{{item.name}}</view>
<view class="page-num">已拼{{item.soldNum}}{{item.unit}}</view>
</view>
<view class="page-num" style="height:100rpx">{{item.summary}}</view>
<view style="height:100rpx">
<view class="page-outline" >{{item.outline}}</view>
<view class="page-outline" style="margin-top: 8rpx">{{item.summary}}</view>
</view>
<view class="flex flex-justify" style="align-items:flex-end">
<view class="page-price">¥{{item.price}}</view>
<view class="page-stock" style="margin-bottom:6rpx">库存:{{item.stockNumber}}{{item.unit}}</view>
@ -148,5 +172,5 @@
<text class="text-sg" style="margin-left:8rpx">{{finished?'到底了':'加载中...'}}</text>
</view>
</wux-divider>
</scroll-view>
</view>
</view>
</refresh-view>

17
pages/mall/shops/index.wxss

@ -1,6 +1,6 @@
/* pages/mall/shops/index.wxss */
.swiper-image{
.swiper-image {
height: 120px;
border-radius: 6px;
width: 100%;
@ -104,6 +104,21 @@
color: rgba(51, 51, 51, 1);
}
.page-outline {
margin-top: 8rpx;
font-size: 10px;
font-family: PingFang-SC-Regular, PingFang-SC;
font-weight: 400;
color: rgba(51, 51, 51, 1);
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-btn {
height: 27px;
background: rgba(255, 66, 43, 1);

1
pages/refresh/refresh.js

@ -9,6 +9,7 @@ Page({
},
onRefresh(e) {
console.log('onRefresh>>>')
this.setData({
refresherState: true
})

4
pages/refresh/refresh.wxml

@ -1,6 +1,8 @@
<view style="height:150rpx;width:100%">
</view>
<refresh-view bind:refresh="onRefresh" triggered="{{ refresherState }}">
<refresh-view bind:refresh="onRefresh" triggered="{{ refresherState }}" bind:scrolltolower="onRefresh">
<view class="test-block">师德师风</view>
<view class="test-block">师德师风</view>
<view class="test-block">师德师风</view>
</refresh-view>
Loading…
Cancel
Save