Browse Source

2021年5月11日 15:28:08

feature/v1.5
xpz2018 4 years ago
parent
commit
5432e08d13
8 changed files with 56 additions and 48 deletions
  1. 15
      components/loading/index.wxml
  2. 15
      components/refresh-view/index.js
  3. 2
      components/refresh-view/scroll.wxs
  4. 30
      pages/process/index/index.js
  5. 2
      pages/process/index/index.json
  6. 15
      pages/process/index/index.wxml
  7. 2
      utils/storage.js
  8. 23
      utils/util.js

15
components/loading/index.wxml

@ -1,18 +1,11 @@
<wxs src="../wxs/utils.wxs" module="utils" />
<view class="custom-class van-loading {{ vertical ? 'van-loading--vertical' : '' }}">
<view
class="van-loading__spinner van-loading__spinner--{{ type }}"
style="color: {{ color }}; width: {{ utils.addUnit(size) }}; height: {{ utils.addUnit(size) }}"
>
<view
wx:if="{{ type === 'spinner' }}"
wx:for="{{ array12 }}"
wx:key="index"
class="van-loading__dot"
/>
<view class="van-loading__spinner van-loading__spinner--{{ type }}"
style="color: {{ color }}; width: {{ utils.addUnit(size) }}; height: {{ utils.addUnit(size) }}">
<view wx:if="{{ type === 'spinner' }}" wx:for="{{ array12 }}" wx:key="index" class="van-loading__dot" />
</view>
<view class="van-loading__text" style="font-size: {{ utils.addUnit(textSize) }};">
<slot />
</view>
</view>
</view>

15
components/refresh-view/index.js

@ -10,7 +10,7 @@ Component({
},
threshold: { // 下拉刷新阈值,下拉距离超过该值触发刷新
type: Number,
value: 32
value: 30
},
color: { // 下拉刷新进度条颜色
type: String,
@ -32,7 +32,6 @@ Component({
}
}
},
/**
* 组件的初始数据
*/
@ -49,7 +48,6 @@ Component({
this.setData({ progressBarHeight: this.rpx2px(80) });
}
},
/**
* 组件的方法列表
*/
@ -58,16 +56,11 @@ Component({
// console.log(e);
if (e.detail.scrollTop <= 50) {
// 滚动到顶部
this.setData({
scrollTop: true
});
this.setData({ scrollTop: true });
} else {
this.setData({
scrollTop: false
});
this.setData({ scrollTop: false });
}
},
/**
* 滚动到底部
*/
@ -76,7 +69,6 @@ Component({
this.triggerEvent('loadmore');
}
},
/**
* 设置刷新状态
*/
@ -89,7 +81,6 @@ Component({
this.setData({ triggered: refreshing });
}
},
/**
* rpx转px
*/

2
components/refresh-view/scroll.wxs

@ -3,7 +3,7 @@
*/
var startmark = 0; // 开始触摸屏幕的位置
var newmark = 0; // 当前移动到的位置
var maxDistance = 80; // 下拉最大距离(单位px)
var maxDistance = 75; // 下拉最大距离(单位px)
var triggered = false; // 当前下拉刷新状态,true表示下拉刷新已经被触发,false表示下拉刷新未被触发
/**

30
pages/process/index/index.js

@ -22,6 +22,12 @@ Component({
{ status: 3, badge: '', name: '待付款', icon: '/assets/image/icon_payment.png' },
{ status: 4, badge: '', name: '已完成', icon: '/assets/image/icon_finish.png' }
],
tabList1: [
{ status: 1, badge: '', name: '待收货', icon: '/assets/image/icon_pricing.png' },
{ status: 2, badge: '', name: '待定价', icon: '/assets/image/icon_checking.png' },
{ status: 3, badge: '', name: '待付款', icon: '/assets/image/icon_payment.png' },
{ status: 4, badge: '', name: '已完成', icon: '/assets/image/icon_finish.png' }
],
tabList2: [
{ status: 1, badge: '', name: '磅单信息', icon: '/assets/image/icon_pound.png' },
{ status: 2, badge: '', name: '出货审核', icon: '/assets/image/icon_outcheck.png' },
@ -48,7 +54,14 @@ Component({
{id: '123242K78978KK', name: '河西路打包站'},
{id: '12313378978KK5', name: '成林道打包站'}
],
visible: false
visible: false,
actions: [
{ id: 1, name: '厂内收货' },
{ id: 2, name: '厂外收货' },
{ id: '', name: '全部' }
],
sheetStr: '全部',
sheet: false
},
lifetimes: {
attached: function () {
@ -194,10 +207,14 @@ Component({
}
})
},
showSheet: function(){
showCalendar: function(){
this.setData({ show: true })
this.triggerEvent("zIndex", -1)
},
showSheet: function(){
this.setData({ sheet: true })
this.triggerEvent("zIndex", -1)
},
onClose: function() {
this.setData({ show: false })
this.trigEvent(9)
@ -231,6 +248,15 @@ Component({
setTimeout(() => {
this.triggerEvent('zIndex', zIndex)
}, 100);
},
onCancel: function(){
this.setData({ sheet: false })
this.trigEvent(9)
},
onAction: function({detail}){
console.log(detail)
this.setData({ sheetStr: detail.name })
}
}
})

2
pages/process/index/index.json

@ -5,9 +5,9 @@
"van-grid-item": "/components/grid-item/index",
"van-cell": "/components/cell/index",
"van-cell-group": "/components/cell-group/index",
"van-info": "/components/info/index",
"van-icon": "/components/icon/index",
"van-popup": "/components/popup/index",
"van-action-sheet": "/components/action-sheet/index",
"van-calendar": "/components/calendar/index"
}
}

15
pages/process/index/index.wxml

@ -16,9 +16,15 @@
<view class="bg-white" style="border-radius: 20rpx;padding: 24rpx 0rpx 8rpx 0rpx">
<view class="flex flex-justify" style="padding: 0rpx 28rpx 24rpx 28rpx">
<view class="text-black text-sg text-bold">收货统计</view>
<view class="flex flex-center" bindtap="showSheet" style="padding: 2rpx 0rpx">
<!-- <view class="flex flex-center" bindtap="showSheet" style="padding: 2rpx 0rpx">
<view class="text-black text-sm" style="margin-right:8rpx">{{vdateString}}</view>
<!-- <van-icon name="arrow-down" /> -->
</view> -->
</view>
<view class="flex flex-justify" style="padding: 0rpx 28rpx 24rpx 28rpx">
<view class="text-black text-sm">{{vdateString}}</view>
<view class="flex flex-center" bindtap="showSheet" style="padding: 2rpx 0rpx">
<view class="text-black text-sm" style="margin-right:8rpx">{{sheetStr}}</view>
<van-icon name="{{sheet ? 'arrow-up' : 'arrow-down'}}" />
</view>
</view>
<view class="flex" style="padding:0rpx 0rpx 24rpx 0rpx" bindtap="orderList">
@ -68,7 +74,7 @@
</view>
</view>
<van-grid column-num="4" border="{{fasle}}">
<van-grid-item wx:for="{{ tabList }}" wx:key="index" data-status="{{item.status}}" bind:click="outsideList" text="{{item.name}}">
<van-grid-item wx:for="{{ tabList1 }}" wx:key="index" data-status="{{item.status}}" bind:click="outsideList" text="{{item.name}}">
<van-icon slot="icon" name="{{ item.icon }}" size="68rpx" info="{{item.badge}}" />
</van-grid-item>
</van-grid>
@ -128,6 +134,9 @@
<van-calendar show="{{ show }}" type="range" row-height="50" color="#008AFF" z-index="22" min-date="{{ minDate }}" max-date="{{ maxDate }}" default-date="{{ vdate }}" top="{{ 1500 }}" show-subtitle="{{ false }}" show-confirm="{{ false }}" bind:close="onClose" bind:confirm="onSelect"/>
<van-action-sheet show="{{ sheet }}" actions="{{ actions }}" bind:cancel="onCancel" bind:close="onCancel"
bind:select="onAction" cancel-text="取消" z-index="22" />
<van-popup position="top" show="{{ visible }}" bind:close="onHide" z-index="29">
<view class="bg-white" style="margin-top:{{customBar}}px;width: 100%;">
<scroll-view scroll-y style="height:{{ 96 * (factoryList.length >= 5 ? 5 : factoryList.length)}}rpx;">

2
utils/storage.js

@ -16,7 +16,6 @@
let value = wx.getStorageSync(key);
return value ? value : def;
}
/**
* 设置缓存
* @param String $key key
@ -34,7 +33,6 @@ function put (key, value, timeout = 0) {
}
return value;
}
function remove (key) {
wx.removeStorageSync(key);
wx.removeStorageSync(`${key}__separator__`);

23
utils/util.js

@ -96,6 +96,9 @@ function playDing() {
function showBackToast(content) {
if (isEmpty(content)) {
setTimeout(function () {
wx.navigateBack()
}, 500)
return
}
wx.showToast({
@ -121,10 +124,7 @@ function checkId(id) {
var format = /^(([1][1-5])|([2][1-3])|([3][1-7])|([4][1-6])|([5][0-4])|([6][1-5])|([7][1])|([8][1-2]))\d{4}(([1][9]\d{2})|([2]\d{3}))(([0][1-9])|([1][0-2]))(([0][1-9])|([1-2][0-9])|([3][0-1]))\d{3}[0-9xX]$/;
//号码规则校验
if (!format.test(id)) {
return {
'status': 0,
'msg': '身份证号码不合规'
};
return { 'status': 0, 'msg': '身份证号码不合规' }
}
//区位码校验
//出生年月日校验 前正则限制起始年份为1900;
@ -135,10 +135,7 @@ function checkId(id) {
now_time = Date.parse(new Date()), //当前时间戳
dates = (new Date(year, month, 0)).getDate(); //身份证当月天数
if (time > now_time || date > dates) {
return {
'status': 0,
'msg': '出生日期不合规'
}
return { 'status': 0, 'msg': '出生日期不合规' }
}
//校验码判断
var c = new Array(7, 9, 10, 5, 8, 4, 2, 1, 6, 3, 7, 9, 10, 5, 8, 4, 2); //系数
@ -149,15 +146,9 @@ function checkId(id) {
sum += parseInt(id_array[k]) * parseInt(c[k]);
}
if (id_array[17].toUpperCase() != b[sum % 11].toUpperCase()) {
return {
'status': 0,
'msg': '身份证校验码不合规'
}
}
return {
'status': 1,
'msg': '校验通过'
return { 'status': 0, 'msg': '身份证校验码不合规' }
}
return { 'status': 1, 'msg': '校验通过' }
}
function combination(arr, m) {

Loading…
Cancel
Save