Просмотр исходного кода

标签打印修改 -- 花材详情处的修改

shizhongqi 4 лет назад
Родитель
Сommit
fdcf41b9ed
1 измененных файлов с 31 добавлено и 16 удалено
  1. 31 16
      ghsApp/src/admin/item/detail.vue

+ 31 - 16
ghsApp/src/admin/item/detail.vue

@@ -86,7 +86,7 @@
         <tui-list-cell class="line-cell" :hover="false">
           <view class="tui-title">库存预警值</view>
           <input v-model="form.stockWarning" style="width:300upx;" @focus="form.stockWarning=''" placeholder-class="phcolor" class="tui-input" name="stockWarning" placeholder="请填写" maxlength="50" type="number" />
-          <button v-if="productData.id > 0" class="admin-button-com blue middle" @click="printLabel(productData)">打标签</button>
+          <button v-if="productData.id > 0" class="admin-button-com blue middle" @click="doPrintLabel(productData.id)">打标签</button>
         </tui-list-cell>
 
         <tui-list-cell class="line-cell" :hover="false">
@@ -133,6 +133,11 @@
       </view>
 
     </form>
+
+    <uni-popup ref="inputDialog" type="dialog">
+			<uni-popup-dialog ref="inputClose"  mode="input" title="标签数量" value=""
+				placeholder="请输入标签数量" @confirm="dialogPrintLabelConfirm"></uni-popup-dialog>
+		</uni-popup>
   </view>
 </template>
 
@@ -186,7 +191,8 @@ export default {
       hasRequest:0,
       productData:{id:0},
       headers:{token:''},
-      cost:0
+      cost:0,
+      printItemId:0
     };
   },
 	computed:{
@@ -211,23 +217,32 @@ export default {
   watch:{
   },
   methods: {
-    printLabel(item){
+    doPrintLabel(id){
+			this.printItemId = id
+			this.$refs.inputDialog.open()
+		},
+		dialogPrintLabelConfirm(count) {
 			let that=this;
-			let doList = ['打1个标签', '打2个标签','打5个标签', '打10个标签','打100个标签','打500个标签']
-			let doNum = [1,2,5,10,100,500]
-			uni.showActionSheet({
-				itemList: doList,
-				success: function (respond) {
-          let index = respond.tapIndex
-          let currentNum = Number(doNum[index])
-          print({id:item.id,num:currentNum}).then(res=>{
-            if(res.code == 1){
-              that.$msg(res.msg)
-            }
-          })
+			this.$refs.inputDialog.close()
+
+			let currentNum = Number(count)
+			let itemId = this.printItemId
+			if (currentNum <= 0) {
+				that.$msg('打印数量不能小于等于0')
+				return
+			}
+			if (itemId == 0) {
+				that.$msg('打印的花材id出错')
+				return
+			}
+			print({id:itemId,num:currentNum}).then(res=>{
+				if(res.code == 1){
+					that.$msg(res.msg)
+				} else if(res.code == 0){
+					that.$msg(res.msg)
 				}
 			})
-    },
+		},
     notModify(){
       this.$msg('不可修改')
     },