|
|
@@ -41,6 +41,7 @@
|
|
|
</view>
|
|
|
</view>
|
|
|
<view class="goods-list-bottom flex-center-between">
|
|
|
+ <text @click.stop="moreToDo(goodsItem)">更多</text>
|
|
|
<text @click.stop="getSaleRecord">销售记录</text>
|
|
|
<text @click.stop="getStockChange(goodsItem)">库存明细</text>
|
|
|
<text @click.stop="edit(goodsItem.id)">编辑</text>
|
|
|
@@ -70,12 +71,15 @@
|
|
|
</view>
|
|
|
</template>
|
|
|
<script>
|
|
|
-import AppSearchModule from "@/components/module/app-search";
|
|
|
-import OperateModule from "@/admin/home/components/module/operate";
|
|
|
-import AppWrapperEmpty from "@/components/app-wrapper-empty";
|
|
|
-import ModalModule from "@/components/plugin/modal";
|
|
|
-import {categoryListB,getCategoryGoodsB} from "@/api/goods";
|
|
|
-import { list } from "@/mixins";
|
|
|
+import AppSearchModule from "@/components/module/app-search"
|
|
|
+import OperateModule from "@/admin/home/components/module/operate"
|
|
|
+import AppWrapperEmpty from "@/components/app-wrapper-empty"
|
|
|
+import ModalModule from "@/components/plugin/modal"
|
|
|
+import {categoryListB,getCategoryGoodsB} from "@/api/goods"
|
|
|
+import { list } from "@/mixins"
|
|
|
+// #ifdef APP-PLUS
|
|
|
+const plug= uni.requireNativePlugin('Html5app-Gprinter')
|
|
|
+// #endif
|
|
|
export default {
|
|
|
name: "list",
|
|
|
components: {
|
|
|
@@ -106,9 +110,88 @@ export default {
|
|
|
computed: {
|
|
|
},
|
|
|
onLoad: function() {
|
|
|
- this.getCategoryData();
|
|
|
+ this.getCategoryData()
|
|
|
},
|
|
|
methods: {
|
|
|
+ moreToDo(item){
|
|
|
+ //查询是否已经连接蓝牙
|
|
|
+ let that=this;
|
|
|
+ let doList = ['打1个条码', '打2个条码', '打10个条码','打20个条码']
|
|
|
+ let doNum = [1,2,10,20]
|
|
|
+ uni.showActionSheet({
|
|
|
+ itemList: doList,
|
|
|
+ success: function (respond) {
|
|
|
+ let index = respond.tapIndex
|
|
|
+ // #ifdef APP-PLUS
|
|
|
+ plug.state({},ret=>{
|
|
|
+ if(ret.code == 1){
|
|
|
+ that.$util.confirmModal({content:'您还没有连接条码机,请先连接'},() => {
|
|
|
+ // #ifdef APP-PLUS
|
|
|
+ plug.connectUSB({setBackgroundColor:"#2088d2"},ret=>{
|
|
|
+ //console.log(ret)
|
|
|
+ })
|
|
|
+ // #endif
|
|
|
+ })
|
|
|
+ }else{
|
|
|
+ let currentNum = Number(doNum[index])
|
|
|
+ if(Number(currentNum)<0){
|
|
|
+ this.$msg('请选择打印数量')
|
|
|
+ return false
|
|
|
+ }
|
|
|
+ let data = []
|
|
|
+ let label = that.createLable(item.name,item.sn,currentNum)
|
|
|
+ data.push(label)
|
|
|
+ //说明地址 https://ext.dcloud.net.cn/plugin?id=462
|
|
|
+ plug.printer({"TSC":data,isArray:true},result=>{
|
|
|
+ //console.log(result)
|
|
|
+ })
|
|
|
+ }
|
|
|
+ })
|
|
|
+ // #endif
|
|
|
+ // #ifdef MP-WEIXIN
|
|
|
+ that.$msg('请在App上打印')
|
|
|
+ // #endif
|
|
|
+ }
|
|
|
+ })
|
|
|
+ },
|
|
|
+ //大条码
|
|
|
+ createLable(itemName,itemId,num){
|
|
|
+ //制作条码格式,
|
|
|
+ var data=[]; //定义一个数组
|
|
|
+ var line={}; //每添加一个,代表一行字
|
|
|
+
|
|
|
+ //设置条码纸大小
|
|
|
+ line={};
|
|
|
+ line.width=40; //mm
|
|
|
+ line.height=50; //mm
|
|
|
+ line.gap=2; //条码纸之间,间隙长度 mm
|
|
|
+ line.page=num; //打印几份
|
|
|
+ data.push(line); //每添加一个,代表一行字
|
|
|
+
|
|
|
+ //添加文字
|
|
|
+ line={};
|
|
|
+ line.text= itemName;
|
|
|
+ line.rotation=0;
|
|
|
+ line.x=260;
|
|
|
+ line.y=15;
|
|
|
+ line.xscal=2;
|
|
|
+ line.yscal=2;
|
|
|
+ data.push(line); //每添加一个,代表一行字
|
|
|
+
|
|
|
+ //添加条型码
|
|
|
+ line={};
|
|
|
+ line.barcode=itemId;
|
|
|
+ line.x=260;
|
|
|
+ line.y=80;
|
|
|
+ line.type="CODE128";
|
|
|
+ line.width=2;//条型宽度,这里的宽指的是 条型码 竖条的宽度,不是整个条型码的宽度
|
|
|
+ line.height=90;
|
|
|
+ line.readable=true;
|
|
|
+ line.rotation=0;
|
|
|
+ data.push(line);
|
|
|
+
|
|
|
+ return data;
|
|
|
+ },
|
|
|
searchFn(){
|
|
|
|
|
|
},
|