<script>
function m_sort(arr,field) {
var test = 'abcdefghijklmnopqrstuvwxyz';
var test_arr = {};
for (var i = 0; i < test.length; i++) {
test_arr[test[i]] = [];
}
arr.forEach(function (item,index) {
test_arr[item[field][0].toLowerCase()].push(item);
});
var result = [];
for (var i = 0; i < test.length; i++) {
result = result.concat(test_arr[test[i]]);
}
return result;
}
"condition": {
"current": 0,
"list": [
{
"name": "测试",
"path": "pages/phones/phones",
"query": "id=1"
}
]
}
:canvas-id="'canvasGauge'+index"
getDay: function(day) {
var today = new Date();
var targetday_milliseconds = today.getTime() + 1000 * 60 * 60 * 24 * day;
today.setTime(targetday_milliseconds);
var tYear = today.getFullYear();
var tMonth = today.getMonth();
var tDate = today.getDate();
tMonth = this.doHandleMonth(tMonth + 1);
tDate = this.doHandleMonth(tDate);
return tYear + '-' + tMonth + '-' + tDate;
},
doHandleMonth: function(month) {
var m = month;
if (month.toString().length == 1) {
m = '0' + month;
}
return m;
},
setDateTime: function() {
var now = new Date();
var year = now.getFullYear();
var month = now.getMonth() + 1;
var day = now.getDate();
var moning;
var clock = year + '-';
if (month < 10) clock += '0';
clock += month + '-';
if (day < 10) clock += '0';
clock += day + ' ';
return clock;
},
duibi:function (a, b) {
var arr = a[0].split("-");
var starttime = new Date(arr[0], arr[1], arr[2]);
var starttimes = starttime.getTime();
var arrs = b.split("-");
var lktime = new Date(arrs[0], arrs[1], arrs[2]);
var lktimes = lktime.getTime();
if (starttimes > lktimes) {
return false;
}
else
return true;
},
getDay: function(day) {
var today = new Date();
var targetday_milliseconds = today.getTime() + 1000 * 60 * 60 * 24 * day;
today.setTime(targetday_milliseconds);
var tYear = today.getFullYear();
var tMonth = today.getMonth();
var tDate = today.getDate();
tMonth = this.doHandleMonth(tMonth + 1);
tDate = this.doHandleMonth(tDate);
return tYear + '-' + tMonth + '-' + tDate;
},
doHandleMonth: function(month) {
var m = month;
if (month.toString().length == 1) {
m = '0' + month;
}
return m;
},
setDateTime: function() {
var now = new Date();
var year = now.getFullYear();
var month = now.getMonth() + 1;
var day = now.getDate();
var moning;
var clock = year + '-';
if (month < 10) clock += '0';
clock += month + '-';
if (day < 10) clock += '0';
clock += day + ' ';
return clock;
},
datedifference:function(sDate1, sDate2) {
var dateSpan,
tempDate,
iDays;
sDate1 = Date.parse(sDate1);
sDate2 = Date.parse(sDate2);
dateSpan = sDate2 - sDate1;
dateSpan = Math.abs(dateSpan);
iDays = Math.floor(dateSpan / (24 * 3600 * 1000));
return iDays
},
getDate :function(e){
var dateee = new Date(e).toJSON();
var date = new Date(+new Date(dateee)+8*3600*1000).toISOString().replace(/T/g,' ').replace(/\.[\d]{3}Z/,'')
return date;
},
to_date('2019-10-22','yyyy-mm-dd')
</script>
<!-- 自定义数字键盘 -->
<template>
<!-- =========================自定义键盘(数字)=================== -->
<view class="content">
<view class="login">
<view class="l_top">
<input class="trade_pwd" disabled="true" id="targetInput" @click="onkeyboardshow()" v-model="trade_pwd" />
</view>
</view>
<view :class="[keyboardshow?'keypan':'']">
<view class="titles" @tap="closeKeyboard()">
<image v-show="keyboardshow" class="down_hide_imgge" src="../../static/down_hide.png"></image>
</view>
<view class="pan_num_key" v-if="keyboardshow" :class="[items.checked?'pan_num_checked':'pan_num_key']" v-for="(items,index) in boardlists"
:key="index" @touchend="writepwd_stop_delete()" @touchstart="writepwd_delete(items.id)" @tap="writepwd(items.id)">{{items.con}}</view>
</view>
</view>
</template>
<script>
export default {
data() {
return {
keyboardshow: true,
trade_pwd: '',
numarr: [],
boardlists: [{
id: 1,
con: 1,
checked: false
}, {
id: 2,
con: 2,
checked: false
}, {
id: 3,
con: 3,
checked: false
}, {
id: 4,
con: 4,
checked: false
}, {
id: 5,
con: 5,
checked: false
}, {
id: 6,
con: 6,
checked: false
}, {
id: 7,
con: 7,
checked: false
}, {
id: 8,
con: 8,
checked: false
}, {
id: 9,
con: 9,
checked: false
}, {
id: 10,
con: "✓",
checked: false
}, {
id: 11,
con: 0,
checked: false
},
{
id: 12,
con: "⋘",
checked: false
},
],
num_delete:''
};
},
computed: {
},
onLoad() {
},
methods: {
writepwd_delete:function(num){
var _that=this;
if(num>=12){
this.num_delete=setInterval(function() {
_that.close();
}, 80)
}
},
writepwd(num) {
console.log(num);
if (num == 12) {
this.close();
this.boardlists[11].checked = true;
return;
}
if (num == 10) {
this.setpwd();
this.boardlists[9].checked = true;
return;
}
if (num == 11) {
num = 0;
this.boardlists[10].checked = true;
} else {
this.boardlists[num - 1].checked = true;
}
this.numarr.push(num);
var that = this;
setTimeout(function() {
for (var i = 0; i < that.boardlists.length; i++) {
that.boardlists[i].checked = false;
}
}, 200)
this.trade_pwd = this.numarr.join("");
},
closeKeyboard: function() {
this.keyboardshow = false;
},
writepwd_stop_delete:function(){
clearInterval(this.num_delete);
},
close() {
this.numarr.pop();
if (this.trade_pwd.length > 0) {
this.trade_pwd = this.trade_pwd.substring(0, this.trade_pwd.length - 1);
}else{
this.writepwd_stop_delete();
}
},
onkeyboardshow:function(){
this.keyboardshow=true;
},
setpwd() {
if (this.trade_pwd.length <=0) {
uni.showToast({
image:'',
title:'亲你的输入为空~',
duration:1500
})
return;
}
console.log(this.trade_pwd);
},
}
};
</script>
<style lang="scss" scoped>
.trade_pwd{
border: 1upx solid#000;
}
.content {
width: 100%;
font-size: 28upx;
background: #fff;
color: #555;
height: 100vh;
font-weight: 400;
.keypan {
width: 100%;
height: 550upx;
position: fixed;
left: 0;
bottom: 0;
background: #E6E6E6;
.titles {
width: 90%;
height: 58upx;
background: #E6E6E6;
display: flex;
justify-content: space-between;
line-height: 80upx;
padding: 0 5%;
font-size: 32upx;
color: #292824;
span {
width: 100upx;
height: 70upx;
display: inline-block;
padding-left: 30upx;
}
}
.pan_num_key {
width: 33.3%;
height: 124upx;
float: Left;
text-align: center;
background: #fff;
font-size: 60upx;
line-height: 120upx;
box-shadow: 0 2upx 5upx rgba(0, 0, 0, 0.5);
}
.pan_num_checked {
width: 33.3%;
height: 124upx;
float: Left;
text-align: center;
font-size: 60upx;
line-height: 120upx;
box-shadow: 0 2upx 5upx rgba(0, 0, 0, 0.5);
animation: checked_bg 0.3s ease;
}
}
.navigation_bar {
display: flex;
flex-direction: row;
align-items: center;
padding-top: 60upx;
.back-icon {
width: 18upx;
height: 34upx;
}
}
.login {
width: 100%;
height: 300upx;
.l_top {
width: 700upx;
height: 200upx;
margin: 0 auto;
position: relative;
.l_text {
width: 445upx;
height: 69upx;
font-size: 28upx;
text-align: center;
margin: auto;
top: 100upx;
position: relative;
}
.lt {
margin-top: -20upx;
font-size: 25upx;
color: #555
}
}
}
.title {
color: #616161;
text-align: center;
font-size: 30upx;
margin-bottom: 34upx;
}
.mima {
flex-direction: row;
width: 680upx;
height: 78upx;
margin: 0 auto;
position: relative;
.item {
width: 92upx;
height: 100%;
box-sizing: border-box;
display: flex;
float: left;
align-items: center;
justify-content: center;
border-bottom: 1upx solid #E5E5E5;
margin-left: 20upx;
.line {
width: 2upx;
height: 40upx;
background: #979797;
animation: shan 1s ease infinite;
}
.dot {
width: 20upx;
height: 20upx;
border-radius: 20upx;
background: black;
}
}
.trade_pwd {
position: absolute;
height: 78upx !important;
width: 480upx;
opacity: 0;
}
}
}
@keyframes shan {
from {
opacity: 1;
}
to {
opacity: 0;
}
}
@keyframes checked_bg {
0% {
background: #fff
}
50% {
background: #D3D1E2
}
100% {
background: #fff
}
}
.down_hide_imgge{
position: absolute;
width: 90upx;
height: 60upx;
margin-left: 295upx;
}
</style>
<--删除字符最后一个逗号-->
Warehouse_data = (Warehouse_data.substring(Warehouse_data.length - 1) == ',') ? Warehouse_data.substring(0, Warehouse_data.length - 1) : str;
bootstarp的选择加减框
function btnmin() {
var i = document.getElementById("quantity").value;
if (i > 0) {
i--;
document.getElementById("quantity").value = i;
} else {
i = 0;
document.getElementById("quantity").value = i;
}
}
function btnadd() {
var i = document.getElementById("quantity").value;
console.log(document.getElementById("quantity").value)
if (i < document.getElementById("quantity").max) {
i++;
document.getElementById("quantity").value = i;
} else {
toastr.warning('申请数量不能超过库存数量!');
return;
}
}
function Duplicate(List) {
function sortprice(a, b) {
return a.id - b.id
}
List.sort(sortprice);
var res = [List[0]];
for (var i = 1; i < List.length; i++) {
if (List[i].id !== res[res.length - 1].id) {
res.push(List[i]);
}
}
return res;
}