Browse Source

Merge branch 'develop_szhj' of http://git.chelingzhu.com/jianguan-web/qpls-md-app into develop_szhj

chenrui 3 năm trước cách đây
mục cha
commit
c78d6dfcb3

+ 12 - 0
api/sales.js

@@ -73,4 +73,16 @@ export const settleStyleQueryAll = (params) => {
     data: params,
     method: 'post'
   })
+}
+
+// 客户列表
+export const customerList = (params) => {
+	const url=`cust/queryPage/${params.pageNo}/${params.pageSize}`
+	delete params.pageNo
+	delete params.pageSize
+	return axios.request({
+		url: url,
+		data: params,
+		method: 'post'
+	})
 }

+ 1 - 0
components/kk-printer/index.vue

@@ -200,6 +200,7 @@
 						blesdk.catchToast(err);
 					})
 				}).catch((err)=>{
+					console.log(err)
 					blesdk.catchToast(err);
 				})
 			},

+ 4 - 6
components/kk-printer/printer/tsc.js

@@ -16,7 +16,6 @@ var jpPrinter = {
 		jpPrinter.init = function() {};
 
 		jpPrinter.addCommand = function(content) { //将指令转成数组装起
-			//#ifdef MP-WEIXIN
 			var code = new encode.TextEncoder(
 				'gb18030', {
 					NONSTANDARD_allowLegacyEncoding: true
@@ -24,13 +23,12 @@ var jpPrinter = {
 			for (var i = 0; i < code.length; ++i) {
 				command.push(code[i])
 			}
-			//#endif
 			
 			//#ifdef APP-PLUS
-			let byteCommand = plus.android.invoke(content, 'getBytes', 'gb18030');
-			for (var i = 0; i < byteCommand.length; ++i) {
-			  command.push(byteCommand[i])
-			}
+			// let byteCommand = plus.android.invoke(content, 'getBytes', 'gb18030');
+			// for (var i = 0; i < byteCommand.length; ++i) {
+			//   command.push(byteCommand[i])
+			// }
 			//#endif
 			
 			//console.log('command--:',command)

+ 47 - 4
libs/printTools.js

@@ -43,18 +43,61 @@ export const getTextRows = function(str,iPageSize){
 // 格式化打印文本
 export const textFormat = function(command,text,maxFontNums,left,top,lightHeight,align,fontSize){
 	let rowTop = top
-	const textArr = getTextRows(text.replace(/\s+/g, ' '),maxFontNums*2)
+	const maxNums = maxFontNums
+	const rowHeight = lightHeight
+	const textArr = getTextRows(text.replace(/\s+/g, ' '),maxNums*2)
 	const rows = textArr.length
 	for(let i=0;i<rows;i++){
 		if(align=="center"){
 			const ltxt = textArr[i]
-			const ltlen = ltxt.replace(/[^x00-xFF]/g,'**').length/2
-			command.setText(left+((maxFontNums-ltlen)/2)*lightHeight, rowTop, "TSS24.BF2", fontSize, fontSize, ltxt)
+			const ltlen = getBytesCount(ltxt)/2*fontSize
+			command.setText(left+((maxNums-ltlen)/2)*rowHeight, rowTop, "TSS24.BF2", fontSize, fontSize, ltxt)
 		}
 		else{
 			command.setText(left, rowTop, "TSS24.BF2", fontSize, fontSize, textArr[i])
 		}
-		rowTop = rowTop+lightHeight
+		rowTop = rowTop+rowHeight*fontSize+10
 	}
 	return rowTop
+}
+
+// 60 * 40 尺寸模板
+export const printTempl = function(tsc,data){
+	let top = 16 // 距离顶部10点像素
+	const left = 8 // 距离左边
+	const lightHeight = 24 // 行高3mm,1mm = 8点
+	const pageW = 60 // 页签宽度mm
+	const pageH = 40 // 页签高度mm
+	const maxFontNums = Math.floor((pageW*8-left*2)/lightHeight) // 每行最多字体数
+	const leftMaxFnums = Math.floor(maxFontNums*0.6)
+	let rightTop = 0
+	let rightLeft = (leftMaxFnums+2)*lightHeight
+	// 初始化打印机
+	const command = tsc.jpPrinter.createNew()
+	command.init()
+	command.setSize(pageW, pageH) // 标签纸张宽高,单位mm
+	command.setGap(3) // 标签上下间距,单位mm
+	command.setCls() // 清除缓冲区数据
+	// 经销商文字高度,是否换行
+	top = textFormat(command,data.dealerName,maxFontNums,left,top,lightHeight,"center",1)
+	// 数字货架名称文字
+	top = top+10
+	rightTop = top
+	top = textFormat(command,data.shelfName,leftMaxFnums,left,top,lightHeight,"left",1)
+	// 产品编码
+	top = top+10
+	top = textFormat(command,data.productCode,leftMaxFnums,left,top,lightHeight,"left",1)
+	// 产品名称
+	top = top+6
+	top = textFormat(command,data.productName,leftMaxFnums,left,top,lightHeight,"left",1)
+	// 打印人打印时间
+	top = top+10
+	top = textFormat(command,data.printDate+' '+data.printUser,leftMaxFnums,left,top,lightHeight,"left",1)
+	// 货位号
+	const qrtop = textFormat(command,data.shelfPlaceCode,maxFontNums-leftMaxFnums-2,rightLeft,rightTop,lightHeight,"center",2)
+	// 二维码
+	command.setQR(rightLeft, qrtop, "L", 3, "A", data.barCode)
+	command.setPagePrint(1,data.currentInven) // 打印分数1,每个标签重发打印2次
+	console.log("开始打印了",command.getData())
+	return command
 }

+ 2 - 2
manifest.json

@@ -2,8 +2,8 @@
     "name" : "iSCM智慧供应链",
     "appid" : "__UNI__5B57B68",
     "description" : "iSCM智慧供应链系统",
-    "versionName" : "1.0.3",
-    "versionCode" : 103,
+    "versionName" : "1.0.4",
+    "versionCode" : 104,
     "transformPx" : false,
     /* 5+App特有相关 */
     "app-plus" : {

+ 86 - 0
pages/common/customerSearch.vue

@@ -0,0 +1,86 @@
+<template>
+	<view class="search-box">
+		<u-search
+			placeholder="请输入客户名称搜索" 
+			v-model="queryWord" 
+			@input="searchBrand"
+			@search="searchBrand"
+			@clear="clearSearch"
+			:action-style="{'color': '#fff', 'font-size': '24upx', 'background-color': $config('primaryColor'), 'border-radius': '6upx', 'padding': '12upx 0'}">
+		</u-search>
+		<scroll-view class="picker-content flex_1" scroll-y>
+			<view class="picker-main">
+				<view class="picker-main-item" v-for="(item, index) in listData" :key="item.id" @click="chooseItem(index)">
+					<view class="item-name">{{item.customerName}}</view>
+				</view>
+				<view v-if="listData&&listData.length>=20" style="color:#999;font-size: 26upx;">最多显示前20条匹配客户,请尝试输入更多内容</view>
+				<view v-if="listData && listData.length == 0">
+					<u-empty text="暂无匹配客户" mode="list" :img-width="200" :margin-top="60"></u-empty>
+				</view>
+			</view>
+		</scroll-view>
+	</view>
+</template>
+
+<script>
+	import {customerList} from '@/api/sales.js'
+	export default{
+		data(){
+			return{
+				listData:[],
+				queryWord:'',
+				pageSize:20,
+				pageNo:1,
+			}
+		},
+		methods:{
+			getData(){
+				customerList({queryWord:this.queryWord,pageNo:this.pageNo,pageSize:this.pageSize}).then(res => {
+					if(res.status == 200 && res.data){
+						this.listData = res.data.list
+					}else{
+						this.listData = []
+					}
+				})
+			},
+			// 搜索品牌
+			searchBrand(){
+				if(this.queryWord != ''){
+					this.getData()
+				}
+			},
+			clearSearch(){
+				this.queryWord = ''
+				this.listData = []
+				this.getData()
+			},
+			chooseItem(val){
+				
+			}
+		}
+	}
+</script>
+
+<style lang="scss">
+	.search-box{
+		width: 100%;
+		.picker-content{
+			padding: 6upx 0 20upx;
+			.picker-main{
+				width: 100%;
+				.picker-main-item{
+					padding: 0 20upx;
+					.item-name{
+						padding: 14upx 0;
+						border-bottom: 1rpx solid #e5e6eb;
+					}
+					.item-name:not(:last-child){
+						border-bottom:none
+					}
+				}
+				
+			}
+		}
+	}
+	
+</style>

+ 2 - 38
pages/common/printTag/printTag.vue

@@ -28,7 +28,7 @@
 <script>
 	import { shelfDetail } from '@/api/shelf'
 	import kkPrinter from '@/components/kk-printer/index.vue';
-	import {textFormat} from '@/libs/printTools.js'
+	import {printTempl} from '@/libs/printTools.js'
 	import moment from 'moment'
 	export default {
 		components:{
@@ -110,43 +110,7 @@
 					return
 				}
 				this.isParinting = true
-				let top = 10 // 距离顶部10点像素
-				const left = 8 // 距离左边
-				const lightHeight = 24 // 行高3mm,1mm = 8点
-				const pageW = 40 // 页签宽度mm
-				const pageH = 30 // 页签高度mm
-				const maxFontNums = Math.floor((pageW*8-left*2)/lightHeight) // 每行最多字体数
-				let rightTop = 0
-				let rightLeft = (Math.floor(maxFontNums*0.6)+1)*lightHeight
-				// 初始化打印机
-				const command = tsc.jpPrinter.createNew()
-				command.init()
-				command.setSize(pageW, pageH) // 标签纸张宽高,单位mm
-				command.setGap(2) // 标签上下间距,单位mm
-				command.setCls() // 清除缓冲区数据
-				// 经销商文字高度,是否换行
-				top = textFormat(command,this.printInfo.dealerName,maxFontNums,left,top,lightHeight,"center",1)
-				// 数字货架名称文字
-				top = top+10
-				rightTop = top
-				const lwidth = Math.floor(maxFontNums*0.6)
-				top = textFormat(command,this.printInfo.shelfName,lwidth,left,top,lightHeight,"left",1)
-				// 产品编码
-				top = top+10
-				top = textFormat(command,this.printInfo.productCode,lwidth,left,top,lightHeight,"left",1)
-				// 产品名称
-				top = top+10
-				top = textFormat(command,this.printInfo.productName,lwidth,left,top,lightHeight,"left",1)
-				// 打印人打印时间
-				top = top+10
-				top = textFormat(command,this.printInfo.printDate+' '+this.printInfo.printUser,lwidth,left,top,lightHeight,"left",1)
-				// 货位号
-				textFormat(command,this.printInfo.shelfPlaceCode,maxFontNums-lwidth,rightLeft,rightTop,lightHeight,"center",1)
-				// 二维码
-				const qrtop = rightTop +lightHeight+10
-				command.setQR(rightLeft, qrtop, "L", 3, "A", this.printInfo.barCode)
-				command.setPagePrint(1,this.printInfo.currentInven) // 打印分数1,每个标签重发打印2次
-				console.log("开始打印了",command.getData())
+				const command = printTempl(tsc,this.printInfo)
 				blesdk.senBlData(opt.deviceId, opt.serviceId, opt.writeId, command.getData(), this.onPrintSuccess);
 			},
 			// 打印成功

+ 0 - 28
pages/index/index.vue

@@ -36,34 +36,6 @@
 			// 设置底部tabbar 样式
 			const theme = getApp().globalData.theme
 			this.theme = theme
-			uni.setTabBarItem({
-			  "index": 0,
-			  "iconPath": "static/"+theme+"/tabbar/home.png",
-			  "selectedIconPath": "static/"+theme+"/tabbar/home-active.png",
-			})
-			uni.setTabBarItem({
-			  "index": 1,
-			  "iconPath": "static/"+theme+"/tabbar/stock.png",
-			  "selectedIconPath": "static/"+theme+"/tabbar/stock-active.png",
-			})
-			uni.setTabBarItem({
-			  "index": 2,
-			  "iconPath": "static/"+theme+"/tabbar/shelf.png",
-			  "selectedIconPath": "static/"+theme+"/tabbar/shelf-active.png",
-			})
-			uni.setTabBarItem({
-			  "index": 3,
-			  "iconPath": "static/"+theme+"/tabbar/user.png",
-			  "selectedIconPath": "static/"+theme+"/tabbar/user-active.png",
-			})
-			uni.setTabBarStyle({
-			  color: this.$config("topBarTitleColors"),
-			  selectedColor: this.$config("primaryColor"),
-			  borderStyle: 'white',
-			  complete: function(res){
-				console.log(res)
-			  }
-			})
 			// 数字货架导航按钮
 			this.storageRacksNavList = [
 				{

+ 2 - 5
pages/latePlay/chooseProduct.vue

@@ -96,9 +96,7 @@
 			},
 			// 搜索配件
 			searchPart(){
-				if(this.queryWord != ''){
-					this.getpartList()
-				}
+				this.getpartList()
 			},
 			// 获取数字货架列表
 			getpartList(){
@@ -190,12 +188,11 @@
 			background-color: #fff;
 		}
 		.nav-right{
-			padding: 0 30upx;
 			height: calc(100vh - 180rpx);
 			box-sizing: border-box;
 			
 			.partList-list-box{
-				padding: 10px 0;
+				padding: 20rpx 30rpx;
 				border-bottom: 2rpx solid #f5f5f5;
 				&:last-child{
 					border:0;

+ 1 - 1
pages/login/login.vue

@@ -165,7 +165,7 @@ export default {
 		toMain() {
 			// 跳转到首页
 			uni.switchTab({
-				url: '/pages/sales/index'
+				url: '/pages/stock/index'
 			});
 		},
 		//  忘记密码

+ 19 - 45
pages/replenishmentManage/manualPrint.vue

@@ -21,7 +21,7 @@
 	import kkPrinter from '@/components/kk-printer/index.vue';
 	import { shelfReplenishDetail, shelfReplenishDetailList, shelfReplenishPrintSign } from '@/api/shelfReplenish'
 	import partList from '@/pages/common/partList.vue'
-	import {textFormat} from '@/libs/printTools.js'
+	import {printTempl} from '@/libs/printTools.js'
 	export default {
 		components: { partList, kkPrinter },
 		data() {
@@ -81,51 +81,21 @@
 				this.allChecked = val
 			},
 			printOnce(opt,tsc,blesdk,data){
-				if(this.isParinting){
-					return
-				}
-				this.isParinting = true
 				const _this = this
 				const dealer = this.$store.state.vuex_userData
-				let top = 10 // 距离顶部10点像素
-				const left = 8 // 距离左边
-				const lightHeight = 24 // 行高3mm,1mm = 8点
-				const pageW = 40 // 页签宽度mm
-				const pageH = 30 // 页签高度mm
-				const maxFontNums = Math.floor((pageW*8-left*2)/lightHeight) // 每行最多字体数
-				let rightTop = 0
-				let rightLeft = (Math.floor(maxFontNums*0.6)+1)*lightHeight
-				// 初始化打印机
-				const command = tsc.jpPrinter.createNew()
-				command.init()
-				command.setSize(pageW, pageH) // 标签纸张宽高,单位mm
-				command.setGap(2) // 标签上下间距,单位mm
-				command.setCls() // 清除缓冲区数据
-				// 经销商文字高度,是否换行
-				top = textFormat(command,dealer.orgName,maxFontNums,left,top,lightHeight,"center",1)
-				// 数字货架名称文字
-				top = top+10
-				rightTop = top
-				const lwidth = Math.floor(maxFontNums*0.6)
-				top = textFormat(command,this.basicInfoData.shelfInfo.shelfName,lwidth,left,top,lightHeight,"left",1)
-				// 产品编码
-				top = top+10
-				top = textFormat(command,data.productCode,lwidth,left,top,lightHeight,"left",1)
-				// 产品名称
-				top = top+10
-				top = textFormat(command,data.product.name,lwidth,left,top,lightHeight,"left",1)
-				// 时间,打印人
-				top = top+10
-				top = textFormat(command,this.$u.timeFormat(this.timestamp, 'yyyy-mm-dd hh:MM')+" "+this.$store.state.vuex_userData.userNameCN,lwidth,left,top,lightHeight,"left",1)
-				// 货位号
-				textFormat(command,data.shelfPlaceCode,maxFontNums-lwidth,rightLeft,rightTop,lightHeight,"center",1)
-				// 二维码
-				const qrtop = rightTop +lightHeight+10
-				const qrcont = `dealerSn=${dealer.orgSn}&shelfSn=${data.shelfSn}&productCode=${data.productCode}&shelfPlaceCode=${data.shelfPlaceCode}&shelfPlaceSn=${data.shelfPlaceSn}`
-				command.setQR(rightLeft, qrtop, "L", 3, "A", qrcont)
-				command.setPagePrint(1,data.printQty) // 打印分数1,每个标签重发打印2次
-				
-				console.log("开始打印了",command.getData())
+				// 60*40 打印模板
+				const command = printTempl(tsc,{
+					dealerName: dealer.orgName,
+					shelfName: this.basicInfoData.shelfInfo.shelfName || '',
+					productCode: data.productCode || '',
+					productName: data.product.name || '',
+					shelfPlaceCode: data.shelfPlaceCode || '',
+					currentInven: data.printQty,
+					printDate: this.$u.timeFormat(this.timestamp, 'yyyy-mm-dd hh:MM'),
+					printUser: dealer.userNameCN,
+					barCode: `dealerSn=${dealer.orgSn}&shelfSn=${data.shelfSn}&productSn=${data.productSn}&productCode=${data.productCode}&shelfPlaceCode=${data.shelfPlaceCode}&shelfPlaceSn=${data.shelfPlaceSn}`
+				})
+				// 开始批量打印 
 				blesdk.senBlData(
 				opt.deviceId, 
 				opt.serviceId, 
@@ -143,10 +113,14 @@
 					}
 				});
 			},
-			// 打印
+			// 批量打印 
 			startPrint(opt,tsc,blesdk){
 				const result =this.$refs.partList.getAllChecked()
 				if(result.length){
+					 if(this.isParinting){
+					 	return
+					 }
+					 this.isParinting = true
 					 this.printOnce(opt,tsc,blesdk,result[this.printIndex])
 				}else{
 					this.toashMsg("请选择产品!")

+ 43 - 1
pages/sales/chooseCustomer.vue

@@ -1,8 +1,50 @@
 <template>
+	<view class="chooseCustomer-content">
+		<view class="flex justify_between align_center search-title">
+			<text class="search-label">客户名称</text>
+			<view class="search-btn">
+				<text>没有搜索到?</text>
+				<text>点击</text>
+				<text>新增客户</text>
+			</view>
+		</view>
+		<!-- 客户搜索框 -->
+		<customerSearch></customerSearch>
+	</view>
 </template>
 
 <script>
+	import customerSearch from '@/pages/common/customerSearch.vue'
+	export default{
+		components:{customerSearch},
+		data(){
+			return{
+				
+			}
+		}
+	}
 </script>
 
-<style>
+<style lang="scss">
+	.chooseCustomer-content{
+		width: 100%;
+		background-color: #fff;
+		padding:0 30upx;
+		.search-title{
+			padding: 20upx 0;
+			.search-label{
+				font-size: 30upx;
+				font-weight: 600;
+			}
+			.search-btn{
+				font-size: 28upx;
+				color: #999;
+				text:last-child{
+					display: inline-block;
+					padding-left: 10upx;
+					color:#007AFF
+				}
+			}
+		}
+	}
 </style>

+ 1 - 1
pages/sales/index.vue

@@ -26,7 +26,7 @@
 				<u-image class="nav-pic" style="margin-top: 5upx;" :src="`../../static/${theme}/navIcon/price_icon.png`" width="60" height="60"></u-image>
 				<text class="nav-txt" style="margin-top: 5upx;">产品报价</text>
 			</view>
-			<view class="nav-item" @click="toPage('')">
+			<view class="nav-item" @click="toPage('/pages/sales/chooseCustomer')">
 				<u-image class="nav-pic" :src="`../../static/${theme}/navIcon/sale_icon.png`" width="70" height="70"></u-image>
 				<text class="nav-txt">新增销售单</text>
 			</view>

+ 29 - 0
pages/stock/index.vue

@@ -80,6 +80,35 @@
 			}
 		},
 		onLoad() {
+			const theme = getApp().globalData.theme
+			uni.setTabBarItem({
+			  "index": 0,
+			  "iconPath": "static/"+theme+"/tabbar/home.png",
+			  "selectedIconPath": "static/"+theme+"/tabbar/home-active.png",
+			})
+			uni.setTabBarItem({
+			  "index": 1,
+			  "iconPath": "static/"+theme+"/tabbar/stock.png",
+			  "selectedIconPath": "static/"+theme+"/tabbar/stock-active.png",
+			})
+			uni.setTabBarItem({
+			  "index": 2,
+			  "iconPath": "static/"+theme+"/tabbar/shelf.png",
+			  "selectedIconPath": "static/"+theme+"/tabbar/shelf-active.png",
+			})
+			uni.setTabBarItem({
+			  "index": 3,
+			  "iconPath": "static/"+theme+"/tabbar/user.png",
+			  "selectedIconPath": "static/"+theme+"/tabbar/user-active.png",
+			})
+			uni.setTabBarStyle({
+			  color: this.$config("topBarTitleColors"),
+			  selectedColor: this.$config("primaryColor"),
+			  borderStyle: 'white',
+			  complete: function(res){
+				console.log(res)
+			  }
+			})
 			this.getTotal()
 		},
 		methods: {

+ 35 - 13
pages/stock/stockSearch.vue

@@ -41,8 +41,11 @@
 						</view>
 					</view>
 				</view>
-				<view v-if="listData && listData.length == 0">
-					<u-empty :text="noDataText" mode="list" :img-width="200" :margin-top="30"></u-empty>
+				<view v-if="listData&&listData.length==0">
+					<u-empty v-if="status!='loading'" :src="`/static/${$config('themePath')}/def_no_data@3x.png`" icon-size="240" :text="noDataText" mode="list" :margin-top="50"></u-empty>
+				</view>
+				<view style="padding: 20upx;" v-if="totalNum>pageSize || status=='loading'">
+					<u-loadmore :status="status" />
 				</view>
 			</view>
 		</scroll-view>
@@ -57,9 +60,10 @@
 			return {
 				totalData: null,
 				totalNum: 0,
+				status: 'loading',
 				listData: [],
 				pageNo: 1,
-				pageSize: 6,
+				pageSize: 50,
 				params: {},
 				noDataText: '暂无数据',
 				theme: '',
@@ -78,20 +82,36 @@
 				if (pageNo) {
 					this.pageNo = pageNo
 				}
+				this.status = 'loading'
 				let params = Object.assign(this.params, { pageNo: this.pageNo, pageSize: this.pageSize })
 				stockList(params).then(res => {
 					this.getTotal(params)
-					if (res.status == 200) {
-						if(this.pageNo>1){
-							this.listData = this.listData.concat(res.data.list || [])
-						}else{
-							this.listData = res.data.list || []
+					if(res.status == 200){
+						let list = res.data.list
+						if (list && list.length){
+							// 分页 拼接数据
+							if (_this.pageNo != 1) {
+								_this.listData = _this.listData ? _this.listData.concat(list) : list
+							} else {
+								_this.listData = list
+							}
+							this.totalNum = res.data.count
+							if (_this.listData.length == res.data.count) {
+								_this.status = 'nomore'
+							} else {
+								_this.status = 'loadmore'
+							}
+						} else {
+							_this.listData = list || []
+							this.totalNum = 0
+							_this.status = 'nomore'
 						}
-						this.totalNum = res.data.count || 0
-					} else {
-						this.listData = []
-						this.totalNum = 0
-						this.noDataText = res.message
+						_this.noDataText = '暂无配件'
+					}else{
+						_this.status = 'loadmore'
+						_this.listData = []
+						_this.totalNum = 0
+						_this.noDataText = res.message ? res.message : '网络似乎出错了,请稍后再试'
 					}
 				})
 			},
@@ -110,6 +130,8 @@
 				if(this.listData.length < this.totalNum){
 					this.pageNo += 1
 					this.getList()
+				}else{
+					this.status = "nomore"
 				}
 			},
 			// 详情

+ 1 - 1
pages/userCenter/index.vue

@@ -1,6 +1,6 @@
 <template>
 	<view class="user-content">
-		<view class="status_bar">
+		<view class="status_bar" :style="`background:${$config('primaryColor')}`">
 		  <!-- 这里是状态栏 -->
 	    </view>
 		<!-- 头部 -->