|
|
@@ -4,7 +4,7 @@
|
|
|
<view class="bills-info_box content-box">
|
|
|
<view class="order-info_box">
|
|
|
<view>订单日期:</view>
|
|
|
- <view>{{ detailInfo.updateTime ? detailInfo.updateTime.substring(0, 16) : '' }}</view>
|
|
|
+ <view>{{ detailInfo.addTime ? detailInfo.addTime.substr(5, 11) : '' }}</view>
|
|
|
</view>
|
|
|
<view class="order-info_box">
|
|
|
<view>订单编号:</view>
|
|
|
@@ -30,7 +30,7 @@
|
|
|
<view class="module-com content-box proInfo">
|
|
|
<view class="commodity-view">
|
|
|
<view class="infoAEdit">
|
|
|
- <text>商品信息</text> <text @click="printAllLabel()" style="float:right;font-weight:normal;color:#3385FF;margin-right:10upx;">打全部条码</text>
|
|
|
+ <text>商品信息</text> <text @click="printAllLabel(detailInfo)" style="float:right;font-weight:normal;color:#3385FF;margin-right:10upx;">打全部条码</text>
|
|
|
</view>
|
|
|
<view class="commodity-list">
|
|
|
<view v-for="(s, idx) in itemList" :key="idx" class="commodity-item" >
|
|
|
@@ -95,11 +95,8 @@
|
|
|
</view>
|
|
|
</template>
|
|
|
<script>
|
|
|
-import { getPlantCgDetail} from "@/api/goods/index";
|
|
|
+import { getPlantCgDetail,printAll,printItem} from "@/api/goods/index";
|
|
|
import TuiListCell from "@/components/plugin/list-cell";
|
|
|
-// #ifdef APP-PLUS
|
|
|
-const plug = uni.requireNativePlugin('Html5app-Gprinter')
|
|
|
-// #endif
|
|
|
export default {
|
|
|
name: "plantCgDetail",
|
|
|
components: {
|
|
|
@@ -130,163 +127,21 @@ export default {
|
|
|
})
|
|
|
},
|
|
|
methods: {
|
|
|
- printLabel(ele){
|
|
|
- let that = this
|
|
|
- // #ifdef APP-PLUS
|
|
|
-
|
|
|
- let platform=uni.getSystemInfoSync().platform
|
|
|
- if(platform=='ios'){
|
|
|
- that.$msg('开发中,敬请期待')
|
|
|
- return false
|
|
|
- }
|
|
|
-
|
|
|
- plug.state({},ret=>{
|
|
|
- if(ret.code == 1){
|
|
|
- that.$util.confirmModal({content:'您还没有连接条码机,请先连接'},() => {
|
|
|
- // #ifdef APP-PLUS
|
|
|
- plug.connectUSB({setBackgroundColor:"#2088d2"},ret=>{
|
|
|
- //console.log(ret)
|
|
|
- })
|
|
|
- // #endif
|
|
|
- })
|
|
|
- }else{
|
|
|
- that.$util.confirmModal({content:'确认打印?'},() => {
|
|
|
- let data = []
|
|
|
- if(ele.name && !that.$util.isEmpty(ele.name)){
|
|
|
- let num = parseFloat(ele.num)
|
|
|
- let price = parseFloat(ele.salePrice)
|
|
|
- let label = that.createLable(ele.name,ele.goodsSn,num,price)
|
|
|
- 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
|
|
|
+ printLabel(item){
|
|
|
+ let that = this
|
|
|
+ printItem({id:item.id}).then(res=>{
|
|
|
+ if(res.code == 1){
|
|
|
+ that.$msg(res.msg)
|
|
|
+ }
|
|
|
+ })
|
|
|
},
|
|
|
- printAllLabel(){
|
|
|
+ printAllLabel(item){
|
|
|
let that = this
|
|
|
- // #ifdef APP-PLUS
|
|
|
-
|
|
|
- let platform=uni.getSystemInfoSync().platform
|
|
|
- if(platform=='ios'){
|
|
|
- that.$msg('开发中,敬请期待')
|
|
|
- return false
|
|
|
- }
|
|
|
-
|
|
|
- plug.state({},ret=>{
|
|
|
- if(ret.code == 1){
|
|
|
- that.$util.confirmModal({content:'您还没有连接条码机,请先连接'},() => {
|
|
|
- // #ifdef APP-PLUS
|
|
|
- plug.connectUSB({setBackgroundColor:"#2088d2"},ret=>{
|
|
|
- //console.log(ret)
|
|
|
- })
|
|
|
- // #endif
|
|
|
- })
|
|
|
- }else{
|
|
|
- that.$util.confirmModal({content:'确认打印全部条码?'},() => {
|
|
|
- if(!that.$util.isEmpty(that.itemList)){
|
|
|
- let data = []
|
|
|
- for (const ele of that.itemList) {
|
|
|
- if(ele.name && !that.$util.isEmpty(ele.name)){
|
|
|
- let num = parseFloat(ele.num)
|
|
|
- let price = parseFloat(ele.salePrice)
|
|
|
- let label = that.createLable(ele.name,ele.goodsSn,num,price)
|
|
|
- data.push(label)
|
|
|
- let separateLabel = that.createSeparateLabel()
|
|
|
- data.push(separateLabel)
|
|
|
- }
|
|
|
- }
|
|
|
- //说明地址 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
|
|
|
- },
|
|
|
- //分隔条码
|
|
|
- createSeparateLabel(){
|
|
|
- //制作条码格式,
|
|
|
- var data=[]; //定义一个数组
|
|
|
- var line={}; //每添加一个,代表一行字
|
|
|
-
|
|
|
- //设置条码纸大小
|
|
|
- line={};
|
|
|
- line.width=40; //mm
|
|
|
- line.height=50; //mm
|
|
|
- line.gap=2; //条码纸之间,间隙长度 mm
|
|
|
- line.page=1; //打印几份
|
|
|
- data.push(line); //每添加一个,代表一行字
|
|
|
-
|
|
|
- //添加文字
|
|
|
- line={};
|
|
|
- line.text= '======';
|
|
|
- line.rotation=0;
|
|
|
- line.x=290;
|
|
|
- line.y=80;
|
|
|
- line.xscal=2;
|
|
|
- line.yscal=2;
|
|
|
- data.push(line); //每添加一个,代表一行字
|
|
|
-
|
|
|
- return data;
|
|
|
- },
|
|
|
- createLable(itemName,itemId,num,price){
|
|
|
- //制作条码格式,
|
|
|
- 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=290;
|
|
|
- line.y=15;
|
|
|
- line.xscal=2;
|
|
|
- line.yscal=2;
|
|
|
- data.push(line); //每添加一个,代表一行字
|
|
|
-
|
|
|
- line={};
|
|
|
- line.text= price+'元';
|
|
|
- line.rotation=0;
|
|
|
- line.x=390;
|
|
|
- line.y=180;
|
|
|
- line.xscal=1;
|
|
|
- line.yscal=1;
|
|
|
- data.push(line); //每添加一个,代表一行字
|
|
|
-
|
|
|
- //添加条型码
|
|
|
- line={};
|
|
|
- line.barcode=itemId;
|
|
|
- line.x=290;
|
|
|
- line.y=80;
|
|
|
- line.type="CODE128";
|
|
|
- line.width=2;//条型宽度,这里的宽指的是 条型码 竖条的宽度,不是整个条型码的宽度
|
|
|
- line.height=90;
|
|
|
- line.readable=true;
|
|
|
- line.rotation=0;
|
|
|
- data.push(line);
|
|
|
-
|
|
|
- return data;
|
|
|
+ printAll({orderSn:item.orderSn}).then(res=>{
|
|
|
+ if(res.code == 1){
|
|
|
+ that.$msg(res.msg)
|
|
|
+ }
|
|
|
+ })
|
|
|
},
|
|
|
copy (val) {
|
|
|
const self = this;
|