|
@@ -2,23 +2,28 @@
|
|
|
<view class="boardset-flowert">
|
|
<view class="boardset-flowert">
|
|
|
<view class="flower-input_box">
|
|
<view class="flower-input_box">
|
|
|
<view class="flower-title">{{customData.name}}</view>
|
|
<view class="flower-title">{{customData.name}}</view>
|
|
|
|
|
+ <view class="flower-ratio">{{customData.ratio}}{{customData.smallUnit}}/{{customData.bigUnit}}</view>
|
|
|
<view class="flower-open_box">
|
|
<view class="flower-open_box">
|
|
|
<view>
|
|
<view>
|
|
|
- <view class="desc">{{Number(customData.unitType) == 0 ? customData.bigUnit : customData.smallUnit}}数</view>
|
|
|
|
|
|
|
+ <view class="desc">{{Number(unitType) == 0 ? customData.bigUnit : customData.smallUnit}}数</view>
|
|
|
<div class="flower-unit_box" @tap="checkCurrent(0)">
|
|
<div class="flower-unit_box" @tap="checkCurrent(0)">
|
|
|
- <text :class="{selected:hasCheck == 0}">{{buyNum}}</text>
|
|
|
|
|
|
|
+ <text :class="{selected:checkType == 0}">{{buyNum}}</text>
|
|
|
</div>
|
|
</div>
|
|
|
</view>
|
|
</view>
|
|
|
<view>
|
|
<view>
|
|
|
<view class="desc">单价</view>
|
|
<view class="desc">单价</view>
|
|
|
<div class="flower-unit_box" @tap="checkCurrent(1)">
|
|
<div class="flower-unit_box" @tap="checkCurrent(1)">
|
|
|
- <text :class="{selected:hasCheck == 1}">{{unitPrice}}</text>
|
|
|
|
|
|
|
+ <text :class="{selected:checkType == 1}">{{unitPrice}}</text>
|
|
|
</div>
|
|
</div>
|
|
|
</view>
|
|
</view>
|
|
|
</view>
|
|
</view>
|
|
|
- <view class="set-residue_box">还剩{{parseFloat(customData.stock)}}{{customData.bigUnit}}</view>
|
|
|
|
|
|
|
+ <view class="set-residue_box">
|
|
|
|
|
+ 还剩
|
|
|
|
|
+ <text v-if="bigStockNum>0">{{bigStockNum}}{{customData.bigUnit}}</text>
|
|
|
|
|
+ <text v-if="smallStockNum>0">{{smallStockNum}}{{customData.smallUnit}}</text>
|
|
|
|
|
+ </view>
|
|
|
<view class="switch-button">
|
|
<view class="switch-button">
|
|
|
- <image @tap="changeUnit" class="change-unit" :src="`${constant.imgUrl}/icon/switch/switch128.png`"></image>
|
|
|
|
|
|
|
+ <image @tap="changeUnitType" class="change-unit" :src="`${constant.imgUrl}/icon/switch/switch128.png`"></image>
|
|
|
</view>
|
|
</view>
|
|
|
</view>
|
|
</view>
|
|
|
<view class="keyboard-body_box">
|
|
<view class="keyboard-body_box">
|
|
@@ -36,14 +41,15 @@ export default {
|
|
|
},
|
|
},
|
|
|
data() {
|
|
data() {
|
|
|
return {
|
|
return {
|
|
|
- keyShow: false,
|
|
|
|
|
- enterType:'currentNum',
|
|
|
|
|
//输入类型 0 数值 1价格
|
|
//输入类型 0 数值 1价格
|
|
|
fillType:0,
|
|
fillType:0,
|
|
|
buyNum:'',
|
|
buyNum:'',
|
|
|
unitPrice:'',
|
|
unitPrice:'',
|
|
|
|
|
+ unitType:0,
|
|
|
//全选类型 0 数值全选 1 价格全选 2 没有任何全选
|
|
//全选类型 0 数值全选 1 价格全选 2 没有任何全选
|
|
|
- hasCheck:0
|
|
|
|
|
|
|
+ checkType:0,
|
|
|
|
|
+ bigStockNum:0,
|
|
|
|
|
+ smallStockNum:0
|
|
|
};
|
|
};
|
|
|
},
|
|
},
|
|
|
mounted(){
|
|
mounted(){
|
|
@@ -52,16 +58,21 @@ export default {
|
|
|
watch:{
|
|
watch:{
|
|
|
customData:{
|
|
customData:{
|
|
|
handler(){
|
|
handler(){
|
|
|
- console.log(this.customData,'this.customData')
|
|
|
|
|
- this.buyNum = this.customData.buyNum||1
|
|
|
|
|
- this.unitPrice = this.customData.bigPrice||0
|
|
|
|
|
|
|
+ this.buyNum = parseFloat(this.customData.buyNum)
|
|
|
|
|
+ this.unitPrice = parseFloat(this.customData.bigPrice)
|
|
|
|
|
+
|
|
|
|
|
+ this.bigStockNum = Math.floor(this.customData.stock)
|
|
|
|
|
+ let smallCount = this.customData.stock - this.bigStockNum
|
|
|
|
|
+ let smallStockNum = smallCount*this.customData.ratio
|
|
|
|
|
+ this.smallStockNum = smallStockNum.toFixed(2)
|
|
|
|
|
+ this.smallStockNum = parseFloat(this.smallStockNum)
|
|
|
},
|
|
},
|
|
|
deep:true
|
|
deep:true
|
|
|
}
|
|
}
|
|
|
},
|
|
},
|
|
|
methods: {
|
|
methods: {
|
|
|
checkCurrent(n){
|
|
checkCurrent(n){
|
|
|
- this.hasCheck = n
|
|
|
|
|
|
|
+ this.checkType = n
|
|
|
this.fillType = n
|
|
this.fillType = n
|
|
|
},
|
|
},
|
|
|
cancel(){
|
|
cancel(){
|
|
@@ -72,16 +83,13 @@ export default {
|
|
|
focusSelect(event){
|
|
focusSelect(event){
|
|
|
event.currentTarget.select();
|
|
event.currentTarget.select();
|
|
|
},
|
|
},
|
|
|
- changeType(type){
|
|
|
|
|
- this.enterType = type
|
|
|
|
|
- },
|
|
|
|
|
activeKeyboard() {
|
|
activeKeyboard() {
|
|
|
this.$refs.keyboard.activate();
|
|
this.$refs.keyboard.activate();
|
|
|
},
|
|
},
|
|
|
typing(e) {
|
|
typing(e) {
|
|
|
if (e.backspace) {
|
|
if (e.backspace) {
|
|
|
if(this.fillType == 0){
|
|
if(this.fillType == 0){
|
|
|
- if(this.hasCheck == 0){
|
|
|
|
|
|
|
+ if(this.checkType == 0){
|
|
|
this.buyNum = ''
|
|
this.buyNum = ''
|
|
|
}else{
|
|
}else{
|
|
|
if (this.buyNum.length > 0) {
|
|
if (this.buyNum.length > 0) {
|
|
@@ -89,7 +97,7 @@ export default {
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
}else{
|
|
}else{
|
|
|
- if(this.hasCheck == 1){
|
|
|
|
|
|
|
+ if(this.checkType == 1){
|
|
|
this.unitPrice = ''
|
|
this.unitPrice = ''
|
|
|
}else{
|
|
}else{
|
|
|
if (this.unitPrice.length > 0) {
|
|
if (this.unitPrice.length > 0) {
|
|
@@ -99,20 +107,20 @@ export default {
|
|
|
}
|
|
}
|
|
|
}else {
|
|
}else {
|
|
|
if(this.fillType == 0){
|
|
if(this.fillType == 0){
|
|
|
- if(this.$util.isEmpty(this.buyNum) || this.hasCheck == 0) {
|
|
|
|
|
|
|
+ if(this.$util.isEmpty(this.buyNum) || this.checkType == 0) {
|
|
|
this.buyNum = e.char
|
|
this.buyNum = e.char
|
|
|
}else {
|
|
}else {
|
|
|
this.buyNum += e.char;
|
|
this.buyNum += e.char;
|
|
|
}
|
|
}
|
|
|
}else{
|
|
}else{
|
|
|
- if(this.$util.isEmpty(this.unitPrice) || this.hasCheck == 1) {
|
|
|
|
|
|
|
+ if(this.$util.isEmpty(this.unitPrice) || this.checkType == 1) {
|
|
|
this.unitPrice = e.char
|
|
this.unitPrice = e.char
|
|
|
}else {
|
|
}else {
|
|
|
this.unitPrice += e.char;
|
|
this.unitPrice += e.char;
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
- this.hasCheck = 2
|
|
|
|
|
|
|
+ this.checkType = 2
|
|
|
},
|
|
},
|
|
|
enter() {
|
|
enter() {
|
|
|
if(Number(this.buyNum) <= 0) {
|
|
if(Number(this.buyNum) <= 0) {
|
|
@@ -125,11 +133,13 @@ export default {
|
|
|
}
|
|
}
|
|
|
this.customData.buyNum = this.buyNum
|
|
this.customData.buyNum = this.buyNum
|
|
|
this.customData.unitPrice = this.unitPrice
|
|
this.customData.unitPrice = this.unitPrice
|
|
|
- this.$emit('enterNum', this.customData)
|
|
|
|
|
|
|
+ this.customData.unitType = this.unitType
|
|
|
|
|
+ this.$emit('confirmAddItemModel', this.customData)
|
|
|
},
|
|
},
|
|
|
- changeUnit(){
|
|
|
|
|
- this.customData.unitType = this.customData.unitType == 0 ? 1 : 0
|
|
|
|
|
- this.$forceUpdate()
|
|
|
|
|
|
|
+ changeUnitType(){
|
|
|
|
|
+ this.unitType = this.unitType == 0 ? 1 : 0
|
|
|
|
|
+ this.unitPrice = this.unitType == 0 ? this.customData.bigPrice : this.customData.smallPrice
|
|
|
|
|
+ this.unitPrice = parseFloat(this.unitPrice)
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
@@ -153,6 +163,13 @@ export default {
|
|
|
color: #333333;
|
|
color: #333333;
|
|
|
font-size: 14upx;
|
|
font-size: 14upx;
|
|
|
}
|
|
}
|
|
|
|
|
+ & .flower-ratio{
|
|
|
|
|
+ text-align: center;
|
|
|
|
|
+ color: #CCCCCC;
|
|
|
|
|
+ font-size: 9upx;
|
|
|
|
|
+ margin-bottom:10upx;
|
|
|
|
|
+ margin-top:6upx;
|
|
|
|
|
+ }
|
|
|
& .set-residue_box {
|
|
& .set-residue_box {
|
|
|
font-size: 12upx;
|
|
font-size: 12upx;
|
|
|
color: #CCCCCC;
|
|
color: #CCCCCC;
|
|
@@ -168,7 +185,7 @@ export default {
|
|
|
width:90upx;
|
|
width:90upx;
|
|
|
& .desc {
|
|
& .desc {
|
|
|
text-align: center;
|
|
text-align: center;
|
|
|
- font-size: 12upx;
|
|
|
|
|
|
|
+ font-size: 13upx;
|
|
|
margin-bottom: 5upx;
|
|
margin-bottom: 5upx;
|
|
|
color:#CCCCCC;
|
|
color:#CCCCCC;
|
|
|
}
|
|
}
|