Explorar o código

Merge branch 'pre-release' of jianguan-web/qpls-md-app into master

李磊 %!s(int64=3) %!d(string=hai) anos
pai
achega
c14d9e61ba
Modificáronse 100 ficheiros con 23215 adicións e 1071 borrados
  1. 24 0
      .hbuilderx/launch.json
  2. 189 16
      App.vue
  3. 55 0
      api/customer.js
  4. 54 2
      api/data.js
  5. 11 0
      api/dealerProductBrand.js
  6. 11 0
      api/dealerProductType.js
  7. 0 43
      api/login.js
  8. 166 0
      api/sales.js
  9. 40 0
      api/shelf.js
  10. 52 0
      api/shelfRecall.js
  11. 95 0
      api/shelfReplenish.js
  12. 63 0
      api/stock.js
  13. 14 13
      api/user.js
  14. 447 0
      components/address.vue
  15. 117 0
      components/icon-items-list/icon-items-list.vue
  16. BIN=BIN
      components/kk-printer/empty-icon.png
  17. 436 0
      components/kk-printer/index.vue
  18. 9 0
      components/kk-printer/printer/encoding-indexes.js
  19. 3312 0
      components/kk-printer/printer/encoding.js
  20. 313 0
      components/kk-printer/printer/esc.js
  21. 386 0
      components/kk-printer/printer/tsc.js
  22. 326 0
      components/kk-printer/utils/bluetoolth.js
  23. 171 0
      components/kk-printer/utils/util.js
  24. 118 0
      components/select/v-select.vue
  25. 32 0
      config/index.js
  26. 1380 0
      js_sdk/Sansnn-uQRCode/uqrcode.js
  27. 49 0
      js_sdk/dc-clipboard/clipboard.js
  28. 165 0
      js_sdk/u-charts/u-charts/component.vue
  29. 5662 0
      js_sdk/u-charts/u-charts/u-charts.js
  30. 0 0
      js_sdk/u-charts/u-charts/u-charts.min.js
  31. 26 14
      libs/axios.js
  32. 20 0
      libs/helper.js
  33. 112 0
      libs/printTools.js
  34. 100 58
      libs/tools.js
  35. 6 1
      libs/validate.js
  36. 25 11
      main.js
  37. 119 22
      manifest.json
  38. 21 0
      nativePlugins/Mpaas-Scan/ios/meta.config
  39. BIN=BIN
      nativePlugins/SMUniPlugin/ios/SMCameraScan.bundle/Info.plist
  40. BIN=BIN
      nativePlugins/SMUniPlugin/ios/SMCameraScan.bundle/icon_close.png
  41. BIN=BIN
      nativePlugins/SMUniPlugin/ios/SMCameraScan.bundle/icon_close@2x.png
  42. BIN=BIN
      nativePlugins/SMUniPlugin/ios/SMCameraScan.bundle/icon_close@3x.png
  43. BIN=BIN
      nativePlugins/SMUniPlugin/ios/SMCameraScan.bundle/icon_take_photo.png
  44. BIN=BIN
      nativePlugins/SMUniPlugin/ios/SMCameraScan.bundle/icon_take_photo@2x.png
  45. BIN=BIN
      nativePlugins/SMUniPlugin/ios/SMCameraScan.bundle/icon_take_photo@3x.png
  46. BIN=BIN
      nativePlugins/SMUniPlugin/ios/SMCameraScanPlugin.framework/Info.plist
  47. BIN=BIN
      nativePlugins/SMUniPlugin/ios/SMCameraScanPlugin.framework/SMCameraScanPlugin
  48. 0 21
      nativePlugins/SMUniPlugin/package.json
  49. BIN=BIN
      nativePlugins/uniplugin_camerascan/android/uniplugin_camerascan.aar
  50. 0 28
      nativePlugins/uniplugin_camerascan/package.json
  51. 6 1
      package-lock.json
  52. 3 2
      package.json
  53. 292 36
      pages.json
  54. 0 218
      pages/agreement/agreement.vue
  55. 0 186
      pages/cleared/index.vue
  56. 130 0
      pages/common/commonModal.vue
  57. 42 0
      pages/common/copyText.vue
  58. 107 0
      pages/common/customerSearch.vue
  59. 292 0
      pages/common/partList.vue
  60. 197 0
      pages/common/printTag/printTag.vue
  61. 174 0
      pages/common/productBrand.vue
  62. 207 0
      pages/common/productType.vue
  63. 142 25
      pages/index/index.vue
  64. 97 0
      pages/index/printAbc.vue
  65. 170 0
      pages/latePlay/chooseBulk.vue
  66. 249 0
      pages/latePlay/chooseProduct.vue
  67. 48 31
      pages/login/forget-pass.vue
  68. 54 36
      pages/login/login.scss
  69. 182 153
      pages/login/login.vue
  70. 0 153
      pages/login/pwLogin.vue
  71. 11 1
      pages/login/userAuthYs.vue
  72. 122 0
      pages/replenishmentManage/chooseTypeModal.vue
  73. 227 0
      pages/replenishmentManage/confirm.vue
  74. 164 0
      pages/replenishmentManage/detail.vue
  75. 164 0
      pages/replenishmentManage/manualPrint.vue
  76. 190 0
      pages/replenishmentManage/outWarehousing.vue
  77. 149 0
      pages/replenishmentManage/printStickerModal.vue
  78. 277 0
      pages/replenishmentManage/replenishmentList.vue
  79. 221 0
      pages/replenishmentManage/scanCodePrint.vue
  80. 304 0
      pages/replenishmentManage/sendOutGoods.vue
  81. 213 0
      pages/replenishmentManage/signWarehousing.vue
  82. 132 0
      pages/replenishmentManage/stockModal.vue
  83. 282 0
      pages/sales/addCustomer.vue
  84. 472 0
      pages/sales/addSales.vue
  85. 152 0
      pages/sales/chooseCustomer.vue
  86. 514 0
      pages/sales/chooseProduct.vue
  87. 128 0
      pages/sales/discountModal.vue
  88. 517 0
      pages/sales/edit.vue
  89. 237 0
      pages/sales/index.vue
  90. 145 0
      pages/sales/list.vue
  91. 277 0
      pages/sales/listComponent.vue
  92. 121 0
      pages/sales/orderInfoModal.vue
  93. 187 0
      pages/sales/productModal.vue
  94. 234 0
      pages/sales/productPricing.vue
  95. 294 0
      pages/sales/productSearch.vue
  96. 194 0
      pages/sales/salesSearch.vue
  97. 172 0
      pages/sales/search.vue
  98. 227 0
      pages/sales/selectedProductsModal.vue
  99. 214 0
      pages/shuntBackManage/cancellingStocks.vue
  100. 156 0
      pages/shuntBackManage/detail.vue

+ 24 - 0
.hbuilderx/launch.json

@@ -0,0 +1,24 @@
+{ // launch.json 配置了启动调试时相关设置,configurations下节点名称可为 app-plus/h5/mp-weixin/mp-baidu/mp-alipay/mp-qq/mp-toutiao/mp-360/
+  // launchtype项可配置值为local或remote, local代表前端连本地云函数,remote代表前端连云端云函数
+    "version": "0.0",
+    "configurations": [{
+     	"app-plus" : 
+     	{
+     		"launchtype" : "local"
+     	},
+     	"default" : 
+     	{
+     		"launchtype" : "local"
+     	},
+     	"h5" : 
+     	{
+     		"launchtype" : "local"
+     	},
+     	"mp-weixin" : 
+     	{
+     		"launchtype" : "local"
+     	},
+     	"type" : "uniCloud"
+     }
+    ]
+}

+ 189 - 16
App.vue

@@ -1,31 +1,29 @@
 <script>
-	const uat_URL = 'https://lese.test.sxzxyj.net/gc-channel/' // 预发布
-	// const uat_URL = 'http://192.168.16.102:8303/gc-channel/' // 本地
-	const pro_URL = 'https://lese.sxzxyj.net/gc-channel/'  // 生产
-	const buildType = 0 // 打包环境对应类型,1 生产 0 预发布
-	const buildURL = buildType ? pro_URL : uat_URL // 打包后实际对应的url
-	const envText = ['预发布环境','生产环境']
-	const envTips = process.env.NODE_ENV == 'development' ? envText[0] : envText[buildType]
-	console.log(process.env.NODE_ENV)
 	export default {
 		globalData: {  
-			baseUrl: process.env.NODE_ENV == 'development' ? uat_URL : buildURL,
+			baseUrl: '',
 			token: '',
+			changeOrg:'',
 			version: '', // 当前版本号
-			buildType: buildType,
-			envTips: envTips
+			buildType: 'uat', // 打包环境对应类型,pro 生产 uat 预发布 dev 本地开发
+			envTips: '', // 环境文字提示
+			theme: 'default', // 主题,default
+			isIphoneXup: false //是否iphonex以及以上的版本
 		},
 		mounted() {
 			// 非V3模式
-			if(this.$scope){
-				this.$scope.globalData.token = this.$store.state.vuex_token
-			}else{
+			if (this.$scope) {
+				this.$scope.globalData.token = this.$store.state.vuex_token;
+				this.$scope.globalData.changeOrg = this.$store.state.vuex_changeOrg;
+			} else {
 				// V3模式
-				getApp({allowDefault: true}).globalData.token = this.$store.state.vuex_token
+				getApp({ allowDefault: true }).globalData.token = this.$store.state.vuex_token;
+				getApp({ allowDefault: true }).globalData.changeOrg = this.$store.state.vuex_changeOrg;
 			}
+			this.$config('init');
 		},
 		onLaunch: function() {
-			 console.log('App onLaunch')
+			console.log('App launch')
 		},
 		onShow: function() {
 			console.log('App Show')
@@ -37,9 +35,11 @@
 </script>
 
 <style lang="scss">
+	@import "./static/iconfont/iconfont.css";
 	@import "uview-ui/index.scss";
 	/*每个页面公共css */
 	page {
+		width: 100%;
 		min-height: 100%;
 		display: flex;
 		background-color: #F8F8F8;
@@ -49,4 +49,177 @@
 		width: 24upx !important;
 		height: 24upx !important;
 	}
+	.status_bar {
+	      height: var(--status-bar-height);
+	      width: 100%;
+	  }
+	.isIPXup{
+		padding-bottom: 64rpx !important;
+	}
+	/*  form表单样式 */
+	.form-box{
+		background-color: #fff;
+		padding: 0 30rpx;
+	}
+	.form-input {
+		font-size: 28rpx;
+		color: #333;
+		text-align: right;
+		width: 95%;
+		box-sizing: border-box;
+		height: 60rpx;
+		line-height: 60rpx;
+		&.textarea{
+			height: 240rpx;
+			padding: 24rpx 0;
+			text-align: left;
+		}
+	}
+	
+	.form-input-placeholder {
+		font-size: 28rpx;
+		color: #999;
+	}
+	.form-textarea{
+		height: 240rpx;
+		padding: 24rpx 0;
+		text-align: left;
+	}
+	.form-number-input{
+		margin: 0 auto;
+	}
+	.u-required{
+		position: relative;
+	}
+	.u-required:before{
+		content: '*';
+		position: absolute;
+		left: -8px;
+		top: 10upx;
+		font-size: 14px;
+		color: #fa3534;
+		height: 9px;
+		line-height: 1;
+	}
+	/* 元素宽度 百分比 */
+	.uni-col-1{
+		box-sizing: border-box;
+		width: 10%;
+	}
+	.uni-col-2{
+		box-sizing: border-box;
+		width: 20%;
+	}
+	.uni-col-3{
+		box-sizing: border-box;
+		width: 30%;
+	}
+	.uni-col-4{
+		box-sizing: border-box;
+		width: 40%;
+	}
+	.uni-col-5{
+		box-sizing: border-box;
+		width: 50%;
+	}
+	.uni-col-6{
+		box-sizing: border-box;
+		width: 60%;
+	}
+	.uni-col-7{
+		box-sizing: border-box;
+		width: 70%;
+	}
+	.uni-col-8{
+		box-sizing: border-box;
+		width: 80%;
+	}
+	.uni-col-9{
+		box-sizing: border-box;
+		width: 90%;
+	}
+	.uni-col-10{
+		box-sizing: border-box;
+		width: 100%;
+	}
+	
+	/* felx布局 */
+	.flex{
+		display: -webkit-flex; /* Chrome 21+, Safari 6.1+, iOS Safari 7+, Opera 15/16 */  
+		display: -moz-flex; /* Firefox 18+ */  
+		display: -ms-flexbox; /* IE 10 */  
+		display: flex; /* Chrome 29+, Firefox 22+, IE 11+, Opera 12.1/17/18, Android 4.4+ */
+	}
+	/*伸缩流方向*/
+	.flex_column{
+	    -webkit-box-orient: vertical;
+	    -ms-flex-direction: column;
+	    -webkit-flex-direction: column;
+	    flex-direction: column;
+	}
+	/*主轴对齐*/
+	.justify_center{
+	    -webkit-box-pack: center;
+	    -ms-flex-pack: center;
+	    -webkit-justify-content: center;
+	    justify-content: center;
+	}
+	.justify_end{
+	    -webkit-box-pack: end;
+	    -ms-flex-pack: end;
+	    -webkit-justify-content: flex-end;
+	    justify-content: flex-end;
+	}
+	.justify_between{
+	    -webkit-box-pack: justify;
+	    -ms-flex-pack: justify;
+	    -webkit-justify-content: space-between;
+	    justify-content: space-between;
+	}
+	/*侧轴对齐*/
+	.align_start{
+	    -webkit-box-align: start;
+	    -ms-flex-align: start;
+	    -webkit-align-items: flex-start;
+	    align-items: flex-start;
+	}
+	.align_end{
+	    -webkit-box-align: end;
+	    -ms-flex-align: end;
+	    -webkit-align-items: flex-end;
+	    align-items: flex-end;
+	}
+	.align_center{
+	    -webkit-box-align: center;
+	    -ms-flex-align: center;
+	    -webkit-align-items: center;
+	    align-items: center;
+	}
+	.align_baseline{
+	    -webkit-box-align: baseline;
+	    -ms-flex-align: baseline;
+	    -webkit-align-items: baseline;
+	    align-items: baseline;
+	}
+	/*伸缩性*/
+	.flex_auto{
+	    -webkit-box-flex: 1;
+	    -ms-flex: auto;
+	    -webkit-flex: auto;
+	    flex: auto;
+	}
+	.flex_1{
+	    -webkit-box-flex: 1;
+	    -ms-flex: 1;
+	    -webkit-flex: 1;
+	    flex: 1;    
+	}
+	// ios15原生input的type=search时会默认自带搜索图标。
+	// 在全局的公共样式隐藏ios自带搜索图标即可
+	[type="search"]::-webkit-search-decoration {
+		display: none;
+	}
+	uni-toast {
+		z-index: 1000000;
+	}
 </style>

+ 55 - 0
api/customer.js

@@ -0,0 +1,55 @@
+import axios from '@/libs/axios.js'
+
+// 客户列表
+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'
+	})
+}
+
+// 新增客户
+export const custSave = (params) => {
+  return axios.request({
+    url: 'cust/save',
+    data: params,
+    method: 'post'
+  })
+} 
+// 根据sn修改客户信息
+export const updateByCustomerSn = params => {
+  return axios.request({
+    url: 'cust/updateByCustomerSn',
+    data: params,
+    method: 'post'
+  })
+}
+ // 客户详情
+export const customerDetail = params => {
+  return axios.request({
+    url: `cust/findById/${params.id}`,
+    data: {},
+    method: 'get'
+  })
+}

+// 客户类型
+export const custType = (params) => {
+  return axios.request({
+    url: 'custType/findAll',
+    data: params,
+    method: 'post'
+  })
+} 
+
+// 业务员
+export const employeeAllList = (params) => {
+  return axios.request({
+    url: 'employee/queryList',
+    data: {},
+    method: 'post'
+  })
+}

+ 54 - 2
api/data.js

@@ -1,8 +1,60 @@
 import axios from '@/libs/axios.js';
 // 根据字典code查询选项
+// export const getLookUpDatas = (params) => {
+//   return axios.request({
+//     url: `lookup/findByLookup/${params.type}`,
+//     method: 'get'
+//   })
+// }
 export const getLookUpDatas = (params) => {
+  const url = `lookupItem/query/${params.pageNo}/${params.pageSize}`
+  delete params.pageNo
+  delete params.pageSize
   return axios.request({
-    url: `lookup/findByLookup/${params.type}`,
-    method: 'get'
+    url: url,
+    data: params,
+    method: 'post'
+  })
+}
+export const listLookUp = (params) => {
+  const url = `/lookup/queryLike`
+  return axios.request({
+    url: url,
+    method: 'POST'
+  }).then(res => res)
+}
+// export const listLookUp = (params) => {
+//   let url = `lookup/findAll`
+//   return axios.request({
+//     url: url,
+//     method: 'post'
+//   }).then(res => res)
+// }
+// 查询最新版本信息
+export const getSysVersion = (params) => {
+  return axios.request({
+    url: `sysVersion/getLatest`,
+    method: 'post',
+	data: {applyCode:'jgqp',versionType: params.versionType}
+  }, true)
+}
+// 数据字典
+export const getLookUpItem = (params) => {
+  let url = `lookupItem/query/${params.pageNo}/${params.pageSize}`
+  delete params.pageNo
+  delete params.pageSize
+  return axios.request({
+    url: url,
+    data: params,
+    method: 'post'
+  })
+}
+
+// 查询省市区
+export const getArea = (params) => {
+  return axios.request({
+    url: `area/queryList`,
+    data: params,
+    method: 'post'
   })
 }

+ 11 - 0
api/dealerProductBrand.js

@@ -0,0 +1,11 @@
+import axios from '@/libs/axios.js'
+
+//  产品品牌列表  无分页
+export const dealerProductBrandQuery = (params) => {
+  const url = `dealerProductBrand/queryList`
+  return axios.request({
+    url: url,
+    data: params,
+    method: 'post'
+  })
+}

+ 11 - 0
api/dealerProductType.js

@@ -0,0 +1,11 @@
+import axios from '@/libs/axios.js'
+
+//  产品分类 列表  无分页
+export const dealerProductTypeList = (params) => {
+  const url = `dealerProductType/query`
+  return axios.request({
+    url: url,
+    data: params,
+    method: 'post'
+  })
+}

+ 0 - 43
api/login.js

@@ -1,43 +0,0 @@
-import axios from '@/libs/axios.js';
-
-export const login = params => {
-  return axios.request({
-    url: `login`,
-    method: 'post',
-	data: params
-  },true)
-};
-export const logout = params => {
-  return axios.request({
-    url: `logout`,
-    data: params,
-    method: 'get'
-  })
-};
-
-// 验证是否登录过
-export const checkLogin = () => {
-  let token = getApp().globalData.token
-  if (token&&token!='') {
-    return axios.request({
-      url: `checkToken`,
-      method: 'get'
-    })
-  } else {
-    return new Promise(resolve => {
-      resolve({
-        status: '9001',
-        message: '系统未登录'
-      });
-    });
-  }
-};
-
-// 获取登录用户信息
-export const getUserInfo = params => {
-  return axios.request({
-    url: `customer/getDetail`,
-    data: params,
-    method: 'get'
-  })
-};

+ 166 - 0
api/sales.js

@@ -0,0 +1,166 @@
+import axios from '@/libs/axios.js'
+
+// 数据统计信息
+export const bizData = (params) => {
+  return axios.request({
+    url: `home/queryBizData`,
+    data: params,
+    method: 'post'
+  })
+}
+
+// 销售单列表
+export const salesList = (params) => {
+  const url = `sales/queryPage/${params.pageNo}/${params.pageSize}`
+  delete params.pageNo
+  delete params.pageSize
+  return axios.request({
+    url: url,
+    data: params,
+    method: 'post'
+  })
+}
+//  销售 审核
+export const salesWriteAudit = (params) => {
+  return axios.request({
+    url: 'sales/audit',
+    data: params,
+    method: 'post'
+  })
+}
+//  销售 出库
+export const salesWriteStockOut = (params) => {
+  return axios.request({
+    url: `sales/stockOut/${params.salesBillSn}`,
+    method: 'get'
+  })
+}
+//  销售 提交
+export const salesSubmit = (params) => {
+  return axios.request({
+    url: 'sales/submit',
+    data: params,
+    method: 'post'
+  })
+}
+//  销售 折扣
+export const salesDiscount = (params) => {
+  return axios.request({
+    url: 'sales/discount',
+    data: params,
+    method: 'post'
+  })
+}
+//  销售 详情
+export const salesDetail = (params) => {
+  return axios.request({
+    url: `sales/findById/${params.id}`,
+    data: params,
+    method: 'get'
+  })
+}
+//  销售 详情bysn
+export const salesDetailBySn = (params) => {
+  return axios.request({
+    url: `sales/findBySn`,
+    data: params,
+    method: 'post'
+  })
+}
+//  销售 删除
+export const salesDel = (params) => {
+  return axios.request({
+    url: `sales/delete/${params.id}`,
+    data: params,
+    method: 'post'
+  })
+}
+// 车架号
+export const supperCodeByVin = (params) => {
+  return axios.request({
+    url: `vinIdentify/queryPartCodeByVin/${params.vin}`,
+    method: 'get'
+  })
+}
+//  销售详情 列表  分页
+export const salesDetailList = (params) => {
+  const url = `salesDetail/queryPage/${params.pageNo}/${params.pageSize}`
+  delete params.pageNo
+  delete params.pageSize
+  return axios.request({
+    url: url,
+    data: params,
+    method: 'post'
+  })
+}
+//  销售详情 删除
+export const salesDetailDel = (params) => {
+  return axios.request({
+    url: `salesDetail/delete/${params.id}`,
+    method: 'get'
+  })
+}
+//  销售详情 新增配件
+export const salesDetailInsert = (params) => {
+  return axios.request({
+    url: 'salesDetail/insert',
+    data: params,
+    method: 'post'
+  })
+}
+//  销售详情 编辑已选产品信息
+export const salesDetailUpdate = (params) => {
+  return axios.request({
+    url: 'salesDetail/update',
+    data: params,
+    method: 'post'
+  })
+}
+// 销售单新增
+export const salesSave = (params) => {
+  const url = 'sales/save'
+  return axios.request({
+    url: url,
+    data: params,
+    method: 'post'
+  })
+}
+//  仓库列表  无分页
+export const warehouseAllList = (params) => {
+  const url = 'warehouse/queryList'
+  return axios.request({
+    url: url,
+    data: params,
+    method: 'post'
+  })
+}
+// 车架号  识别图片内容
+export const vinCodeParse = params => {
+  return axios.request({
+    url: `vinIdentify/ocr`,
+    method: 'post',
+    data: params,
+    responseType: 'blob'
+  })
+}
+
+// 产品报价列表
+export const dealerProductList = (params) => {
+  const url = `dealerProduct/queryPageForSalesOffer/${params.pageNo}/${params.pageSize}`
+  delete params.pageNo
+  delete params.pageSize
+  return axios.request({
+    url: url,
+    data: params,
+    method: 'post'
+  })
+}
+//  结算方式列表
+export const settleStyleQueryAll = (params) => {
+  return axios.request({
+    url: 'settleStyle/findAll',
+    data: params,
+    method: 'post'
+  })
+}
+

+ 40 - 0
api/shelf.js

@@ -0,0 +1,40 @@
+import axios from '@/libs/axios.js'
+
+// 货架分页列表
+export const getShelfList = (params) => {
+	let url = `shelf/queryPage/${params.pageNo}/${params.pageSize}`
+	delete params.pageNo
+	delete params.pageSize
+	return axios.request({
+		url: url,
+		data: params,
+		method: 'post'
+	})
+}
+//  货架  货位产品 列表 不分页
+export const shelfProductList = (params) => {
+  return axios.request({
+    url: `shelf/placeProduct/queryList`,
+    data: params,
+    method: 'post'
+  })
+}
+//  货架  详情
+export const shelfDetail = (params) => {
+  return axios.request({
+    url: `shelf/queryBySn/${params.sn}`,
+    data: params,
+    method: 'post'
+  })
+}
+// 货架  货位产品 列表 分页
+export const getShelfProductList = (params) => {
+	let url = `shelf/placeProduct/queryPage/${params.pageNo}/${params.pageSize}`
+	delete params.pageNo
+	delete params.pageSize
+	return axios.request({
+		url: url,
+		data: params,
+		method: 'post'
+	})
+}

+ 52 - 0
api/shelfRecall.js

@@ -0,0 +1,52 @@
+import axios from '@/libs/axios.js'
+
+// 分页查询调回单列表
+export const shelfRecallList = (params) => {
+	let url = `shelfRecall/queryPage/${params.pageNo}/${params.pageSize}`
+	delete params.pageNo
+	delete params.pageSize
+	return axios.request({
+		url: url,
+		data: params,
+		method: 'post'
+	})
+}
+// 查询调回单信息
+export const shelfRecallFindBySn = (params) => {
+	return axios.request({
+		url: `shelfRecall/findBySn/${params.sn}`,
+		method: 'get'
+	})
+}
+// 查询调回单详情列表
+export const detailQueryCount = (params) => {
+	return axios.request({
+		url: `shelfRecall/detail/queryCount`,
+		data: params,
+		method: 'post'
+	})
+}
+// 查询调回单详情列表
+export const shelfRecallDetail = (params) => {
+	return axios.request({
+		url: `shelfRecall/detail/queryList`,
+		data: params,
+		method: 'post'
+	})
+}
+// 确认调回
+export const shelfRecallConfirm = (params) => {
+	return axios.request({
+		url: `shelfRecall/confirm`,
+		data: params,
+		method: 'post'
+	})
+}
+// 查询每个状态的数据条数
+export const queryStateCount = (params) => {
+	return axios.request({
+		url: `shelfRecall/queryStateCount`,
+		data: params,
+		method: 'post'
+	})
+}

+ 95 - 0
api/shelfReplenish.js

@@ -0,0 +1,95 @@
+import axios from '@/libs/axios.js'
+
+// 补货单  列表
+export const shelfReplenishList = (params) => {
+	let url = `shelfReplenish/queryPage/${params.pageNo}/${params.pageSize}`
+	delete params.pageNo
+	delete params.pageSize
+	return axios.request({
+		url: url,
+		data: params,
+		method: 'post'
+	})
+}
+//  补货单  详情
+export const shelfReplenishDetail = (params) => {
+  const url = `shelfReplenish/findBySn/${params.sn}`
+  delete params.sn
+  return axios.request({
+    url: url,
+    data: params,
+    method: 'get'
+  })
+}
+//  补货单 明细列表 不分页
+export const shelfReplenishDetailList = (params) => {
+  return axios.request({
+    url: 'shelfReplenish/detail/queryList',
+    data: params,
+    method: 'post'
+  })
+}
+//  补货单 检查补货单库存数量
+export const shelfReplenishDetailStock = (params) => {
+  return axios.request({
+    url: 'shelfReplenish/detail/checkDetailStockQty',
+    data: params,
+    method: 'post'
+  })
+}
+//  补货单 确认补货
+export const shelfReplenishConfirm = (params) => {
+  return axios.request({
+    url: 'shelfReplenish/confirm',
+    data: params,
+    method: 'post'
+  })
+}
+//  补货单 确认签收
+export const shelfReplenishPutStock = (params) => {
+  return axios.request({
+    url: 'shelfReplenish/putStock',
+    data: params,
+    method: 'post'
+  })
+}
+//  补货单 打印贴签
+export const shelfReplenishPrintSign = (params) => {
+  return axios.request({
+    url: 'shelfReplenish/detail/printSign',
+    data: params,
+    method: 'post'
+  })
+}
+//  补货单 根据条形码获取产品详情
+export const shelfReplenishQrCode = (params) => {
+  return axios.request({
+    url: 'shelfReplenish/detail/queryByProductQrCode',
+    data: params,
+    method: 'post'
+  })
+}
+//  补货单 查询每个状态的数据条数
+export const shelfReplenishStateCount = (params) => {
+  return axios.request({
+    url: 'shelfReplenish/queryStateCount',
+    data: params,
+    method: 'post'
+  })
+}
+//  补货单 扫描条形码 记录是否扫描
+export const shelfReplenishDetailOutScan = (params) => {
+  return axios.request({
+    url: 'shelfReplenish/detail/outScan',
+    data: params,
+    method: 'post'
+  })
+}
+//  补货单 出库
+export const shelfReplenishOutStock = (params) => {
+  return axios.request({
+    url: 'shelfReplenish/outStock',
+    data: params,
+    method: 'post'
+  })
+}

+ 63 - 0
api/stock.js

@@ -0,0 +1,63 @@
+import axios from '@/libs/axios.js'
+
+//  库存列表  分页
+export const stockList = (params) => {
+  const url = `stock/queryPage/${params.pageNo}/${params.pageSize}`
+  delete params.pageNo
+  delete params.pageSize
+  return axios.request({
+    url: url,
+    data: params,
+    method: 'post'
+  })
+}
+//  库存 列表 合计
+export const stockCount = (params) => {
+  return axios.request({
+    url: 'stock/queryCount',
+    data: params,
+    method: 'post'
+  })
+}
+//  库存 详情列表  分页
+export const stockDetailList = (params) => {
+  const url = `stock/detail/queryPage/${params.pageNo}/${params.pageSize}`
+  delete params.pageNo
+  delete params.pageSize
+  return axios.request({
+    url: url,
+    data: params,
+    method: 'post'
+  })
+}
+//  库存流水(出入库明细) 列表  有分页
+export const stockFlowList = (params) => {
+  const url = `stockFlow/queryPage/${params.pageNo}/${params.pageSize}`
+  delete params.pageNo
+  delete params.pageSize
+  return axios.request({
+    url: url,
+    data: params,
+    method: 'post'
+  })
+}
+//  库存 详情列表  分页
+export const querySumByProductLocation = (params) => {
+  const url = `stock/detail/querySumByProductLocation/${params.pageNo}/${params.pageSize}`
+  delete params.pageNo
+  delete params.pageSize
+  return axios.request({
+    url: url,
+    data: params,
+    method: 'post'
+  })
+}
+//  出入库明细  列表  合计
+export const stockByProductSn = (params) => {
+  const url = `stock/findByProductSn/${params.productSn}`
+  return axios.request({
+    url: url,
+    data: params,
+    method: 'post'
+  })
+}

+ 14 - 13
api/user.js

@@ -3,13 +3,21 @@ import axios from '@/libs/axios.js'
 //  axios.request()  第二个参数若为true则表示不传token
 
 // 登录
-export const login = (params) => {
+export const login = params => {
   return axios.request({
-    url: 'login',
+    url: `auth/login`,
+    method: 'post',
+	data: params
+  },true)
+};
+// 退出
+export const logout = params => {
+  return axios.request({
+    url: `auth/logout`,
     data: params,
-    method: 'post'
-  }, true)
-}
+    method: 'get'
+  })
+};
 //  校验手机号是否注册
 export const validateUser = params => {
   return axios.request({
@@ -48,17 +56,10 @@ export const getStore = (token) => {
     method: 'get'
   })
 }
-// 登出
-export const logout = () => {
-  return axios.request({
-    url: 'logout',
-    method: 'get'
-  })
-}
 // 修改密码
 export const changePwd = params => {
   return axios.request({
-    url: 'user/updatePwd',
+    url: 'user/changePWD',
     method: 'post',
     data: {
       oldPassword: params.oldPassword,

+ 447 - 0
components/address.vue

@@ -0,0 +1,447 @@
+<template>
+	<view class="simple-address" v-if="showPopup">
+		<!-- 遮罩层 -->
+		<view
+			class="simple-address-mask"
+			v-if="maskClick"
+			:class="[ani + '-mask', animation ? 'mask-ani' : '']"
+			:style="{
+				'background-color': maskBgColor
+			}"
+			@tap="hideMask(true)"
+		></view>
+		
+		<!-- 省市区 -->
+		<view class="simple-address-content simple-address--fixed" :class="[type, ani + '-content', animation ? 'content-ani' : '']">
+			<view class="simple-address__header">
+				<view class="simple-address__header-text" @click="pickerCancel">
+					<text class="cancel-btn" :style="{ color: cancelColor, fontSize: btnFontSize }">取消</text>
+				</view>
+				<view class="simple-address__header-btn-box" @click="pickerConfirm">
+					<text class="simple-address__header-text" :style="{ color: confirmColor, fontSize: btnFontSize }">确定</text>
+				</view>
+			</view>
+			<view class="simple-address__box">
+				<picker-view class="simple-address-view" :value="pickerValue" @change="pickerChange">
+					<picker-view-column>
+						<!-- #ifndef APP-NVUE -->
+						<view class="picker-item" :style="{ fontSize: fontSize }" v-for="(item, index) in provinceDataList" :key="index">{{ item.name }}</view>
+						<!-- #endif -->
+						<!-- #ifdef APP-NVUE -->
+						<text class="picker-item" :style="{ fontSize: fontSize }" v-for="(item, index) in provinceDataList" :key="index">{{ item.name }}</text>
+						<!-- #endif -->
+					</picker-view-column>
+					<picker-view-column>
+						<!-- #ifndef APP-NVUE -->
+						<view class="picker-item" :style="{ fontSize: fontSize }" v-for="(item, index) in cityDataList" :key="index">{{ item.name }}</view>
+						<!-- #endif -->
+						<!-- #ifdef APP-NVUE -->
+						<text class="picker-item" :style="{ fontSize: fontSize }" v-for="(item, index) in cityDataList" :key="index">{{ item.name }}</text>
+						<!-- #endif -->
+					</picker-view-column>
+					<picker-view-column>
+						<!-- #ifndef APP-NVUE -->
+						<view class="picker-item" :style="{ fontSize: fontSize }" v-for="(item, index) in areaDataList" :key="index">{{ item.name }}</view>
+						<!-- #endif -->
+						<!-- #ifdef APP-NVUE -->
+						<text class="picker-item" :style="{ fontSize: fontSize }" v-for="(item, index) in areaDataList" :key="index">{{ item.name }}</text>
+						<!-- #endif -->
+					</picker-view-column>
+				</picker-view>
+			</view>
+		</view>
+		
+	</view>
+</template>
+
+<script>
+	import { getProvince, getCityByPro, getDistrictByCity } from '@/api/data.js'
+	import {getArea} from '@/api/data.js'
+	export default{
+		name: 'Address',
+		props: {
+			// 是否允许点击遮罩层关闭
+			maskClick: {
+				type: Boolean,
+				default: true
+			},
+			// 是否开启动画
+			animation: {
+				type: Boolean,
+				default: true
+			},
+			//  遮罩层背景颜色
+			maskBgColor: {
+				type: String,
+				default: 'rgba(0, 0, 0, 0.4)' //背景颜色 rgba(0, 0, 0, 0.4) 为空则调用 uni.scss
+			},
+			/* 弹出层类型,可选值;  暂时只支持底部弹出
+					bottom:底部弹出层
+				*/
+			type: {
+				type: String,
+				default: 'bottom'
+			},
+			cancelColor: {
+				type: String,
+				default: '' // 取消按钮颜色
+			},
+			confirmColor: {
+				type: String,
+				default: '' // 确认按钮颜色
+			},
+			fontSize: {
+				type: String,
+				default: '28rpx' // picker-item字体大小
+			},
+			btnFontSize: {
+				type: String,
+				default: '' // 按钮的字体大小
+			},
+		},
+		data(){
+			return{
+				showPopup: false,  //  是否显示省市区选择
+				ani: '',
+				pickerValue: [0, 0, 0],  //  默认值下标
+				pickerId: [],  //  省市区默认值id
+				provinceDataList: [],  //  省数据列表
+				cityDataList: [],  //  市数据列表
+				areaDataList: [],  //  区数据列表
+				isFirst: false,  //  是否首次进入组件
+			}
+		},
+		methods: {
+			//  初始化
+			init(){
+				this.provinceDataList = []
+				this.cityDataList = []
+				this.areaDataList = []
+				this.isFirst = false
+			},
+			//  点击遮罩层关闭选择省市区
+			hideMask() {
+				this._$emit('onCancel')
+				this.close()
+			},
+			//  打开省市区picker
+			open(idArr) {
+				//  初始化数据
+				this.init()
+				this.pickerId = idArr
+				//  idArr 省市区默认id
+				if(this.pickerId && this.pickerId.length > 0){
+					//  获取省下拉
+					this.getProvinceList(idArr)
+				}else{
+					//  获取省下拉
+					this.getProvinceList()
+				}
+				this.showPopup = true
+				this.$nextTick(() => {
+					setTimeout(() => {
+						this.ani = 'simple-' + this.type
+					}, 100)
+				});
+			},
+			//  关闭省市区picker
+			close(type) {
+				if (!this.maskClick && type) return
+				this.ani = ''
+				this.$nextTick(() => {
+					setTimeout(() => {
+						this.showPopup = false
+					}, 300)
+				})
+			},
+			//  取消按钮
+			pickerCancel() {
+				this._$emit('onCancel')
+				this.close()
+			},
+			//  确定按钮
+			pickerConfirm() {
+				this._$emit('onConfirm')
+				if(!this.isFirst){
+					//  首次
+					this.isFirst = true
+				}
+				this.close()
+			},
+			//  省市区  change
+			pickerChange(e) {
+				const _this = this
+				let changePickerValue = e.detail.value
+				console.log(changePickerValue,'changePickerValue')
+				if (this.pickerValue[0] !== changePickerValue[0]) {
+					if(this.pickerId && this.pickerId.length > 0 && this.isFirst){
+						//  获取市下拉
+						this.getCityList(this.pickerId[0], this.pickerId)
+					}else{
+						// 第一级发生滚动,省 change重置市区下拉数据
+						this.getCityList(this.provinceDataList[changePickerValue[0]].id)
+						changePickerValue[1] = 0
+						changePickerValue[2] = 0
+					}
+				} else if (this.pickerValue[1] !== changePickerValue[1]) {
+					if(this.pickerId && this.pickerId.length > 0 && this.isFirst){
+						//  获取市下拉
+						this.getAreaList(this.pickerId[1], this.pickerId)
+					}else{
+						// 第二级滚动,市 change重置区县下拉数据
+						this.getAreaList(this.cityDataList[changePickerValue[1]].id)
+						changePickerValue[2] = 0
+					}
+				}
+				this.pickerValue = changePickerValue
+				//  setTimeout解决由于省市区接口请求数据有延缓导致获值报错
+				setTimeout(()=>{
+					_this._$emit('onChange')
+				},1000)
+			},
+			_$emit(emitName) {
+				let pickObj = {
+					label: this._getLabel(),
+					value: this.pickerValue,
+					cityCode: this._getCityCode(),
+					areaCode: this._getAreaCode(),
+					provinceCode: this._getProvinceCode(),
+					labelArr: this._getLabel().split('-')
+				}
+				this.$emit(emitName, pickObj)
+			},
+			_getLabel() {
+				//  name报错未发现页面影响(由于省市区接口请求数据延缓)
+				let pcikerLabel =
+					this.provinceDataList[this.pickerValue[0]].name + '-' + this.cityDataList[this.pickerValue[1]].name + '-' + this.areaDataList[this.pickerValue[2]].name
+				return pcikerLabel
+			},
+			_getCityCode() {
+				return this.cityDataList[this.pickerValue[1]].id
+			},
+			_getProvinceCode() {
+				return this.provinceDataList[this.pickerValue[0]].id
+			},
+			_getAreaCode() {
+				return this.areaDataList[this.pickerValue[2]].id
+			},
+			//  获取省下拉数据
+			getProvinceList(idArr){
+				const _this = this
+				getArea({type:"2"}).then(res => {
+				  if (res.code == 200 || res.status == 204 || res.status == 200) {
+				    _this.provinceDataList = res.data || []  //  省下拉数据
+					//  判断是否有默认值
+					if(idArr){
+						_this.getCityList(idArr[0], idArr)
+						_this.getAreaIndArr(idArr)
+					}else{
+						//  默认省数据第一条下的市下拉数据
+						_this.getCityList(_this.provinceDataList[0].id)
+					}
+					
+				  } else {
+				    _this.provinceDataList = []
+				  }
+				})
+			},
+			// 获取城市列表
+			getCityList (val, idArr) {
+				const _this = this
+				_this.cityDataList = []
+				_this.areaDataList = []
+				if (val != null && val != '') {
+					getArea({parentId: val,type:3}).then(res => {
+						if (res.code == 200 || res.status == 204 || res.status == 200) {
+							_this.cityDataList = res.data || []  //  市下拉数据
+							//  判断是否有默认值
+							if(idArr){
+								_this.getAreaList(idArr[1], idArr)
+								_this.getAreaIndArr(idArr)
+							}else{
+								//  默认市数据第一条下的区县下拉数据
+								_this.getAreaList(_this.cityDataList[0].id)
+							}
+						} else {
+							_this.cityDataList = []
+						}
+					})
+				}
+			},
+			// 获取区县列表
+			getAreaList (val, idArr) {
+				const _this = this
+				this.areaDataList = []
+				if (val != null && val != '') {
+					getArea({parentId: val,type:4}).then(res => {
+						if (res.code == 200 || res.status == 204 || res.status == 200) {
+							_this.areaDataList = res.data || []
+							//  判断是否有默认值
+							if(idArr){ _this.getAreaIndArr(idArr) }
+						} else {
+							_this.areaDataList = []
+						}
+					})
+				}
+			},
+			//  根据id 获取省市区 下标值
+			getAreaIndArr(idArr){
+				const _this = this
+				const provinceInd = _this.provinceDataList.findIndex(res => res['id'] == idArr[0])
+				const cityInd = _this.cityDataList.findIndex(res => res['id'] == idArr[1])
+				const districtInd = _this.areaDataList.findIndex(res => res['id'] == idArr[2])
+				setTimeout(()=>{
+					_this.pickerValue = [provinceInd, cityInd, districtInd]
+				},100)
+				// console.log(_this.pickerValue,'_this.pickerValue')
+			}
+		}
+	}
+</script>
+
+<style lang="scss" scoped>
+.simple-address {
+	/* #ifndef APP-NVUE */
+	display: flex;
+	/* #endif */
+	flex-direction: column;
+}
+
+.simple-address-mask {
+	position: fixed;
+	bottom: 0;
+	top: 0;
+	left: 0;
+	right: 0;
+
+	transition-property: opacity;
+	transition-duration: 0.3s;
+	opacity: 0;
+	/* #ifndef APP-NVUE */
+	z-index: 99999;
+	/* #endif */
+}
+
+.mask-ani {
+	transition-property: opacity;
+	transition-duration: 0.2s;
+}
+
+.simple-bottom-mask {
+	opacity: 1;
+}
+
+.simple-center-mask {
+	opacity: 1;
+}
+
+.simple-address--fixed {
+	position: fixed;
+	bottom: 0;
+	left: 0;
+	right: 0;
+	width: 100%;
+	transition-property: transform;
+	transition-duration: 0.3s;
+	transform: translateY(460rpx);
+	/* #ifndef APP-NVUE */
+	z-index: 999999;
+	/* #endif */
+}
+
+.simple-address-content {
+	background-color: #ffffff;
+}
+
+.simple-content-bottom {
+	bottom: 0;
+	left: 0;
+	right: 0;
+	transform: translateY(500rpx);
+}
+
+.content-ani {
+	transition-property: transform, opacity;
+	transition-duration: 0.2s;
+}
+
+.simple-bottom-content {
+	transform: translateY(0);
+}
+
+.simple-center-content {
+	transform: scale(1);
+	opacity: 1;
+}
+
+.simple-address__header {
+	position: relative;
+	/* #ifndef APP-NVUE */
+	display: flex;
+	/* #endif */
+	flex-direction: row;
+	flex-wrap: nowrap;
+	justify-content: space-between;
+	border-bottom-color: #f2f2f2;
+	border-bottom-style: solid;
+	border-bottom-width: 1rpx;
+}
+
+.simple-address--fixed-top {
+	/* #ifndef APP-NVUE */
+	display: flex;
+	/* #endif */
+	flex-direction: row;
+	justify-content: space-between;
+	border-top-color: $uni-border-color;
+	border-top-style: solid;
+	border-top-width: 1rpx;
+}
+
+.simple-address__header-btn-box {
+	/* #ifndef APP-NVUE */
+	display: flex;
+	/* #endif */
+	flex-direction: row;
+	align-items: center;
+	justify-content: center;
+	height: 70rpx;
+}
+.cancel-btn{
+	color: #888;
+}
+.simple-address__header-text {
+	text-align: center;
+	font-size: $uni-font-size-base;
+	color: #2979ff;
+	font-size: 17px;
+	line-height: 70rpx;
+	padding-left: 40rpx;
+	padding-right: 40rpx;
+}
+
+.simple-address__box {
+	position: relative;
+}
+
+.simple-address-view {
+	position: relative;
+	bottom: 0;
+	left: 0;
+	/* #ifndef APP-NVUE */
+	width: 100%;
+	/* #endif */
+	/* #ifdef APP-NVUE */
+	width: 750rpx;
+	/* #endif */
+	height: 408rpx;
+	background-color: rgba(255, 255, 255, 1);
+}
+
+.picker-item {
+	text-align: center;
+	line-height: 70rpx;
+	text-overflow: ellipsis;
+	font-size: 28rpx;
+}
+</style>

+ 117 - 0
components/icon-items-list/icon-items-list.vue

@@ -0,0 +1,117 @@
+<template>
+	<div class="icon-items-list" :class="'icon-items-list-'+type">
+		<div class="icon-items-icons" v-for="(item,index) in list" :key="item.id" :style="{width:itemWidth}" @click="toPage(item,index)">
+			<image class="icon-items-imgse" :class="item.auth?'':'uni-img-gray'" :fade-show='true' :src="item.icon+'?x-oss-process=image/resize,m_fixed,h_140,w_215,color_ffffff'"></image>
+			<div class="icon-items-text">{{item.name.slice(0,14)}}</div>
+			<u-badge type="error" :count="item.count" :offset="[-10,30]"></u-badge>
+		</div>
+		<div class="nodata" v-if="list.length==0">
+			<u-empty :text="noDataText" mode="list"></u-empty>
+		</div>
+	</div>
+</template>
+
+<script>
+	export default {
+		name: "iconItemsList",
+		props:{
+			// 套餐服务项 或配件id
+			list:{
+				type: Array,
+				default: function(){
+					return []
+				}
+			},
+			itemWidth: {
+				type: String,
+				default: '25%'
+			},
+			type: {
+				type: String,
+				default: 'icon'
+			},
+			noDataText: {
+				type: String,
+				default: '暂无数据'
+			}
+		},
+		data() {
+			return {
+				datas: this.list
+			}
+		},
+		methods: {
+			toPage(item,index){
+				if(!item.auth){
+					uni.showToast({icon: 'none',title: '你无权限操作此功能'})
+					return
+				}
+				if(item.url&&item.url!=''){
+					if(item.target == 'page'){
+						// console.log(item.url)
+						// 生意经
+						if(this.type=="knowledge"){
+							this.$store.state.vuex_knowledgePageNo = index
+						}
+						uni.navigateTo({
+							url: item.url
+						})
+					}
+					if(item.target == 'tabPage'){
+						uni.switchTab({
+							url: item.url
+						})
+					}
+					if(item.target == 'fun'){
+						item.url()
+					}
+				}
+			}
+		}
+	}
+</script>
+
+<style lang="less">
+	.icon-items-list{
+		align-items: center;
+		display: flex;
+		flex-wrap: wrap;
+		.nodata{
+			text-align: center;
+			font-size: 24upx;
+			width: 100%;
+			color: #999999;
+		}
+	}
+	.icon-items-list-icon{
+		.icon-items-imgse{
+			width: 64upx;
+			height: 64upx;
+		}
+		.icon-items-text{
+			font-size: 28upx;
+			color: #666666;
+		}
+	}
+	.icon-items-icons{
+		text-align: center;
+		margin: 20upx 0;
+		position: relative;
+	}
+	// 生意经
+	.icon-items-list-knowledge{
+		align-items: flex-start;
+		justify-content: space-between;
+		.icon-items-imgse{
+			width: 100%;
+			height: 140upx;
+			border-radius: 10upx;
+		}
+		.icon-items-text{
+			font-size: 28upx;
+			color: #666666;
+			padding: 0 10upx;
+			min-height: 70upx;
+		}
+	}
+</style>

BIN=BIN
components/kk-printer/empty-icon.png


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

@@ -0,0 +1,436 @@
+<template>
+	<view class="kk-printer">
+		<view class="kk-printer-btn">
+			<u-button @tap="handlePrintTap" :loading="isPrinting" shape="circle" :custom-style="{background:$config('primaryColor')}" type="primary">{{isPrinting?printingText:defaultText}}</u-button>
+		</view>
+		<view class="kk-shadow" :class="isShowSearch?'show':''" @tap="handleSearchClose">
+			<view class="kk-modal" @tap.stop="doNothing">
+				<view class="kk-search-device">
+					<!-- <view class="kk-filter-wrap">
+						<view class="filter-title">根据SRRI过滤设备</view>
+						<slider @change="handleSRRIChange" max='-20' min='-100' value="-95" show-value/>
+					</view> -->
+					<!-- <view class="kk-filter-wrap">
+						<view class="filter-title">根据蓝牙名过滤</view>
+						<input type="text"  placeholder-class="kk-placeholder-class" placeholder="请输入蓝牙名字或设备ID搜索" v-model="filterName" />
+					</view> -->
+					<view>
+						<view>注意事项:</view>
+						<view>1、连接打印机之前,先打开手机蓝牙开关</view>
+						<view>2、请检查打印机是否已被其它手机连接,如果是请关闭其它手机蓝牙,然后再用您的手机连接</view>
+					</view>
+					<view class="kk-btn-wrap">
+						<view class="kk-btn-item confirm-btn" @tap="searchBtnTap" v-if="!isSearching">
+							搜索设备
+						</view>
+						<view class="kk-btn-item confirm-btn" v-else>
+							搜索中...
+						</view>
+						<view class="kk-btn-item" @tap="stopSearchBtnTap">
+							停止搜索
+						</view>
+					</view>
+					<view class="kk-devices-wrap">
+						<view class="empty-wrap" v-if="filterDeviceList.length <= 0">
+							<view class="empty-icon"></view>
+							<view class="empty-text">~ 无可搜索到的设备 ~</view>
+						</view>
+						<view class="" v-else>
+							<view class="kk-devices-item flex align_center" v-for="(item,index) in filterDeviceList" :key="index" @tap="handleConnectDevice(item)">
+								<view>
+									<view class="name">
+										<text>设备名称:</text>
+										<text>{{item.name?item.name:'未命名'}}</text>
+									</view>
+									<view class="rssi">
+										<text>信号强度:</text>
+										<text>({{Math.max(0, item.RSSI + 100)}}%)</text>
+									</view>
+									<view class="deviceid">
+										<text>设备ID:</text>
+										<text>{{item.deviceId}}</text>
+									</view>
+								</view>
+								<view>
+									<!-- <u-icon :size="60" color="#55aaff" name="plus-circle"></u-icon> -->
+									<u-button @tap="handleConnectDevice(item)" :loading="isConnecting" shape="circle" size="mini" :custom-style="{background:$config('primaryColor')}" type="primary">{{isConnecting?'连接中':'连接'}}</u-button>
+								</view>
+							</view>
+						</view>
+					</view>
+					<view style="margin-top: 20upx;">
+						<view v-if="!isConnecting" style="text-align: center;padding: 20upx;border:2upx solid #eee;border-radius: 15upx;" @tap="handleSearchClose">取消打印</view>
+					</view>
+				</view>
+			</view>
+		</view>
+	</view>
+</template>
+
+<script>
+	import tsc from '@/components/kk-printer/printer/tsc.js'
+	// import esc from '@/components/kk-printer/printer/esc.js'
+	import * as blesdk from './utils/bluetoolth';
+	import util from './utils/util.js';
+	export default {
+		data(){
+			return{
+				//是否正在打印
+				isPrinting:false,
+				//是否正在搜索设备
+				isSearching:false,
+				// 是否正在连接
+				isConnecting: false,
+				//是否显示蓝牙列表
+				isShowSearch:false,
+				//按蓝牙名过滤
+				filterName:'DL-',
+				//按信号过滤
+				filterRSSI:-95,
+				//设备列表
+				devicesList:[],
+				//连接的设备ID
+				deviceId:'',
+				//根据设备ID获取的服务
+				services:'',
+				//获取特征值时返回的三要素
+				serviceId: '',
+				writeId: '', 
+				readId: ''
+			}
+		},
+		props:{
+			//按钮默认文字
+			defaultText:{
+				type:String,
+				default:'快速打印'
+			},
+			//按钮打印中的文字
+			printingText:{
+				type:String,
+				default:'打印中...'
+			},
+			roomcode:{
+				type:String, 
+				require:true
+			},
+			CustName:{
+				type:String,
+				require:true
+			},
+			roomid:{
+				type:String,
+				require:true
+			}
+		},
+		computed:{
+			mapFilterRSSI(){
+				return (0 - this.filterRSSI)
+			},
+			filterDeviceList(){
+				let devices = this.devicesList;
+				let name = this.filterName;
+				let rssi = this.filterRSSI;
+				//按RSSI过滤
+				let filterDevices1 = devices.filter((item)=>{
+					return item.RSSI > rssi
+				})
+				// 按名字过滤
+				let filterDevices2
+				if(name!=''){
+					filterDevices2 = filterDevices1.filter((item)=>{
+						return (item.name.indexOf(name) >= 0 || item.deviceId.indexOf(name) >= 0)
+					})
+				}else{
+					filterDevices2 = filterDevices1
+				}
+				// 根据广播数据提取MAC地址
+				for (let i = 0; i < filterDevices2.length;i++) {  
+					if (filterDevices2[i].hasOwnProperty('advertisData')){          
+						if (filterDevices2[i].advertisData.byteLength == 8) {
+							filterDevices2[i].advMac = util.buf2hex(filterDevices2[i].advertisData.slice(2, 7));
+						}
+					} 
+				}
+				return filterDevices2
+			}
+		},
+		mounted() {
+			
+		},
+		beforeDestroy(){
+			this.stopSearchBtnTap();
+		},
+		methods:{
+			doNothing(){
+				return;
+			},
+			//点击打印按钮
+			handlePrintTap(){
+				//打开蓝牙适配器
+				blesdk.openBlue().then((res)=>{
+					//获取已连接设备
+					blesdk.getConnectedBluetoothDevices().then((res)=>{
+						//若没有已连接设备,弹框搜索设备
+						console.log(res,this.deviceId,this.serviceId,this.writeId,this.onPrintSuccess)
+						if(res.devices.length == 0){
+							this.isShowSearch = true
+							this.devicesList = []
+							if(this.deviceId){
+								this.closeConnect(this.deviceId)
+							}
+						}else{
+							const lastDevice = this.$store.state.vuex_lastBuleDevice
+							if(lastDevice && res.devices[0].deviceId == lastDevice.deviceId){
+								this.deviceId = lastDevice.deviceId
+								this.serviceId = lastDevice.serviceId
+								this.writeId = lastDevice.writeId
+								this.readId = lastDevice.readId
+							}
+							this.isPrinting = true;
+							this.$nextTick(()=>{
+								this.$emit("startPrint",{
+									deviceId: this.deviceId,
+									serviceId: this.serviceId,
+									writeId: this.writeId
+								},tsc,blesdk)
+							})
+						}
+					}).catch((err)=>{
+						blesdk.catchToast(err);
+					})
+				}).catch((err)=>{
+					console.log(err)
+					blesdk.catchToast(err);
+				})
+			},
+			onGetDevice(res){
+				this.devicesList = res;
+			},
+			handleSearchClose(){
+				if(!this.isConnecting){
+					this.isShowSearch = false
+				}
+			},
+			handleSRRIChange(e){
+				this.filterRSSI = e.detail.value
+			},
+			//开始搜索设备
+			searchBtnTap(){
+				blesdk.startBluetoothDevicesDiscovery();
+				this.isSearching = true;
+				blesdk.onfindBlueDevices(this.onGetDevice)
+			},
+			//停止搜索设备
+			stopSearchBtnTap(){
+				blesdk.stopBlueDevicesDiscovery();
+				this.isSearching = false;
+			},
+			//点击连接设备
+			handleConnectDevice(device){
+				const _this = this
+				let deviceId = device.deviceId;
+				let name = device.name;
+				this.deviceId = deviceId;
+				console.log('deviceId',this.deviceId)
+				this.isConnecting = true
+				this.stopSearchBtnTap()
+				uni.onBLEConnectionStateChange(function(res){
+					console.log('连接',res)
+					if(res.connected){
+						plus.nativeUI.toast('设备'+ res.deviceId + '已连接',{
+							verticalAlign:'center'
+						})
+					}else{
+						_this.closeConnect(deviceId)
+						plus.nativeUI.toast('设备'+ res.deviceId + '已断开连接',{
+							verticalAlign:'center'
+						})
+					}
+					_this.isConnecting = false
+			    })
+				blesdk.createBLEConnection(deviceId, this.onConnectSuccess, this.onConnectFail);
+			},
+			onConnectSuccess(res){
+				this.stopSearchBtnTap()
+				this.isConnecting = false
+				blesdk.getBLEDeviceServices(this.deviceId, this.onGetServicesSuccess, this.onGetServicesFail);
+			},
+			onConnectFail(err){
+				console.log('链接失败',err)
+				this.isConnecting = false
+				blesdk.catchToast(err.res)
+			},
+			onGetServicesSuccess(res){
+				console.log('获取服务',res)
+				this.services = res.serviceId;
+				blesdk.getDeviceCharacteristics(this.deviceId, this.services, this.onGetCharacterSuccess, this.onGetCharacterFail);
+			},
+			onGetServicesFail(err){
+				console.log('获取服务失败')
+			},
+			onGetCharacterSuccess(res){
+				console.log('获取特征值成功',res)
+				this.serviceId = res.serviceId;
+				this.writeId = res.writeId;
+				this.readId = res.readId;
+				this.isShowSearch = false;
+				this.$store.state.vuex_lastBuleDevice = {deviceId:this.deviceId,serviceId:this.serviceId,writeId:this.writeId,readId:this.readId}
+			},
+			onGetCharacterFail(err){
+				console.log('特征值获取失败')
+			},
+			onPrintSuccess(){
+				this.isPrinting = false;
+				console.log('打印成功')
+				// this.$emit('onPrintSuccess')
+			},
+			onPrintFail(){
+				console.log('打印失败')
+				this.isPrinting = false;
+			},
+			closeConnect(){
+				blesdk.closeBLEConnection(this.deviceId)
+			},
+		}
+	}
+</script>
+
+<style lang="scss" scoped>
+	.kk-printer{
+		&-btn{
+			width:100%;
+			height:100%;
+		}
+		.kk-shadow{
+			display: none;
+			&.show{
+				display: block;
+				width:100vw;
+				height:100vh;
+				background: rgba(0,0,0,0.4);
+				position: fixed;
+				top: 0;
+				left: 0;
+				display: flex;
+				justify-content: center;
+				align-items: center;
+				z-index: 10000;
+				.kk-modal{
+					width:680upx;
+					height: 60%;
+					padding:24upx;
+					box-sizing: border-box;
+					overflow-y: auto;
+					border-radius: 20upx;
+					background: #ffffff;
+					display: flex;
+					justify-content: center;
+					align-items: center;
+					.kk-search-device{
+						width:100%;
+						height: 100%;
+						.kk-filter-wrap{
+							width:100%;
+							height: 200upx;
+							display: flex;
+							flex-direction: column;
+							justify-content: flex-start;
+							align-items: flex-start;
+							.filter-title{
+								line-height: 70upx;
+								font-size: 30upx;
+								color: #999999;
+							}
+							&>slider{
+								width:90%;
+								height: 90upx;
+							}
+							&>input{
+								padding:0 20upx;
+								box-sizing: border-box;
+								border-radius: 10upx;
+								height: 90upx;
+								width:100%;
+								border: 1upx solid #ebebeb;
+							}
+						}
+						.kk-btn-wrap{
+							width:100%;
+							height: 140upx;
+							display: flex;
+							justify-content: space-between;
+							align-items: center;
+							&>view{
+								flex:1 1 auto;
+								height: 80upx;
+								line-height: 80upx;
+								border-radius: 100upx;
+								text-align: center;
+								color:#ffffff;
+								&.confirm-btn{
+									background: #007AFF;
+									margin-right:30upx;
+								}
+								&:nth-last-child(1){
+									background: #DD524D;
+								}
+							}
+						}
+						.kk-devices-wrap{
+							height: calc(100% - 460upx);
+							overflow-y:auto;
+							padding:10upx 20upx;
+							box-sizing: border-box;
+							border: 1upx solid #ebebeb;
+							box-sizing: border-box;
+							border-radius: 20upx;
+							.empty-wrap{
+								width:100%;
+								height: 100%;
+								display: flex;
+								flex-direction: column;
+								justify-content: center;
+								align-items: center;
+								.empty-icon{
+									width:268upx;
+									height: 240upx;
+									background: url('./empty-icon.png') no-repeat;
+									background-size:100% 100%;
+									margin-bottom: 26upx;
+								}
+								.empty-text{
+									width: 100%;
+									line-height: 50upx;
+									font-size: 30upx;
+									text-align: center;
+									color: #999999;
+								}
+							}
+							.kk-devices-item{
+								width:100%;
+								border-bottom: 1upx solid #ebebeb;
+								padding:10upx 0;
+								box-sizing: border-box;
+								&:nth-last-child(1){
+									border-bottom: none;
+								}
+								> view{
+									&:first-child{
+										flex-grow: 1;
+										width: 80%;
+									}
+								}
+							}
+						}
+					}
+				}
+			}
+			
+		}
+	}
+	.kk-placeholder-class{
+		font-size: 30upx;
+		color:#999999;
+	}
+</style>

A diferenza do arquivo foi suprimida porque é demasiado grande
+ 9 - 0
components/kk-printer/printer/encoding-indexes.js


+ 3312 - 0
components/kk-printer/printer/encoding.js

@@ -0,0 +1,3312 @@
+// This is free and unencumbered software released into the public domain.
+// See LICENSE.md for more information.
+
+/**
+ * @fileoverview Global |this| required for resolving indexes in node.
+ * @suppress {globalThis}
+ */
+(function(global) {
+  'use strict';
+
+  // If we're in node require encoding-indexes and attach it to the global.
+  if (typeof module !== "undefined" && module.exports &&
+    !global["encoding-indexes"]) {
+    global["encoding-indexes"] =
+      require("./encoding-indexes.js")["encoding-indexes"];
+  }
+
+  //
+  // Utilities
+  //
+
+  /**
+   * @param {number} a The number to test.
+   * @param {number} min The minimum value in the range, inclusive.
+   * @param {number} max The maximum value in the range, inclusive.
+   * @return {boolean} True if a >= min and a <= max.
+   */
+  function inRange(a, min, max) {
+    return min <= a && a <= max;
+  }
+
+  /**
+   * @param {!Array.<*>} array The array to check.
+   * @param {*} item The item to look for in the array.
+   * @return {boolean} True if the item appears in the array.
+   */
+  function includes(array, item) {
+    return array.indexOf(item) !== -1;
+  }
+
+  var floor = Math.floor;
+
+  /**
+   * @param {*} o
+   * @return {Object}
+   */
+  function ToDictionary(o) {
+    if (o === undefined) return {};
+    if (o === Object(o)) return o;
+    throw TypeError('Could not convert argument to dictionary');
+  }
+
+  /**
+   * @param {string} string Input string of UTF-16 code units.
+   * @return {!Array.<number>} Code points.
+   */
+  function stringToCodePoints(string) {
+    // https://heycam.github.io/webidl/#dfn-obtain-unicode
+
+    // 1. Let S be the DOMString value.
+    var s = String(string);
+
+    // 2. Let n be the length of S.
+    var n = s.length;
+
+    // 3. Initialize i to 0.
+    var i = 0;
+
+    // 4. Initialize U to be an empty sequence of Unicode characters.
+    var u = [];
+
+    // 5. While i < n:
+    while (i < n) {
+
+      // 1. Let c be the code unit in S at index i.
+      var c = s.charCodeAt(i);
+
+      // 2. Depending on the value of c:
+
+      // c < 0xD800 or c > 0xDFFF
+      if (c < 0xD800 || c > 0xDFFF) {
+        // Append to U the Unicode character with code point c.
+        u.push(c);
+      }
+
+      // 0xDC00 ≤ c ≤ 0xDFFF
+      else if (0xDC00 <= c && c <= 0xDFFF) {
+        // Append to U a U+FFFD REPLACEMENT CHARACTER.
+        u.push(0xFFFD);
+      }
+
+      // 0xD800 ≤ c ≤ 0xDBFF
+      else if (0xD800 <= c && c <= 0xDBFF) {
+        // 1. If i = n−1, then append to U a U+FFFD REPLACEMENT
+        // CHARACTER.
+        if (i === n - 1) {
+          u.push(0xFFFD);
+        }
+        // 2. Otherwise, i < n−1:
+        else {
+          // 1. Let d be the code unit in S at index i+1.
+          var d = s.charCodeAt(i + 1);
+
+          // 2. If 0xDC00 ≤ d ≤ 0xDFFF, then:
+          if (0xDC00 <= d && d <= 0xDFFF) {
+            // 1. Let a be c & 0x3FF.
+            var a = c & 0x3FF;
+
+            // 2. Let b be d & 0x3FF.
+            var b = d & 0x3FF;
+
+            // 3. Append to U the Unicode character with code point
+            // 2^16+2^10*a+b.
+            u.push(0x10000 + (a << 10) + b);
+
+            // 4. Set i to i+1.
+            i += 1;
+          }
+
+          // 3. Otherwise, d < 0xDC00 or d > 0xDFFF. Append to U a
+          // U+FFFD REPLACEMENT CHARACTER.
+          else  {
+            u.push(0xFFFD);
+          }
+        }
+      }
+
+      // 3. Set i to i+1.
+      i += 1;
+    }
+
+    // 6. Return U.
+    return u;
+  }
+
+  /**
+   * @param {!Array.<number>} code_points Array of code points.
+   * @return {string} string String of UTF-16 code units.
+   */
+  function codePointsToString(code_points) {
+    var s = '';
+    for (var i = 0; i < code_points.length; ++i) {
+      var cp = code_points[i];
+      if (cp <= 0xFFFF) {
+        s += String.fromCharCode(cp);
+      } else {
+        cp -= 0x10000;
+        s += String.fromCharCode((cp >> 10) + 0xD800,
+                                 (cp & 0x3FF) + 0xDC00);
+      }
+    }
+    return s;
+  }
+
+
+  //
+  // Implementation of Encoding specification
+  // https://encoding.spec.whatwg.org/
+  //
+
+  //
+  // 4. Terminology
+  //
+
+  /**
+   * An ASCII byte is a byte in the range 0x00 to 0x7F, inclusive.
+   * @param {number} a The number to test.
+   * @return {boolean} True if a is in the range 0x00 to 0x7F, inclusive.
+   */
+  function isASCIIByte(a) {
+    return 0x00 <= a && a <= 0x7F;
+  }
+
+  /**
+   * An ASCII code point is a code point in the range U+0000 to
+   * U+007F, inclusive.
+   */
+  var isASCIICodePoint = isASCIIByte;
+
+
+  /**
+   * End-of-stream is a special token that signifies no more tokens
+   * are in the stream.
+   * @const
+   */ var end_of_stream = -1;
+
+  /**
+   * A stream represents an ordered sequence of tokens.
+   *
+   * @constructor
+   * @param {!(Array.<number>|Uint8Array)} tokens Array of tokens that provide
+   * the stream.
+   */
+  function Stream(tokens) {
+    /** @type {!Array.<number>} */
+    this.tokens = [].slice.call(tokens);
+    // Reversed as push/pop is more efficient than shift/unshift.
+    this.tokens.reverse();
+  }
+
+  Stream.prototype = {
+    /**
+     * @return {boolean} True if end-of-stream has been hit.
+     */
+    endOfStream: function() {
+      return !this.tokens.length;
+    },
+
+    /**
+     * When a token is read from a stream, the first token in the
+     * stream must be returned and subsequently removed, and
+     * end-of-stream must be returned otherwise.
+     *
+     * @return {number} Get the next token from the stream, or
+     * end_of_stream.
+     */
+     read: function() {
+      if (!this.tokens.length)
+        return end_of_stream;
+       return this.tokens.pop();
+     },
+
+    /**
+     * When one or more tokens are prepended to a stream, those tokens
+     * must be inserted, in given order, before the first token in the
+     * stream.
+     *
+     * @param {(number|!Array.<number>)} token The token(s) to prepend to the
+     * stream.
+     */
+    prepend: function(token) {
+      if (Array.isArray(token)) {
+        var tokens = /**@type {!Array.<number>}*/(token);
+        while (tokens.length)
+          this.tokens.push(tokens.pop());
+      } else {
+        this.tokens.push(token);
+      }
+    },
+
+    /**
+     * When one or more tokens are pushed to a stream, those tokens
+     * must be inserted, in given order, after the last token in the
+     * stream.
+     *
+     * @param {(number|!Array.<number>)} token The tokens(s) to push to the
+     * stream.
+     */
+    push: function(token) {
+      if (Array.isArray(token)) {
+        var tokens = /**@type {!Array.<number>}*/(token);
+        while (tokens.length)
+          this.tokens.unshift(tokens.shift());
+      } else {
+        this.tokens.unshift(token);
+      }
+    }
+  };
+
+  //
+  // 5. Encodings
+  //
+
+  // 5.1 Encoders and decoders
+
+  /** @const */
+  var finished = -1;
+
+  /**
+   * @param {boolean} fatal If true, decoding errors raise an exception.
+   * @param {number=} opt_code_point Override the standard fallback code point.
+   * @return {number} The code point to insert on a decoding error.
+   */
+  function decoderError(fatal, opt_code_point) {
+    if (fatal)
+      throw TypeError('Decoder error');
+    return opt_code_point || 0xFFFD;
+  }
+
+  /**
+   * @param {number} code_point The code point that could not be encoded.
+   * @return {number} Always throws, no value is actually returned.
+   */
+  function encoderError(code_point) {
+    throw TypeError('The code point ' + code_point + ' could not be encoded.');
+  }
+
+  /** @interface */
+  function Decoder() {}
+  Decoder.prototype = {
+    /**
+     * @param {Stream} stream The stream of bytes being decoded.
+     * @param {number} bite The next byte read from the stream.
+     * @return {?(number|!Array.<number>)} The next code point(s)
+     *     decoded, or null if not enough data exists in the input
+     *     stream to decode a complete code point, or |finished|.
+     */
+    handler: function(stream, bite) {}
+  };
+
+  /** @interface */
+  function Encoder() {}
+  Encoder.prototype = {
+    /**
+     * @param {Stream} stream The stream of code points being encoded.
+     * @param {number} code_point Next code point read from the stream.
+     * @return {(number|!Array.<number>)} Byte(s) to emit, or |finished|.
+     */
+    handler: function(stream, code_point) {}
+  };
+
+  // 5.2 Names and labels
+
+  // TODO: Define @typedef for Encoding: {name:string,labels:Array.<string>}
+  // https://github.com/google/closure-compiler/issues/247
+
+  /**
+   * @param {string} label The encoding label.
+   * @return {?{name:string,labels:Array.<string>}}
+   */
+  function getEncoding(label) {
+    // 1. Remove any leading and trailing ASCII whitespace from label.
+    label = String(label).trim().toLowerCase();
+
+    // 2. If label is an ASCII case-insensitive match for any of the
+    // labels listed in the table below, return the corresponding
+    // encoding, and failure otherwise.
+    if (Object.prototype.hasOwnProperty.call(label_to_encoding, label)) {
+      return label_to_encoding[label];
+    }
+    return null;
+  }
+
+  /**
+   * Encodings table: https://encoding.spec.whatwg.org/encodings.json
+   * @const
+   * @type {!Array.<{
+   *          heading: string,
+   *          encodings: Array.<{name:string,labels:Array.<string>}>
+   *        }>}
+   */
+  var encodings = [
+    {
+      "encodings": [
+        {
+          "labels": [
+            "unicode-1-1-utf-8",
+            "utf-8",
+            "utf8"
+          ],
+          "name": "UTF-8"
+        }
+      ],
+      "heading": "The Encoding"
+    },
+    {
+      "encodings": [
+        {
+          "labels": [
+            "866",
+            "cp866",
+            "csibm866",
+            "ibm866"
+          ],
+          "name": "IBM866"
+        },
+        {
+          "labels": [
+            "csisolatin2",
+            "iso-8859-2",
+            "iso-ir-101",
+            "iso8859-2",
+            "iso88592",
+            "iso_8859-2",
+            "iso_8859-2:1987",
+            "l2",
+            "latin2"
+          ],
+          "name": "ISO-8859-2"
+        },
+        {
+          "labels": [
+            "csisolatin3",
+            "iso-8859-3",
+            "iso-ir-109",
+            "iso8859-3",
+            "iso88593",
+            "iso_8859-3",
+            "iso_8859-3:1988",
+            "l3",
+            "latin3"
+          ],
+          "name": "ISO-8859-3"
+        },
+        {
+          "labels": [
+            "csisolatin4",
+            "iso-8859-4",
+            "iso-ir-110",
+            "iso8859-4",
+            "iso88594",
+            "iso_8859-4",
+            "iso_8859-4:1988",
+            "l4",
+            "latin4"
+          ],
+          "name": "ISO-8859-4"
+        },
+        {
+          "labels": [
+            "csisolatincyrillic",
+            "cyrillic",
+            "iso-8859-5",
+            "iso-ir-144",
+            "iso8859-5",
+            "iso88595",
+            "iso_8859-5",
+            "iso_8859-5:1988"
+          ],
+          "name": "ISO-8859-5"
+        },
+        {
+          "labels": [
+            "arabic",
+            "asmo-708",
+            "csiso88596e",
+            "csiso88596i",
+            "csisolatinarabic",
+            "ecma-114",
+            "iso-8859-6",
+            "iso-8859-6-e",
+            "iso-8859-6-i",
+            "iso-ir-127",
+            "iso8859-6",
+            "iso88596",
+            "iso_8859-6",
+            "iso_8859-6:1987"
+          ],
+          "name": "ISO-8859-6"
+        },
+        {
+          "labels": [
+            "csisolatingreek",
+            "ecma-118",
+            "elot_928",
+            "greek",
+            "greek8",
+            "iso-8859-7",
+            "iso-ir-126",
+            "iso8859-7",
+            "iso88597",
+            "iso_8859-7",
+            "iso_8859-7:1987",
+            "sun_eu_greek"
+          ],
+          "name": "ISO-8859-7"
+        },
+        {
+          "labels": [
+            "csiso88598e",
+            "csisolatinhebrew",
+            "hebrew",
+            "iso-8859-8",
+            "iso-8859-8-e",
+            "iso-ir-138",
+            "iso8859-8",
+            "iso88598",
+            "iso_8859-8",
+            "iso_8859-8:1988",
+            "visual"
+          ],
+          "name": "ISO-8859-8"
+        },
+        {
+          "labels": [
+            "csiso88598i",
+            "iso-8859-8-i",
+            "logical"
+          ],
+          "name": "ISO-8859-8-I"
+        },
+        {
+          "labels": [
+            "csisolatin6",
+            "iso-8859-10",
+            "iso-ir-157",
+            "iso8859-10",
+            "iso885910",
+            "l6",
+            "latin6"
+          ],
+          "name": "ISO-8859-10"
+        },
+        {
+          "labels": [
+            "iso-8859-13",
+            "iso8859-13",
+            "iso885913"
+          ],
+          "name": "ISO-8859-13"
+        },
+        {
+          "labels": [
+            "iso-8859-14",
+            "iso8859-14",
+            "iso885914"
+          ],
+          "name": "ISO-8859-14"
+        },
+        {
+          "labels": [
+            "csisolatin9",
+            "iso-8859-15",
+            "iso8859-15",
+            "iso885915",
+            "iso_8859-15",
+            "l9"
+          ],
+          "name": "ISO-8859-15"
+        },
+        {
+          "labels": [
+            "iso-8859-16"
+          ],
+          "name": "ISO-8859-16"
+        },
+        {
+          "labels": [
+            "cskoi8r",
+            "koi",
+            "koi8",
+            "koi8-r",
+            "koi8_r"
+          ],
+          "name": "KOI8-R"
+        },
+        {
+          "labels": [
+            "koi8-ru",
+            "koi8-u"
+          ],
+          "name": "KOI8-U"
+        },
+        {
+          "labels": [
+            "csmacintosh",
+            "mac",
+            "macintosh",
+            "x-mac-roman"
+          ],
+          "name": "macintosh"
+        },
+        {
+          "labels": [
+            "dos-874",
+            "iso-8859-11",
+            "iso8859-11",
+            "iso885911",
+            "tis-620",
+            "windows-874"
+          ],
+          "name": "windows-874"
+        },
+        {
+          "labels": [
+            "cp1250",
+            "windows-1250",
+            "x-cp1250"
+          ],
+          "name": "windows-1250"
+        },
+        {
+          "labels": [
+            "cp1251",
+            "windows-1251",
+            "x-cp1251"
+          ],
+          "name": "windows-1251"
+        },
+        {
+          "labels": [
+            "ansi_x3.4-1968",
+            "ascii",
+            "cp1252",
+            "cp819",
+            "csisolatin1",
+            "ibm819",
+            "iso-8859-1",
+            "iso-ir-100",
+            "iso8859-1",
+            "iso88591",
+            "iso_8859-1",
+            "iso_8859-1:1987",
+            "l1",
+            "latin1",
+            "us-ascii",
+            "windows-1252",
+            "x-cp1252"
+          ],
+          "name": "windows-1252"
+        },
+        {
+          "labels": [
+            "cp1253",
+            "windows-1253",
+            "x-cp1253"
+          ],
+          "name": "windows-1253"
+        },
+        {
+          "labels": [
+            "cp1254",
+            "csisolatin5",
+            "iso-8859-9",
+            "iso-ir-148",
+            "iso8859-9",
+            "iso88599",
+            "iso_8859-9",
+            "iso_8859-9:1989",
+            "l5",
+            "latin5",
+            "windows-1254",
+            "x-cp1254"
+          ],
+          "name": "windows-1254"
+        },
+        {
+          "labels": [
+            "cp1255",
+            "windows-1255",
+            "x-cp1255"
+          ],
+          "name": "windows-1255"
+        },
+        {
+          "labels": [
+            "cp1256",
+            "windows-1256",
+            "x-cp1256"
+          ],
+          "name": "windows-1256"
+        },
+        {
+          "labels": [
+            "cp1257",
+            "windows-1257",
+            "x-cp1257"
+          ],
+          "name": "windows-1257"
+        },
+        {
+          "labels": [
+            "cp1258",
+            "windows-1258",
+            "x-cp1258"
+          ],
+          "name": "windows-1258"
+        },
+        {
+          "labels": [
+            "x-mac-cyrillic",
+            "x-mac-ukrainian"
+          ],
+          "name": "x-mac-cyrillic"
+        }
+      ],
+      "heading": "Legacy single-byte encodings"
+    },
+    {
+      "encodings": [
+        {
+          "labels": [
+            "chinese",
+            "csgb2312",
+            "csiso58gb231280",
+            "gb2312",
+            "gb_2312",
+            "gb_2312-80",
+            "gbk",
+            "iso-ir-58",
+            "x-gbk"
+          ],
+          "name": "GBK"
+        },
+        {
+          "labels": [
+            "gb18030"
+          ],
+          "name": "gb18030"
+        }
+      ],
+      "heading": "Legacy multi-byte Chinese (simplified) encodings"
+    },
+    {
+      "encodings": [
+        {
+          "labels": [
+            "big5",
+            "big5-hkscs",
+            "cn-big5",
+            "csbig5",
+            "x-x-big5"
+          ],
+          "name": "Big5"
+        }
+      ],
+      "heading": "Legacy multi-byte Chinese (traditional) encodings"
+    },
+    {
+      "encodings": [
+        {
+          "labels": [
+            "cseucpkdfmtjapanese",
+            "euc-jp",
+            "x-euc-jp"
+          ],
+          "name": "EUC-JP"
+        },
+        {
+          "labels": [
+            "csiso2022jp",
+            "iso-2022-jp"
+          ],
+          "name": "ISO-2022-JP"
+        },
+        {
+          "labels": [
+            "csshiftjis",
+            "ms932",
+            "ms_kanji",
+            "shift-jis",
+            "shift_jis",
+            "sjis",
+            "windows-31j",
+            "x-sjis"
+          ],
+          "name": "Shift_JIS"
+        }
+      ],
+      "heading": "Legacy multi-byte Japanese encodings"
+    },
+    {
+      "encodings": [
+        {
+          "labels": [
+            "cseuckr",
+            "csksc56011987",
+            "euc-kr",
+            "iso-ir-149",
+            "korean",
+            "ks_c_5601-1987",
+            "ks_c_5601-1989",
+            "ksc5601",
+            "ksc_5601",
+            "windows-949"
+          ],
+          "name": "EUC-KR"
+        }
+      ],
+      "heading": "Legacy multi-byte Korean encodings"
+    },
+    {
+      "encodings": [
+        {
+          "labels": [
+            "csiso2022kr",
+            "hz-gb-2312",
+            "iso-2022-cn",
+            "iso-2022-cn-ext",
+            "iso-2022-kr"
+          ],
+          "name": "replacement"
+        },
+        {
+          "labels": [
+            "utf-16be"
+          ],
+          "name": "UTF-16BE"
+        },
+        {
+          "labels": [
+            "utf-16",
+            "utf-16le"
+          ],
+          "name": "UTF-16LE"
+        },
+        {
+          "labels": [
+            "x-user-defined"
+          ],
+          "name": "x-user-defined"
+        }
+      ],
+      "heading": "Legacy miscellaneous encodings"
+    }
+  ];
+
+  // Label to encoding registry.
+  /** @type {Object.<string,{name:string,labels:Array.<string>}>} */
+  var label_to_encoding = {};
+  encodings.forEach(function(category) {
+    category.encodings.forEach(function(encoding) {
+      encoding.labels.forEach(function(label) {
+        label_to_encoding[label] = encoding;
+      });
+    });
+  });
+
+  // Registry of of encoder/decoder factories, by encoding name.
+  /** @type {Object.<string, function({fatal:boolean}): Encoder>} */
+  var encoders = {};
+  /** @type {Object.<string, function({fatal:boolean}): Decoder>} */
+  var decoders = {};
+
+  //
+  // 6. Indexes
+  //
+
+  /**
+   * @param {number} pointer The |pointer| to search for.
+   * @param {(!Array.<?number>|undefined)} index The |index| to search within.
+   * @return {?number} The code point corresponding to |pointer| in |index|,
+   *     or null if |code point| is not in |index|.
+   */
+  function indexCodePointFor(pointer, index) {
+    if (!index) return null;
+    return index[pointer] || null;
+  }
+
+  /**
+   * @param {number} code_point The |code point| to search for.
+   * @param {!Array.<?number>} index The |index| to search within.
+   * @return {?number} The first pointer corresponding to |code point| in
+   *     |index|, or null if |code point| is not in |index|.
+   */
+  function indexPointerFor(code_point, index) {
+    var pointer = index.indexOf(code_point);
+    return pointer === -1 ? null : pointer;
+  }
+
+  /**
+   * @param {string} name Name of the index.
+   * @return {(!Array.<number>|!Array.<Array.<number>>)}
+   *  */
+  function index(name) {
+    if (!('encoding-indexes' in global)) {
+      throw Error("Indexes missing." +
+                  " Did you forget to include encoding-indexes.js first?");
+    }
+    return global['encoding-indexes'][name];
+  }
+
+  /**
+   * @param {number} pointer The |pointer| to search for in the gb18030 index.
+   * @return {?number} The code point corresponding to |pointer| in |index|,
+   *     or null if |code point| is not in the gb18030 index.
+   */
+  function indexGB18030RangesCodePointFor(pointer) {
+    // 1. If pointer is greater than 39419 and less than 189000, or
+    // pointer is greater than 1237575, return null.
+    if ((pointer > 39419 && pointer < 189000) || (pointer > 1237575))
+      return null;
+
+    // 2. If pointer is 7457, return code point U+E7C7.
+    if (pointer === 7457) return 0xE7C7;
+
+    // 3. Let offset be the last pointer in index gb18030 ranges that
+    // is equal to or less than pointer and let code point offset be
+    // its corresponding code point.
+    var offset = 0;
+    var code_point_offset = 0;
+    var idx = index('gb18030-ranges');
+    var i;
+    for (i = 0; i < idx.length; ++i) {
+      /** @type {!Array.<number>} */
+      var entry = idx[i];
+      if (entry[0] <= pointer) {
+        offset = entry[0];
+        code_point_offset = entry[1];
+      } else {
+        break;
+      }
+    }
+
+    // 4. Return a code point whose value is code point offset +
+    // pointer − offset.
+    return code_point_offset + pointer - offset;
+  }
+
+  /**
+   * @param {number} code_point The |code point| to locate in the gb18030 index.
+   * @return {number} The first pointer corresponding to |code point| in the
+   *     gb18030 index.
+   */
+  function indexGB18030RangesPointerFor(code_point) {
+    // 1. If code point is U+E7C7, return pointer 7457.
+    if (code_point === 0xE7C7) return 7457;
+
+    // 2. Let offset be the last code point in index gb18030 ranges
+    // that is equal to or less than code point and let pointer offset
+    // be its corresponding pointer.
+    var offset = 0;
+    var pointer_offset = 0;
+    var idx = index('gb18030-ranges');
+    var i;
+    for (i = 0; i < idx.length; ++i) {
+      /** @type {!Array.<number>} */
+      var entry = idx[i];
+      if (entry[1] <= code_point) {
+        offset = entry[1];
+        pointer_offset = entry[0];
+      } else {
+        break;
+      }
+    }
+
+    // 3. Return a pointer whose value is pointer offset + code point
+    // − offset.
+    return pointer_offset + code_point - offset;
+  }
+
+  /**
+   * @param {number} code_point The |code_point| to search for in the Shift_JIS
+   *     index.
+   * @return {?number} The code point corresponding to |pointer| in |index|,
+   *     or null if |code point| is not in the Shift_JIS index.
+   */
+  function indexShiftJISPointerFor(code_point) {
+    // 1. Let index be index jis0208 excluding all entries whose
+    // pointer is in the range 8272 to 8835, inclusive.
+    shift_jis_index = shift_jis_index ||
+      index('jis0208').map(function(code_point, pointer) {
+        return inRange(pointer, 8272, 8835) ? null : code_point;
+      });
+    var index_ = shift_jis_index;
+
+    // 2. Return the index pointer for code point in index.
+    return index_.indexOf(code_point);
+  }
+  var shift_jis_index;
+
+  /**
+   * @param {number} code_point The |code_point| to search for in the big5
+   *     index.
+   * @return {?number} The code point corresponding to |pointer| in |index|,
+   *     or null if |code point| is not in the big5 index.
+   */
+  function indexBig5PointerFor(code_point) {
+    // 1. Let index be index Big5 excluding all entries whose pointer
+    big5_index_no_hkscs = big5_index_no_hkscs ||
+      index('big5').map(function(code_point, pointer) {
+        return (pointer < (0xA1 - 0x81) * 157) ? null : code_point;
+      });
+    var index_ = big5_index_no_hkscs;
+
+    // 2. If code point is U+2550, U+255E, U+2561, U+256A, U+5341, or
+    // U+5345, return the last pointer corresponding to code point in
+    // index.
+    if (code_point === 0x2550 || code_point === 0x255E ||
+        code_point === 0x2561 || code_point === 0x256A ||
+        code_point === 0x5341 || code_point === 0x5345) {
+      return index_.lastIndexOf(code_point);
+    }
+
+    // 3. Return the index pointer for code point in index.
+    return indexPointerFor(code_point, index_);
+  }
+  var big5_index_no_hkscs;
+
+  //
+  // 8. API
+  //
+
+  /** @const */ var DEFAULT_ENCODING = 'utf-8';
+
+  // 8.1 Interface TextDecoder
+
+  /**
+   * @constructor
+   * @param {string=} label The label of the encoding;
+   *     defaults to 'utf-8'.
+   * @param {Object=} options
+   */
+  function TextDecoder(label, options) {
+    // Web IDL conventions
+    if (!(this instanceof TextDecoder))
+      throw TypeError('Called as a function. Did you forget \'new\'?');
+    label = label !== undefined ? String(label) : DEFAULT_ENCODING;
+    options = ToDictionary(options);
+
+    // A TextDecoder object has an associated encoding, decoder,
+    // stream, ignore BOM flag (initially unset), BOM seen flag
+    // (initially unset), error mode (initially replacement), and do
+    // not flush flag (initially unset).
+
+    /** @private */
+    this._encoding = null;
+    /** @private @type {?Decoder} */
+    this._decoder = null;
+    /** @private @type {boolean} */
+    this._ignoreBOM = false;
+    /** @private @type {boolean} */
+    this._BOMseen = false;
+    /** @private @type {string} */
+    this._error_mode = 'replacement';
+    /** @private @type {boolean} */
+    this._do_not_flush = false;
+
+
+    // 1. Let encoding be the result of getting an encoding from
+    // label.
+    var encoding = getEncoding(label);
+
+    // 2. If encoding is failure or replacement, throw a RangeError.
+    if (encoding === null || encoding.name === 'replacement')
+      throw RangeError('Unknown encoding: ' + label);
+    if (!decoders[encoding.name]) {
+      throw Error('Decoder not present.' +
+                  ' Did you forget to include encoding-indexes.js first?');
+    }
+
+    // 3. Let dec be a new TextDecoder object.
+    var dec = this;
+
+    // 4. Set dec's encoding to encoding.
+    dec._encoding = encoding;
+
+    // 5. If options's fatal member is true, set dec's error mode to
+    // fatal.
+    if (Boolean(options['fatal']))
+      dec._error_mode = 'fatal';
+
+    // 6. If options's ignoreBOM member is true, set dec's ignore BOM
+    // flag.
+    if (Boolean(options['ignoreBOM']))
+      dec._ignoreBOM = true;
+
+    // For pre-ES5 runtimes:
+    if (!Object.defineProperty) {
+      this.encoding = dec._encoding.name.toLowerCase();
+      this.fatal = dec._error_mode === 'fatal';
+      this.ignoreBOM = dec._ignoreBOM;
+    }
+
+    // 7. Return dec.
+    return dec;
+  }
+
+  if (Object.defineProperty) {
+    // The encoding attribute's getter must return encoding's name.
+    Object.defineProperty(TextDecoder.prototype, 'encoding', {
+      /** @this {TextDecoder} */
+      get: function() { return this._encoding.name.toLowerCase(); }
+    });
+
+    // The fatal attribute's getter must return true if error mode
+    // is fatal, and false otherwise.
+    Object.defineProperty(TextDecoder.prototype, 'fatal', {
+      /** @this {TextDecoder} */
+      get: function() { return this._error_mode === 'fatal'; }
+    });
+
+    // The ignoreBOM attribute's getter must return true if ignore
+    // BOM flag is set, and false otherwise.
+    Object.defineProperty(TextDecoder.prototype, 'ignoreBOM', {
+      /** @this {TextDecoder} */
+      get: function() { return this._ignoreBOM; }
+    });
+  }
+
+  /**
+   * @param {BufferSource=} input The buffer of bytes to decode.
+   * @param {Object=} options
+   * @return {string} The decoded string.
+   */
+  TextDecoder.prototype.decode = function decode(input, options) {
+    var bytes;
+    if (typeof input === 'object' && input instanceof ArrayBuffer) {
+      bytes = new Uint8Array(input);
+    } else if (typeof input === 'object' && 'buffer' in input &&
+               input.buffer instanceof ArrayBuffer) {
+      bytes = new Uint8Array(input.buffer,
+                             input.byteOffset,
+                             input.byteLength);
+    } else {
+      bytes = new Uint8Array(0);
+    }
+
+    options = ToDictionary(options);
+
+    // 1. If the do not flush flag is unset, set decoder to a new
+    // encoding's decoder, set stream to a new stream, and unset the
+    // BOM seen flag.
+    if (!this._do_not_flush) {
+      this._decoder = decoders[this._encoding.name]({
+        fatal: this._error_mode === 'fatal'});
+      this._BOMseen = false;
+    }
+
+    // 2. If options's stream is true, set the do not flush flag, and
+    // unset the do not flush flag otherwise.
+    this._do_not_flush = Boolean(options['stream']);
+
+    // 3. If input is given, push a copy of input to stream.
+    // TODO: Align with spec algorithm - maintain stream on instance.
+    var input_stream = new Stream(bytes);
+
+    // 4. Let output be a new stream.
+    var output = [];
+
+    /** @type {?(number|!Array.<number>)} */
+    var result;
+
+    // 5. While true:
+    while (true) {
+      // 1. Let token be the result of reading from stream.
+      var token = input_stream.read();
+
+      // 2. If token is end-of-stream and the do not flush flag is
+      // set, return output, serialized.
+      // TODO: Align with spec algorithm.
+      if (token === end_of_stream)
+        break;
+
+      // 3. Otherwise, run these subsubsteps:
+
+      // 1. Let result be the result of processing token for decoder,
+      // stream, output, and error mode.
+      result = this._decoder.handler(input_stream, token);
+
+      // 2. If result is finished, return output, serialized.
+      if (result === finished)
+        break;
+
+      if (result !== null) {
+        if (Array.isArray(result))
+          output.push.apply(output, /**@type {!Array.<number>}*/(result));
+        else
+          output.push(result);
+      }
+
+      // 3. Otherwise, if result is error, throw a TypeError.
+      // (Thrown in handler)
+
+      // 4. Otherwise, do nothing.
+    }
+    // TODO: Align with spec algorithm.
+    if (!this._do_not_flush) {
+      do {
+        result = this._decoder.handler(input_stream, input_stream.read());
+        if (result === finished)
+          break;
+        if (result === null)
+          continue;
+        if (Array.isArray(result))
+          output.push.apply(output, /**@type {!Array.<number>}*/(result));
+        else
+          output.push(result);
+      } while (!input_stream.endOfStream());
+      this._decoder = null;
+    }
+
+    // A TextDecoder object also has an associated serialize stream
+    // algorithm...
+    /**
+     * @param {!Array.<number>} stream
+     * @return {string}
+     * @this {TextDecoder}
+     */
+    function serializeStream(stream) {
+      // 1. Let token be the result of reading from stream.
+      // (Done in-place on array, rather than as a stream)
+
+      // 2. If encoding is UTF-8, UTF-16BE, or UTF-16LE, and ignore
+      // BOM flag and BOM seen flag are unset, run these subsubsteps:
+      if (includes(['UTF-8', 'UTF-16LE', 'UTF-16BE'], this._encoding.name) &&
+          !this._ignoreBOM && !this._BOMseen) {
+        if (stream.length > 0 && stream[0] === 0xFEFF) {
+          // 1. If token is U+FEFF, set BOM seen flag.
+          this._BOMseen = true;
+          stream.shift();
+        } else if (stream.length > 0) {
+          // 2. Otherwise, if token is not end-of-stream, set BOM seen
+          // flag and append token to stream.
+          this._BOMseen = true;
+        } else {
+          // 3. Otherwise, if token is not end-of-stream, append token
+          // to output.
+          // (no-op)
+        }
+      }
+      // 4. Otherwise, return output.
+      return codePointsToString(stream);
+    }
+
+    return serializeStream.call(this, output);
+  };
+
+  // 8.2 Interface TextEncoder
+
+  /**
+   * @constructor
+   * @param {string=} label The label of the encoding. NONSTANDARD.
+   * @param {Object=} options NONSTANDARD.
+   */
+  function TextEncoder(label, options) {
+    // Web IDL conventions
+    if (!(this instanceof TextEncoder))
+      throw TypeError('Called as a function. Did you forget \'new\'?');
+    options = ToDictionary(options);
+
+    // A TextEncoder object has an associated encoding and encoder.
+
+    /** @private */
+    this._encoding = null;
+    /** @private @type {?Encoder} */
+    this._encoder = null;
+
+    // Non-standard
+    /** @private @type {boolean} */
+    this._do_not_flush = false;
+    /** @private @type {string} */
+    this._fatal = Boolean(options['fatal']) ? 'fatal' : 'replacement';
+
+    // 1. Let enc be a new TextEncoder object.
+    var enc = this;
+
+    // 2. Set enc's encoding to UTF-8's encoder.
+    if (Boolean(options['NONSTANDARD_allowLegacyEncoding'])) {
+      // NONSTANDARD behavior.
+      label = label !== undefined ? String(label) : DEFAULT_ENCODING;
+      var encoding = getEncoding(label);
+      if (encoding === null || encoding.name === 'replacement')
+        throw RangeError('Unknown encoding: ' + label);
+      if (!encoders[encoding.name]) {
+        throw Error('Encoder not present.' +
+                    ' Did you forget to include encoding-indexes.js first?');
+      }
+      enc._encoding = encoding;
+    } else {
+      // Standard behavior.
+      enc._encoding = getEncoding('utf-8');
+
+      if (label !== undefined && 'console' in global) {
+        console.warn('TextEncoder constructor called with encoding label, '
+                     + 'which is ignored.');
+      }
+    }
+
+    // For pre-ES5 runtimes:
+    if (!Object.defineProperty)
+      this.encoding = enc._encoding.name.toLowerCase();
+
+    // 3. Return enc.
+    return enc;
+  }
+
+  if (Object.defineProperty) {
+    // The encoding attribute's getter must return encoding's name.
+    Object.defineProperty(TextEncoder.prototype, 'encoding', {
+      /** @this {TextEncoder} */
+      get: function() { return this._encoding.name.toLowerCase(); }
+    });
+  }
+
+  /**
+   * @param {string=} opt_string The string to encode.
+   * @param {Object=} options
+   * @return {!Uint8Array} Encoded bytes, as a Uint8Array.
+   */
+  TextEncoder.prototype.encode = function encode(opt_string, options) {
+    opt_string = opt_string === undefined ? '' : String(opt_string);
+    options = ToDictionary(options);
+
+    // NOTE: This option is nonstandard. None of the encodings
+    // permitted for encoding (i.e. UTF-8, UTF-16) are stateful when
+    // the input is a USVString so streaming is not necessary.
+    if (!this._do_not_flush)
+      this._encoder = encoders[this._encoding.name]({
+        fatal: this._fatal === 'fatal'});
+    this._do_not_flush = Boolean(options['stream']);
+
+    // 1. Convert input to a stream.
+    var input = new Stream(stringToCodePoints(opt_string));
+
+    // 2. Let output be a new stream
+    var output = [];
+
+    /** @type {?(number|!Array.<number>)} */
+    var result;
+    // 3. While true, run these substeps:
+    while (true) {
+      // 1. Let token be the result of reading from input.
+      var token = input.read();
+      if (token === end_of_stream)
+        break;
+      // 2. Let result be the result of processing token for encoder,
+      // input, output.
+      result = this._encoder.handler(input, token);
+      if (result === finished)
+        break;
+      if (Array.isArray(result))
+        output.push.apply(output, /**@type {!Array.<number>}*/(result));
+      else
+        output.push(result);
+    }
+    // TODO: Align with spec algorithm.
+    if (!this._do_not_flush) {
+      while (true) {
+        result = this._encoder.handler(input, input.read());
+        if (result === finished)
+          break;
+        if (Array.isArray(result))
+          output.push.apply(output, /**@type {!Array.<number>}*/(result));
+        else
+          output.push(result);
+      }
+      this._encoder = null;
+    }
+    // 3. If result is finished, convert output into a byte sequence,
+    // and then return a Uint8Array object wrapping an ArrayBuffer
+    // containing output.
+    return new Uint8Array(output);
+  };
+
+
+  //
+  // 9. The encoding
+  //
+
+  // 9.1 utf-8
+
+  // 9.1.1 utf-8 decoder
+  /**
+   * @constructor
+   * @implements {Decoder}
+   * @param {{fatal: boolean}} options
+   */
+  function UTF8Decoder(options) {
+    var fatal = options.fatal;
+
+    // utf-8's decoder's has an associated utf-8 code point, utf-8
+    // bytes seen, and utf-8 bytes needed (all initially 0), a utf-8
+    // lower boundary (initially 0x80), and a utf-8 upper boundary
+    // (initially 0xBF).
+    var /** @type {number} */ utf8_code_point = 0,
+        /** @type {number} */ utf8_bytes_seen = 0,
+        /** @type {number} */ utf8_bytes_needed = 0,
+        /** @type {number} */ utf8_lower_boundary = 0x80,
+        /** @type {number} */ utf8_upper_boundary = 0xBF;
+
+    /**
+     * @param {Stream} stream The stream of bytes being decoded.
+     * @param {number} bite The next byte read from the stream.
+     * @return {?(number|!Array.<number>)} The next code point(s)
+     *     decoded, or null if not enough data exists in the input
+     *     stream to decode a complete code point.
+     */
+    this.handler = function(stream, bite) {
+      // 1. If byte is end-of-stream and utf-8 bytes needed is not 0,
+      // set utf-8 bytes needed to 0 and return error.
+      if (bite === end_of_stream && utf8_bytes_needed !== 0) {
+        utf8_bytes_needed = 0;
+        return decoderError(fatal);
+      }
+
+      // 2. If byte is end-of-stream, return finished.
+      if (bite === end_of_stream)
+        return finished;
+
+      // 3. If utf-8 bytes needed is 0, based on byte:
+      if (utf8_bytes_needed === 0) {
+
+        // 0x00 to 0x7F
+        if (inRange(bite, 0x00, 0x7F)) {
+          // Return a code point whose value is byte.
+          return bite;
+        }
+
+        // 0xC2 to 0xDF
+        else if (inRange(bite, 0xC2, 0xDF)) {
+          // 1. Set utf-8 bytes needed to 1.
+          utf8_bytes_needed = 1;
+
+          // 2. Set UTF-8 code point to byte & 0x1F.
+          utf8_code_point = bite & 0x1F;
+        }
+
+        // 0xE0 to 0xEF
+        else if (inRange(bite, 0xE0, 0xEF)) {
+          // 1. If byte is 0xE0, set utf-8 lower boundary to 0xA0.
+          if (bite === 0xE0)
+            utf8_lower_boundary = 0xA0;
+          // 2. If byte is 0xED, set utf-8 upper boundary to 0x9F.
+          if (bite === 0xED)
+            utf8_upper_boundary = 0x9F;
+          // 3. Set utf-8 bytes needed to 2.
+          utf8_bytes_needed = 2;
+          // 4. Set UTF-8 code point to byte & 0xF.
+          utf8_code_point = bite & 0xF;
+        }
+
+        // 0xF0 to 0xF4
+        else if (inRange(bite, 0xF0, 0xF4)) {
+          // 1. If byte is 0xF0, set utf-8 lower boundary to 0x90.
+          if (bite === 0xF0)
+            utf8_lower_boundary = 0x90;
+          // 2. If byte is 0xF4, set utf-8 upper boundary to 0x8F.
+          if (bite === 0xF4)
+            utf8_upper_boundary = 0x8F;
+          // 3. Set utf-8 bytes needed to 3.
+          utf8_bytes_needed = 3;
+          // 4. Set UTF-8 code point to byte & 0x7.
+          utf8_code_point = bite & 0x7;
+        }
+
+        // Otherwise
+        else {
+          // Return error.
+          return decoderError(fatal);
+        }
+
+        // Return continue.
+        return null;
+      }
+
+      // 4. If byte is not in the range utf-8 lower boundary to utf-8
+      // upper boundary, inclusive, run these substeps:
+      if (!inRange(bite, utf8_lower_boundary, utf8_upper_boundary)) {
+
+        // 1. Set utf-8 code point, utf-8 bytes needed, and utf-8
+        // bytes seen to 0, set utf-8 lower boundary to 0x80, and set
+        // utf-8 upper boundary to 0xBF.
+        utf8_code_point = utf8_bytes_needed = utf8_bytes_seen = 0;
+        utf8_lower_boundary = 0x80;
+        utf8_upper_boundary = 0xBF;
+
+        // 2. Prepend byte to stream.
+        stream.prepend(bite);
+
+        // 3. Return error.
+        return decoderError(fatal);
+      }
+
+      // 5. Set utf-8 lower boundary to 0x80 and utf-8 upper boundary
+      // to 0xBF.
+      utf8_lower_boundary = 0x80;
+      utf8_upper_boundary = 0xBF;
+
+      // 6. Set UTF-8 code point to (UTF-8 code point << 6) | (byte &
+      // 0x3F)
+      utf8_code_point = (utf8_code_point << 6) | (bite & 0x3F);
+
+      // 7. Increase utf-8 bytes seen by one.
+      utf8_bytes_seen += 1;
+
+      // 8. If utf-8 bytes seen is not equal to utf-8 bytes needed,
+      // continue.
+      if (utf8_bytes_seen !== utf8_bytes_needed)
+        return null;
+
+      // 9. Let code point be utf-8 code point.
+      var code_point = utf8_code_point;
+
+      // 10. Set utf-8 code point, utf-8 bytes needed, and utf-8 bytes
+      // seen to 0.
+      utf8_code_point = utf8_bytes_needed = utf8_bytes_seen = 0;
+
+      // 11. Return a code point whose value is code point.
+      return code_point;
+    };
+  }
+
+  // 9.1.2 utf-8 encoder
+  /**
+   * @constructor
+   * @implements {Encoder}
+   * @param {{fatal: boolean}} options
+   */
+  function UTF8Encoder(options) {
+    var fatal = options.fatal;
+    /**
+     * @param {Stream} stream Input stream.
+     * @param {number} code_point Next code point read from the stream.
+     * @return {(number|!Array.<number>)} Byte(s) to emit.
+     */
+    this.handler = function(stream, code_point) {
+      // 1. If code point is end-of-stream, return finished.
+      if (code_point === end_of_stream)
+        return finished;
+
+      // 2. If code point is an ASCII code point, return a byte whose
+      // value is code point.
+      if (isASCIICodePoint(code_point))
+        return code_point;
+
+      // 3. Set count and offset based on the range code point is in:
+      var count, offset;
+      // U+0080 to U+07FF, inclusive:
+      if (inRange(code_point, 0x0080, 0x07FF)) {
+        // 1 and 0xC0
+        count = 1;
+        offset = 0xC0;
+      }
+      // U+0800 to U+FFFF, inclusive:
+      else if (inRange(code_point, 0x0800, 0xFFFF)) {
+        // 2 and 0xE0
+        count = 2;
+        offset = 0xE0;
+      }
+      // U+10000 to U+10FFFF, inclusive:
+      else if (inRange(code_point, 0x10000, 0x10FFFF)) {
+        // 3 and 0xF0
+        count = 3;
+        offset = 0xF0;
+      }
+
+      // 4. Let bytes be a byte sequence whose first byte is (code
+      // point >> (6 × count)) + offset.
+      var bytes = [(code_point >> (6 * count)) + offset];
+
+      // 5. Run these substeps while count is greater than 0:
+      while (count > 0) {
+
+        // 1. Set temp to code point >> (6 × (count − 1)).
+        var temp = code_point >> (6 * (count - 1));
+
+        // 2. Append to bytes 0x80 | (temp & 0x3F).
+        bytes.push(0x80 | (temp & 0x3F));
+
+        // 3. Decrease count by one.
+        count -= 1;
+      }
+
+      // 6. Return bytes bytes, in order.
+      return bytes;
+    };
+  }
+
+  /** @param {{fatal: boolean}} options */
+  encoders['UTF-8'] = function(options) {
+    return new UTF8Encoder(options);
+  };
+  /** @param {{fatal: boolean}} options */
+  decoders['UTF-8'] = function(options) {
+    return new UTF8Decoder(options);
+  };
+
+  //
+  // 10. Legacy single-byte encodings
+  //
+
+  // 10.1 single-byte decoder
+  /**
+   * @constructor
+   * @implements {Decoder}
+   * @param {!Array.<number>} index The encoding index.
+   * @param {{fatal: boolean}} options
+   */
+  function SingleByteDecoder(index, options) {
+    var fatal = options.fatal;
+    /**
+     * @param {Stream} stream The stream of bytes being decoded.
+     * @param {number} bite The next byte read from the stream.
+     * @return {?(number|!Array.<number>)} The next code point(s)
+     *     decoded, or null if not enough data exists in the input
+     *     stream to decode a complete code point.
+     */
+    this.handler = function(stream, bite) {
+      // 1. If byte is end-of-stream, return finished.
+      if (bite === end_of_stream)
+        return finished;
+
+      // 2. If byte is an ASCII byte, return a code point whose value
+      // is byte.
+      if (isASCIIByte(bite))
+        return bite;
+
+      // 3. Let code point be the index code point for byte − 0x80 in
+      // index single-byte.
+      var code_point = index[bite - 0x80];
+
+      // 4. If code point is null, return error.
+      if (code_point === null)
+        return decoderError(fatal);
+
+      // 5. Return a code point whose value is code point.
+      return code_point;
+    };
+  }
+
+  // 10.2 single-byte encoder
+  /**
+   * @constructor
+   * @implements {Encoder}
+   * @param {!Array.<?number>} index The encoding index.
+   * @param {{fatal: boolean}} options
+   */
+  function SingleByteEncoder(index, options) {
+    var fatal = options.fatal;
+    /**
+     * @param {Stream} stream Input stream.
+     * @param {number} code_point Next code point read from the stream.
+     * @return {(number|!Array.<number>)} Byte(s) to emit.
+     */
+    this.handler = function(stream, code_point) {
+      // 1. If code point is end-of-stream, return finished.
+      if (code_point === end_of_stream)
+        return finished;
+
+      // 2. If code point is an ASCII code point, return a byte whose
+      // value is code point.
+      if (isASCIICodePoint(code_point))
+        return code_point;
+
+      // 3. Let pointer be the index pointer for code point in index
+      // single-byte.
+      var pointer = indexPointerFor(code_point, index);
+
+      // 4. If pointer is null, return error with code point.
+      if (pointer === null)
+        encoderError(code_point);
+
+      // 5. Return a byte whose value is pointer + 0x80.
+      return pointer + 0x80;
+    };
+  }
+
+  (function() {
+    if (!('encoding-indexes' in global))
+      return;
+    encodings.forEach(function(category) {
+      if (category.heading !== 'Legacy single-byte encodings')
+        return;
+      category.encodings.forEach(function(encoding) {
+        var name = encoding.name;
+        var idx = index(name.toLowerCase());
+        /** @param {{fatal: boolean}} options */
+        decoders[name] = function(options) {
+          return new SingleByteDecoder(idx, options);
+        };
+        /** @param {{fatal: boolean}} options */
+        encoders[name] = function(options) {
+          return new SingleByteEncoder(idx, options);
+        };
+      });
+    });
+  }());
+
+  //
+  // 11. Legacy multi-byte Chinese (simplified) encodings
+  //
+
+  // 11.1 gbk
+
+  // 11.1.1 gbk decoder
+  // gbk's decoder is gb18030's decoder.
+  /** @param {{fatal: boolean}} options */
+  decoders['GBK'] = function(options) {
+    return new GB18030Decoder(options);
+  };
+
+  // 11.1.2 gbk encoder
+  // gbk's encoder is gb18030's encoder with its gbk flag set.
+  /** @param {{fatal: boolean}} options */
+  encoders['GBK'] = function(options) {
+    return new GB18030Encoder(options, true);
+  };
+
+  // 11.2 gb18030
+  // 11.2.1 gb18030 decoder
+  /**
+   * @constructor
+   * @implements {Decoder}
+   * @param {{fatal: boolean}} options
+   */
+  function GB18030Decoder(options) {
+    var fatal = options.fatal;
+    // gb18030's decoder has an associated gb18030 first, gb18030
+    // second, and gb18030 third (all initially 0x00).
+    var /** @type {number} */ gb18030_first = 0x00,
+        /** @type {number} */ gb18030_second = 0x00,
+        /** @type {number} */ gb18030_third = 0x00;
+    /**
+     * @param {Stream} stream The stream of bytes being decoded.
+     * @param {number} bite The next byte read from the stream.
+     * @return {?(number|!Array.<number>)} The next code point(s)
+     *     decoded, or null if not enough data exists in the input
+     *     stream to decode a complete code point.
+     */
+    this.handler = function(stream, bite) {
+      // 1. If byte is end-of-stream and gb18030 first, gb18030
+      // second, and gb18030 third are 0x00, return finished.
+      if (bite === end_of_stream && gb18030_first === 0x00 &&
+          gb18030_second === 0x00 && gb18030_third === 0x00) {
+        return finished;
+      }
+      // 2. If byte is end-of-stream, and gb18030 first, gb18030
+      // second, or gb18030 third is not 0x00, set gb18030 first,
+      // gb18030 second, and gb18030 third to 0x00, and return error.
+      if (bite === end_of_stream &&
+          (gb18030_first !== 0x00 || gb18030_second !== 0x00 ||
+           gb18030_third !== 0x00)) {
+        gb18030_first = 0x00;
+        gb18030_second = 0x00;
+        gb18030_third = 0x00;
+        decoderError(fatal);
+      }
+      var code_point;
+      // 3. If gb18030 third is not 0x00, run these substeps:
+      if (gb18030_third !== 0x00) {
+        // 1. Let code point be null.
+        code_point = null;
+        // 2. If byte is in the range 0x30 to 0x39, inclusive, set
+        // code point to the index gb18030 ranges code point for
+        // (((gb18030 first − 0x81) × 10 + gb18030 second − 0x30) ×
+        // 126 + gb18030 third − 0x81) × 10 + byte − 0x30.
+        if (inRange(bite, 0x30, 0x39)) {
+          code_point = indexGB18030RangesCodePointFor(
+              (((gb18030_first - 0x81) * 10 + gb18030_second - 0x30) * 126 +
+               gb18030_third - 0x81) * 10 + bite - 0x30);
+        }
+
+        // 3. Let buffer be a byte sequence consisting of gb18030
+        // second, gb18030 third, and byte, in order.
+        var buffer = [gb18030_second, gb18030_third, bite];
+
+        // 4. Set gb18030 first, gb18030 second, and gb18030 third to
+        // 0x00.
+        gb18030_first = 0x00;
+        gb18030_second = 0x00;
+        gb18030_third = 0x00;
+
+        // 5. If code point is null, prepend buffer to stream and
+        // return error.
+        if (code_point === null) {
+          stream.prepend(buffer);
+          return decoderError(fatal);
+        }
+
+        // 6. Return a code point whose value is code point.
+        return code_point;
+      }
+
+      // 4. If gb18030 second is not 0x00, run these substeps:
+      if (gb18030_second !== 0x00) {
+
+        // 1. If byte is in the range 0x81 to 0xFE, inclusive, set
+        // gb18030 third to byte and return continue.
+        if (inRange(bite, 0x81, 0xFE)) {
+          gb18030_third = bite;
+          return null;
+        }
+
+        // 2. Prepend gb18030 second followed by byte to stream, set
+        // gb18030 first and gb18030 second to 0x00, and return error.
+        stream.prepend([gb18030_second, bite]);
+        gb18030_first = 0x00;
+        gb18030_second = 0x00;
+        return decoderError(fatal);
+      }
+
+      // 5. If gb18030 first is not 0x00, run these substeps:
+      if (gb18030_first !== 0x00) {
+
+        // 1. If byte is in the range 0x30 to 0x39, inclusive, set
+        // gb18030 second to byte and return continue.
+        if (inRange(bite, 0x30, 0x39)) {
+          gb18030_second = bite;
+          return null;
+        }
+
+        // 2. Let lead be gb18030 first, let pointer be null, and set
+        // gb18030 first to 0x00.
+        var lead = gb18030_first;
+        var pointer = null;
+        gb18030_first = 0x00;
+
+        // 3. Let offset be 0x40 if byte is less than 0x7F and 0x41
+        // otherwise.
+        var offset = bite < 0x7F ? 0x40 : 0x41;
+
+        // 4. If byte is in the range 0x40 to 0x7E, inclusive, or 0x80
+        // to 0xFE, inclusive, set pointer to (lead − 0x81) × 190 +
+        // (byte − offset).
+        if (inRange(bite, 0x40, 0x7E) || inRange(bite, 0x80, 0xFE))
+          pointer = (lead - 0x81) * 190 + (bite - offset);
+
+        // 5. Let code point be null if pointer is null and the index
+        // code point for pointer in index gb18030 otherwise.
+        code_point = pointer === null ? null :
+            indexCodePointFor(pointer, index('gb18030'));
+
+        // 6. If code point is null and byte is an ASCII byte, prepend
+        // byte to stream.
+        if (code_point === null && isASCIIByte(bite))
+          stream.prepend(bite);
+
+        // 7. If code point is null, return error.
+        if (code_point === null)
+          return decoderError(fatal);
+
+        // 8. Return a code point whose value is code point.
+        return code_point;
+      }
+
+      // 6. If byte is an ASCII byte, return a code point whose value
+      // is byte.
+      if (isASCIIByte(bite))
+        return bite;
+
+      // 7. If byte is 0x80, return code point U+20AC.
+      if (bite === 0x80)
+        return 0x20AC;
+
+      // 8. If byte is in the range 0x81 to 0xFE, inclusive, set
+      // gb18030 first to byte and return continue.
+      if (inRange(bite, 0x81, 0xFE)) {
+        gb18030_first = bite;
+        return null;
+      }
+
+      // 9. Return error.
+      return decoderError(fatal);
+    };
+  }
+
+  // 11.2.2 gb18030 encoder
+  /**
+   * @constructor
+   * @implements {Encoder}
+   * @param {{fatal: boolean}} options
+   * @param {boolean=} gbk_flag
+   */
+  function GB18030Encoder(options, gbk_flag) {
+    var fatal = options.fatal;
+    // gb18030's decoder has an associated gbk flag (initially unset).
+    /**
+     * @param {Stream} stream Input stream.
+     * @param {number} code_point Next code point read from the stream.
+     * @return {(number|!Array.<number>)} Byte(s) to emit.
+     */
+    this.handler = function(stream, code_point) {
+      // 1. If code point is end-of-stream, return finished.
+      if (code_point === end_of_stream)
+        return finished;
+
+      // 2. If code point is an ASCII code point, return a byte whose
+      // value is code point.
+      if (isASCIICodePoint(code_point))
+        return code_point;
+
+      // 3. If code point is U+E5E5, return error with code point.
+      if (code_point === 0xE5E5)
+        return encoderError(code_point);
+
+      // 4. If the gbk flag is set and code point is U+20AC, return
+      // byte 0x80.
+      if (gbk_flag && code_point === 0x20AC)
+        return 0x80;
+
+      // 5. Let pointer be the index pointer for code point in index
+      // gb18030.
+      var pointer = indexPointerFor(code_point, index('gb18030'));
+
+      // 6. If pointer is not null, run these substeps:
+      if (pointer !== null) {
+
+        // 1. Let lead be floor(pointer / 190) + 0x81.
+        var lead = floor(pointer / 190) + 0x81;
+
+        // 2. Let trail be pointer % 190.
+        var trail = pointer % 190;
+
+        // 3. Let offset be 0x40 if trail is less than 0x3F and 0x41 otherwise.
+        var offset = trail < 0x3F ? 0x40 : 0x41;
+
+        // 4. Return two bytes whose values are lead and trail + offset.
+        return [lead, trail + offset];
+      }
+
+      // 7. If gbk flag is set, return error with code point.
+      if (gbk_flag)
+        return encoderError(code_point);
+
+      // 8. Set pointer to the index gb18030 ranges pointer for code
+      // point.
+      pointer = indexGB18030RangesPointerFor(code_point);
+
+      // 9. Let byte1 be floor(pointer / 10 / 126 / 10).
+      var byte1 = floor(pointer / 10 / 126 / 10);
+
+      // 10. Set pointer to pointer − byte1 × 10 × 126 × 10.
+      pointer = pointer - byte1 * 10 * 126 * 10;
+
+      // 11. Let byte2 be floor(pointer / 10 / 126).
+      var byte2 = floor(pointer / 10 / 126);
+
+      // 12. Set pointer to pointer − byte2 × 10 × 126.
+      pointer = pointer - byte2 * 10 * 126;
+
+      // 13. Let byte3 be floor(pointer / 10).
+      var byte3 = floor(pointer / 10);
+
+      // 14. Let byte4 be pointer − byte3 × 10.
+      var byte4 = pointer - byte3 * 10;
+
+      // 15. Return four bytes whose values are byte1 + 0x81, byte2 +
+      // 0x30, byte3 + 0x81, byte4 + 0x30.
+      return [byte1 + 0x81,
+              byte2 + 0x30,
+              byte3 + 0x81,
+              byte4 + 0x30];
+    };
+  }
+
+  /** @param {{fatal: boolean}} options */
+  encoders['gb18030'] = function(options) {
+    return new GB18030Encoder(options);
+  };
+  /** @param {{fatal: boolean}} options */
+  decoders['gb18030'] = function(options) {
+    return new GB18030Decoder(options);
+  };
+
+
+  //
+  // 12. Legacy multi-byte Chinese (traditional) encodings
+  //
+
+  // 12.1 Big5
+
+  // 12.1.1 Big5 decoder
+  /**
+   * @constructor
+   * @implements {Decoder}
+   * @param {{fatal: boolean}} options
+   */
+  function Big5Decoder(options) {
+    var fatal = options.fatal;
+    // Big5's decoder has an associated Big5 lead (initially 0x00).
+    var /** @type {number} */ Big5_lead = 0x00;
+
+    /**
+     * @param {Stream} stream The stream of bytes being decoded.
+     * @param {number} bite The next byte read from the stream.
+     * @return {?(number|!Array.<number>)} The next code point(s)
+     *     decoded, or null if not enough data exists in the input
+     *     stream to decode a complete code point.
+     */
+    this.handler = function(stream, bite) {
+      // 1. If byte is end-of-stream and Big5 lead is not 0x00, set
+      // Big5 lead to 0x00 and return error.
+      if (bite === end_of_stream && Big5_lead !== 0x00) {
+        Big5_lead = 0x00;
+        return decoderError(fatal);
+      }
+
+      // 2. If byte is end-of-stream and Big5 lead is 0x00, return
+      // finished.
+      if (bite === end_of_stream && Big5_lead === 0x00)
+        return finished;
+
+      // 3. If Big5 lead is not 0x00, let lead be Big5 lead, let
+      // pointer be null, set Big5 lead to 0x00, and then run these
+      // substeps:
+      if (Big5_lead !== 0x00) {
+        var lead = Big5_lead;
+        var pointer = null;
+        Big5_lead = 0x00;
+
+        // 1. Let offset be 0x40 if byte is less than 0x7F and 0x62
+        // otherwise.
+        var offset = bite < 0x7F ? 0x40 : 0x62;
+
+        // 2. If byte is in the range 0x40 to 0x7E, inclusive, or 0xA1
+        // to 0xFE, inclusive, set pointer to (lead − 0x81) × 157 +
+        // (byte − offset).
+        if (inRange(bite, 0x40, 0x7E) || inRange(bite, 0xA1, 0xFE))
+          pointer = (lead - 0x81) * 157 + (bite - offset);
+
+        // 3. If there is a row in the table below whose first column
+        // is pointer, return the two code points listed in its second
+        // column
+        // Pointer | Code points
+        // --------+--------------
+        // 1133    | U+00CA U+0304
+        // 1135    | U+00CA U+030C
+        // 1164    | U+00EA U+0304
+        // 1166    | U+00EA U+030C
+        switch (pointer) {
+          case 1133: return [0x00CA, 0x0304];
+          case 1135: return [0x00CA, 0x030C];
+          case 1164: return [0x00EA, 0x0304];
+          case 1166: return [0x00EA, 0x030C];
+        }
+
+        // 4. Let code point be null if pointer is null and the index
+        // code point for pointer in index Big5 otherwise.
+        var code_point = (pointer === null) ? null :
+            indexCodePointFor(pointer, index('big5'));
+
+        // 5. If code point is null and byte is an ASCII byte, prepend
+        // byte to stream.
+        if (code_point === null && isASCIIByte(bite))
+          stream.prepend(bite);
+
+        // 6. If code point is null, return error.
+        if (code_point === null)
+          return decoderError(fatal);
+
+        // 7. Return a code point whose value is code point.
+        return code_point;
+      }
+
+      // 4. If byte is an ASCII byte, return a code point whose value
+      // is byte.
+      if (isASCIIByte(bite))
+        return bite;
+
+      // 5. If byte is in the range 0x81 to 0xFE, inclusive, set Big5
+      // lead to byte and return continue.
+      if (inRange(bite, 0x81, 0xFE)) {
+        Big5_lead = bite;
+        return null;
+      }
+
+      // 6. Return error.
+      return decoderError(fatal);
+    };
+  }
+
+  // 12.1.2 Big5 encoder
+  /**
+   * @constructor
+   * @implements {Encoder}
+   * @param {{fatal: boolean}} options
+   */
+  function Big5Encoder(options) {
+    var fatal = options.fatal;
+    /**
+     * @param {Stream} stream Input stream.
+     * @param {number} code_point Next code point read from the stream.
+     * @return {(number|!Array.<number>)} Byte(s) to emit.
+     */
+    this.handler = function(stream, code_point) {
+      // 1. If code point is end-of-stream, return finished.
+      if (code_point === end_of_stream)
+        return finished;
+
+      // 2. If code point is an ASCII code point, return a byte whose
+      // value is code point.
+      if (isASCIICodePoint(code_point))
+        return code_point;
+
+      // 3. Let pointer be the index Big5 pointer for code point.
+      var pointer = indexBig5PointerFor(code_point);
+
+      // 4. If pointer is null, return error with code point.
+      if (pointer === null)
+        return encoderError(code_point);
+
+      // 5. Let lead be floor(pointer / 157) + 0x81.
+      var lead = floor(pointer / 157) + 0x81;
+
+      // 6. If lead is less than 0xA1, return error with code point.
+      if (lead < 0xA1)
+        return encoderError(code_point);
+
+      // 7. Let trail be pointer % 157.
+      var trail = pointer % 157;
+
+      // 8. Let offset be 0x40 if trail is less than 0x3F and 0x62
+      // otherwise.
+      var offset = trail < 0x3F ? 0x40 : 0x62;
+
+      // Return two bytes whose values are lead and trail + offset.
+      return [lead, trail + offset];
+    };
+  }
+
+  /** @param {{fatal: boolean}} options */
+  encoders['Big5'] = function(options) {
+    return new Big5Encoder(options);
+  };
+  /** @param {{fatal: boolean}} options */
+  decoders['Big5'] = function(options) {
+    return new Big5Decoder(options);
+  };
+
+
+  //
+  // 13. Legacy multi-byte Japanese encodings
+  //
+
+  // 13.1 euc-jp
+
+  // 13.1.1 euc-jp decoder
+  /**
+   * @constructor
+   * @implements {Decoder}
+   * @param {{fatal: boolean}} options
+   */
+  function EUCJPDecoder(options) {
+    var fatal = options.fatal;
+
+    // euc-jp's decoder has an associated euc-jp jis0212 flag
+    // (initially unset) and euc-jp lead (initially 0x00).
+    var /** @type {boolean} */ eucjp_jis0212_flag = false,
+        /** @type {number} */ eucjp_lead = 0x00;
+
+    /**
+     * @param {Stream} stream The stream of bytes being decoded.
+     * @param {number} bite The next byte read from the stream.
+     * @return {?(number|!Array.<number>)} The next code point(s)
+     *     decoded, or null if not enough data exists in the input
+     *     stream to decode a complete code point.
+     */
+    this.handler = function(stream, bite) {
+      // 1. If byte is end-of-stream and euc-jp lead is not 0x00, set
+      // euc-jp lead to 0x00, and return error.
+      if (bite === end_of_stream && eucjp_lead !== 0x00) {
+        eucjp_lead = 0x00;
+        return decoderError(fatal);
+      }
+
+      // 2. If byte is end-of-stream and euc-jp lead is 0x00, return
+      // finished.
+      if (bite === end_of_stream && eucjp_lead === 0x00)
+        return finished;
+
+      // 3. If euc-jp lead is 0x8E and byte is in the range 0xA1 to
+      // 0xDF, inclusive, set euc-jp lead to 0x00 and return a code
+      // point whose value is 0xFF61 − 0xA1 + byte.
+      if (eucjp_lead === 0x8E && inRange(bite, 0xA1, 0xDF)) {
+        eucjp_lead = 0x00;
+        return 0xFF61 - 0xA1 + bite;
+      }
+
+      // 4. If euc-jp lead is 0x8F and byte is in the range 0xA1 to
+      // 0xFE, inclusive, set the euc-jp jis0212 flag, set euc-jp lead
+      // to byte, and return continue.
+      if (eucjp_lead === 0x8F && inRange(bite, 0xA1, 0xFE)) {
+        eucjp_jis0212_flag = true;
+        eucjp_lead = bite;
+        return null;
+      }
+
+      // 5. If euc-jp lead is not 0x00, let lead be euc-jp lead, set
+      // euc-jp lead to 0x00, and run these substeps:
+      if (eucjp_lead !== 0x00) {
+        var lead = eucjp_lead;
+        eucjp_lead = 0x00;
+
+        // 1. Let code point be null.
+        var code_point = null;
+
+        // 2. If lead and byte are both in the range 0xA1 to 0xFE,
+        // inclusive, set code point to the index code point for (lead
+        // − 0xA1) × 94 + byte − 0xA1 in index jis0208 if the euc-jp
+        // jis0212 flag is unset and in index jis0212 otherwise.
+        if (inRange(lead, 0xA1, 0xFE) && inRange(bite, 0xA1, 0xFE)) {
+          code_point = indexCodePointFor(
+            (lead - 0xA1) * 94 + (bite - 0xA1),
+            index(!eucjp_jis0212_flag ? 'jis0208' : 'jis0212'));
+        }
+
+        // 3. Unset the euc-jp jis0212 flag.
+        eucjp_jis0212_flag = false;
+
+        // 4. If byte is not in the range 0xA1 to 0xFE, inclusive,
+        // prepend byte to stream.
+        if (!inRange(bite, 0xA1, 0xFE))
+          stream.prepend(bite);
+
+        // 5. If code point is null, return error.
+        if (code_point === null)
+          return decoderError(fatal);
+
+        // 6. Return a code point whose value is code point.
+        return code_point;
+      }
+
+      // 6. If byte is an ASCII byte, return a code point whose value
+      // is byte.
+      if (isASCIIByte(bite))
+        return bite;
+
+      // 7. If byte is 0x8E, 0x8F, or in the range 0xA1 to 0xFE,
+      // inclusive, set euc-jp lead to byte and return continue.
+      if (bite === 0x8E || bite === 0x8F || inRange(bite, 0xA1, 0xFE)) {
+        eucjp_lead = bite;
+        return null;
+      }
+
+      // 8. Return error.
+      return decoderError(fatal);
+    };
+  }
+
+  // 13.1.2 euc-jp encoder
+  /**
+   * @constructor
+   * @implements {Encoder}
+   * @param {{fatal: boolean}} options
+   */
+  function EUCJPEncoder(options) {
+    var fatal = options.fatal;
+    /**
+     * @param {Stream} stream Input stream.
+     * @param {number} code_point Next code point read from the stream.
+     * @return {(number|!Array.<number>)} Byte(s) to emit.
+     */
+    this.handler = function(stream, code_point) {
+      // 1. If code point is end-of-stream, return finished.
+      if (code_point === end_of_stream)
+        return finished;
+
+      // 2. If code point is an ASCII code point, return a byte whose
+      // value is code point.
+      if (isASCIICodePoint(code_point))
+        return code_point;
+
+      // 3. If code point is U+00A5, return byte 0x5C.
+      if (code_point === 0x00A5)
+        return 0x5C;
+
+      // 4. If code point is U+203E, return byte 0x7E.
+      if (code_point === 0x203E)
+        return 0x7E;
+
+      // 5. If code point is in the range U+FF61 to U+FF9F, inclusive,
+      // return two bytes whose values are 0x8E and code point −
+      // 0xFF61 + 0xA1.
+      if (inRange(code_point, 0xFF61, 0xFF9F))
+        return [0x8E, code_point - 0xFF61 + 0xA1];
+
+      // 6. If code point is U+2212, set it to U+FF0D.
+      if (code_point === 0x2212)
+        code_point = 0xFF0D;
+
+      // 7. Let pointer be the index pointer for code point in index
+      // jis0208.
+      var pointer = indexPointerFor(code_point, index('jis0208'));
+
+      // 8. If pointer is null, return error with code point.
+      if (pointer === null)
+        return encoderError(code_point);
+
+      // 9. Let lead be floor(pointer / 94) + 0xA1.
+      var lead = floor(pointer / 94) + 0xA1;
+
+      // 10. Let trail be pointer % 94 + 0xA1.
+      var trail = pointer % 94 + 0xA1;
+
+      // 11. Return two bytes whose values are lead and trail.
+      return [lead, trail];
+    };
+  }
+
+  /** @param {{fatal: boolean}} options */
+  encoders['EUC-JP'] = function(options) {
+    return new EUCJPEncoder(options);
+  };
+  /** @param {{fatal: boolean}} options */
+  decoders['EUC-JP'] = function(options) {
+    return new EUCJPDecoder(options);
+  };
+
+  // 13.2 iso-2022-jp
+
+  // 13.2.1 iso-2022-jp decoder
+  /**
+   * @constructor
+   * @implements {Decoder}
+   * @param {{fatal: boolean}} options
+   */
+  function ISO2022JPDecoder(options) {
+    var fatal = options.fatal;
+    /** @enum */
+    var states = {
+      ASCII: 0,
+      Roman: 1,
+      Katakana: 2,
+      LeadByte: 3,
+      TrailByte: 4,
+      EscapeStart: 5,
+      Escape: 6
+    };
+    // iso-2022-jp's decoder has an associated iso-2022-jp decoder
+    // state (initially ASCII), iso-2022-jp decoder output state
+    // (initially ASCII), iso-2022-jp lead (initially 0x00), and
+    // iso-2022-jp output flag (initially unset).
+    var /** @type {number} */ iso2022jp_decoder_state = states.ASCII,
+        /** @type {number} */ iso2022jp_decoder_output_state = states.ASCII,
+        /** @type {number} */ iso2022jp_lead = 0x00,
+        /** @type {boolean} */ iso2022jp_output_flag = false;
+    /**
+     * @param {Stream} stream The stream of bytes being decoded.
+     * @param {number} bite The next byte read from the stream.
+     * @return {?(number|!Array.<number>)} The next code point(s)
+     *     decoded, or null if not enough data exists in the input
+     *     stream to decode a complete code point.
+     */
+    this.handler = function(stream, bite) {
+      // switching on iso-2022-jp decoder state:
+      switch (iso2022jp_decoder_state) {
+      default:
+      case states.ASCII:
+        // ASCII
+        // Based on byte:
+
+        // 0x1B
+        if (bite === 0x1B) {
+          // Set iso-2022-jp decoder state to escape start and return
+          // continue.
+          iso2022jp_decoder_state = states.EscapeStart;
+          return null;
+        }
+
+        // 0x00 to 0x7F, excluding 0x0E, 0x0F, and 0x1B
+        if (inRange(bite, 0x00, 0x7F) && bite !== 0x0E
+            && bite !== 0x0F && bite !== 0x1B) {
+          // Unset the iso-2022-jp output flag and return a code point
+          // whose value is byte.
+          iso2022jp_output_flag = false;
+          return bite;
+        }
+
+        // end-of-stream
+        if (bite === end_of_stream) {
+          // Return finished.
+          return finished;
+        }
+
+        // Otherwise
+        // Unset the iso-2022-jp output flag and return error.
+        iso2022jp_output_flag = false;
+        return decoderError(fatal);
+
+      case states.Roman:
+        // Roman
+        // Based on byte:
+
+        // 0x1B
+        if (bite === 0x1B) {
+          // Set iso-2022-jp decoder state to escape start and return
+          // continue.
+          iso2022jp_decoder_state = states.EscapeStart;
+          return null;
+        }
+
+        // 0x5C
+        if (bite === 0x5C) {
+          // Unset the iso-2022-jp output flag and return code point
+          // U+00A5.
+          iso2022jp_output_flag = false;
+          return 0x00A5;
+        }
+
+        // 0x7E
+        if (bite === 0x7E) {
+          // Unset the iso-2022-jp output flag and return code point
+          // U+203E.
+          iso2022jp_output_flag = false;
+          return 0x203E;
+        }
+
+        // 0x00 to 0x7F, excluding 0x0E, 0x0F, 0x1B, 0x5C, and 0x7E
+        if (inRange(bite, 0x00, 0x7F) && bite !== 0x0E && bite !== 0x0F
+            && bite !== 0x1B && bite !== 0x5C && bite !== 0x7E) {
+          // Unset the iso-2022-jp output flag and return a code point
+          // whose value is byte.
+          iso2022jp_output_flag = false;
+          return bite;
+        }
+
+        // end-of-stream
+        if (bite === end_of_stream) {
+          // Return finished.
+          return finished;
+        }
+
+        // Otherwise
+        // Unset the iso-2022-jp output flag and return error.
+        iso2022jp_output_flag = false;
+        return decoderError(fatal);
+
+      case states.Katakana:
+        // Katakana
+        // Based on byte:
+
+        // 0x1B
+        if (bite === 0x1B) {
+          // Set iso-2022-jp decoder state to escape start and return
+          // continue.
+          iso2022jp_decoder_state = states.EscapeStart;
+          return null;
+        }
+
+        // 0x21 to 0x5F
+        if (inRange(bite, 0x21, 0x5F)) {
+          // Unset the iso-2022-jp output flag and return a code point
+          // whose value is 0xFF61 − 0x21 + byte.
+          iso2022jp_output_flag = false;
+          return 0xFF61 - 0x21 + bite;
+        }
+
+        // end-of-stream
+        if (bite === end_of_stream) {
+          // Return finished.
+          return finished;
+        }
+
+        // Otherwise
+        // Unset the iso-2022-jp output flag and return error.
+        iso2022jp_output_flag = false;
+        return decoderError(fatal);
+
+      case states.LeadByte:
+        // Lead byte
+        // Based on byte:
+
+        // 0x1B
+        if (bite === 0x1B) {
+          // Set iso-2022-jp decoder state to escape start and return
+          // continue.
+          iso2022jp_decoder_state = states.EscapeStart;
+          return null;
+        }
+
+        // 0x21 to 0x7E
+        if (inRange(bite, 0x21, 0x7E)) {
+          // Unset the iso-2022-jp output flag, set iso-2022-jp lead
+          // to byte, iso-2022-jp decoder state to trail byte, and
+          // return continue.
+          iso2022jp_output_flag = false;
+          iso2022jp_lead = bite;
+          iso2022jp_decoder_state = states.TrailByte;
+          return null;
+        }
+
+        // end-of-stream
+        if (bite === end_of_stream) {
+          // Return finished.
+          return finished;
+        }
+
+        // Otherwise
+        // Unset the iso-2022-jp output flag and return error.
+        iso2022jp_output_flag = false;
+        return decoderError(fatal);
+
+      case states.TrailByte:
+        // Trail byte
+        // Based on byte:
+
+        // 0x1B
+        if (bite === 0x1B) {
+          // Set iso-2022-jp decoder state to escape start and return
+          // continue.
+          iso2022jp_decoder_state = states.EscapeStart;
+          return decoderError(fatal);
+        }
+
+        // 0x21 to 0x7E
+        if (inRange(bite, 0x21, 0x7E)) {
+          // 1. Set the iso-2022-jp decoder state to lead byte.
+          iso2022jp_decoder_state = states.LeadByte;
+
+          // 2. Let pointer be (iso-2022-jp lead − 0x21) × 94 + byte − 0x21.
+          var pointer = (iso2022jp_lead - 0x21) * 94 + bite - 0x21;
+
+          // 3. Let code point be the index code point for pointer in
+          // index jis0208.
+          var code_point = indexCodePointFor(pointer, index('jis0208'));
+
+          // 4. If code point is null, return error.
+          if (code_point === null)
+            return decoderError(fatal);
+
+          // 5. Return a code point whose value is code point.
+          return code_point;
+        }
+
+        // end-of-stream
+        if (bite === end_of_stream) {
+          // Set the iso-2022-jp decoder state to lead byte, prepend
+          // byte to stream, and return error.
+          iso2022jp_decoder_state = states.LeadByte;
+          stream.prepend(bite);
+          return decoderError(fatal);
+        }
+
+        // Otherwise
+        // Set iso-2022-jp decoder state to lead byte and return
+        // error.
+        iso2022jp_decoder_state = states.LeadByte;
+        return decoderError(fatal);
+
+      case states.EscapeStart:
+        // Escape start
+
+        // 1. If byte is either 0x24 or 0x28, set iso-2022-jp lead to
+        // byte, iso-2022-jp decoder state to escape, and return
+        // continue.
+        if (bite === 0x24 || bite === 0x28) {
+          iso2022jp_lead = bite;
+          iso2022jp_decoder_state = states.Escape;
+          return null;
+        }
+
+        // 2. Prepend byte to stream.
+        stream.prepend(bite);
+
+        // 3. Unset the iso-2022-jp output flag, set iso-2022-jp
+        // decoder state to iso-2022-jp decoder output state, and
+        // return error.
+        iso2022jp_output_flag = false;
+        iso2022jp_decoder_state = iso2022jp_decoder_output_state;
+        return decoderError(fatal);
+
+      case states.Escape:
+        // Escape
+
+        // 1. Let lead be iso-2022-jp lead and set iso-2022-jp lead to
+        // 0x00.
+        var lead = iso2022jp_lead;
+        iso2022jp_lead = 0x00;
+
+        // 2. Let state be null.
+        var state = null;
+
+        // 3. If lead is 0x28 and byte is 0x42, set state to ASCII.
+        if (lead === 0x28 && bite === 0x42)
+          state = states.ASCII;
+
+        // 4. If lead is 0x28 and byte is 0x4A, set state to Roman.
+        if (lead === 0x28 && bite === 0x4A)
+          state = states.Roman;
+
+        // 5. If lead is 0x28 and byte is 0x49, set state to Katakana.
+        if (lead === 0x28 && bite === 0x49)
+          state = states.Katakana;
+
+        // 6. If lead is 0x24 and byte is either 0x40 or 0x42, set
+        // state to lead byte.
+        if (lead === 0x24 && (bite === 0x40 || bite === 0x42))
+          state = states.LeadByte;
+
+        // 7. If state is non-null, run these substeps:
+        if (state !== null) {
+          // 1. Set iso-2022-jp decoder state and iso-2022-jp decoder
+          // output state to states.
+          iso2022jp_decoder_state = iso2022jp_decoder_state = state;
+
+          // 2. Let output flag be the iso-2022-jp output flag.
+          var output_flag = iso2022jp_output_flag;
+
+          // 3. Set the iso-2022-jp output flag.
+          iso2022jp_output_flag = true;
+
+          // 4. Return continue, if output flag is unset, and error
+          // otherwise.
+          return !output_flag ? null : decoderError(fatal);
+        }
+
+        // 8. Prepend lead and byte to stream.
+        stream.prepend([lead, bite]);
+
+        // 9. Unset the iso-2022-jp output flag, set iso-2022-jp
+        // decoder state to iso-2022-jp decoder output state and
+        // return error.
+        iso2022jp_output_flag = false;
+        iso2022jp_decoder_state = iso2022jp_decoder_output_state;
+        return decoderError(fatal);
+      }
+    };
+  }
+
+  // 13.2.2 iso-2022-jp encoder
+  /**
+   * @constructor
+   * @implements {Encoder}
+   * @param {{fatal: boolean}} options
+   */
+  function ISO2022JPEncoder(options) {
+    var fatal = options.fatal;
+    // iso-2022-jp's encoder has an associated iso-2022-jp encoder
+    // state which is one of ASCII, Roman, and jis0208 (initially
+    // ASCII).
+    /** @enum */
+    var states = {
+      ASCII: 0,
+      Roman: 1,
+      jis0208: 2
+    };
+    var /** @type {number} */ iso2022jp_state = states.ASCII;
+    /**
+     * @param {Stream} stream Input stream.
+     * @param {number} code_point Next code point read from the stream.
+     * @return {(number|!Array.<number>)} Byte(s) to emit.
+     */
+    this.handler = function(stream, code_point) {
+      // 1. If code point is end-of-stream and iso-2022-jp encoder
+      // state is not ASCII, prepend code point to stream, set
+      // iso-2022-jp encoder state to ASCII, and return three bytes
+      // 0x1B 0x28 0x42.
+      if (code_point === end_of_stream &&
+          iso2022jp_state !== states.ASCII) {
+        stream.prepend(code_point);
+        iso2022jp_state = states.ASCII;
+        return [0x1B, 0x28, 0x42];
+      }
+
+      // 2. If code point is end-of-stream and iso-2022-jp encoder
+      // state is ASCII, return finished.
+      if (code_point === end_of_stream && iso2022jp_state === states.ASCII)
+        return finished;
+
+      // 3. If ISO-2022-JP encoder state is ASCII or Roman, and code
+      // point is U+000E, U+000F, or U+001B, return error with U+FFFD.
+      if ((iso2022jp_state === states.ASCII ||
+           iso2022jp_state === states.Roman) &&
+          (code_point === 0x000E || code_point === 0x000F ||
+           code_point === 0x001B)) {
+        return encoderError(0xFFFD);
+      }
+
+      // 4. If iso-2022-jp encoder state is ASCII and code point is an
+      // ASCII code point, return a byte whose value is code point.
+      if (iso2022jp_state === states.ASCII &&
+          isASCIICodePoint(code_point))
+        return code_point;
+
+      // 5. If iso-2022-jp encoder state is Roman and code point is an
+      // ASCII code point, excluding U+005C and U+007E, or is U+00A5
+      // or U+203E, run these substeps:
+      if (iso2022jp_state === states.Roman &&
+          ((isASCIICodePoint(code_point) &&
+           code_point !== 0x005C && code_point !== 0x007E) ||
+          (code_point == 0x00A5 || code_point == 0x203E))) {
+
+        // 1. If code point is an ASCII code point, return a byte
+        // whose value is code point.
+        if (isASCIICodePoint(code_point))
+          return code_point;
+
+        // 2. If code point is U+00A5, return byte 0x5C.
+        if (code_point === 0x00A5)
+          return 0x5C;
+
+        // 3. If code point is U+203E, return byte 0x7E.
+        if (code_point === 0x203E)
+          return 0x7E;
+      }
+
+      // 6. If code point is an ASCII code point, and iso-2022-jp
+      // encoder state is not ASCII, prepend code point to stream, set
+      // iso-2022-jp encoder state to ASCII, and return three bytes
+      // 0x1B 0x28 0x42.
+      if (isASCIICodePoint(code_point) &&
+          iso2022jp_state !== states.ASCII) {
+        stream.prepend(code_point);
+        iso2022jp_state = states.ASCII;
+        return [0x1B, 0x28, 0x42];
+      }
+
+      // 7. If code point is either U+00A5 or U+203E, and iso-2022-jp
+      // encoder state is not Roman, prepend code point to stream, set
+      // iso-2022-jp encoder state to Roman, and return three bytes
+      // 0x1B 0x28 0x4A.
+      if ((code_point === 0x00A5 || code_point === 0x203E) &&
+          iso2022jp_state !== states.Roman) {
+        stream.prepend(code_point);
+        iso2022jp_state = states.Roman;
+        return [0x1B, 0x28, 0x4A];
+      }
+
+      // 8. If code point is U+2212, set it to U+FF0D.
+      if (code_point === 0x2212)
+        code_point = 0xFF0D;
+
+      // 9. Let pointer be the index pointer for code point in index
+      // jis0208.
+      var pointer = indexPointerFor(code_point, index('jis0208'));
+
+      // 10. If pointer is null, return error with code point.
+      if (pointer === null)
+        return encoderError(code_point);
+
+      // 11. If iso-2022-jp encoder state is not jis0208, prepend code
+      // point to stream, set iso-2022-jp encoder state to jis0208,
+      // and return three bytes 0x1B 0x24 0x42.
+      if (iso2022jp_state !== states.jis0208) {
+        stream.prepend(code_point);
+        iso2022jp_state = states.jis0208;
+        return [0x1B, 0x24, 0x42];
+      }
+
+      // 12. Let lead be floor(pointer / 94) + 0x21.
+      var lead = floor(pointer / 94) + 0x21;
+
+      // 13. Let trail be pointer % 94 + 0x21.
+      var trail = pointer % 94 + 0x21;
+
+      // 14. Return two bytes whose values are lead and trail.
+      return [lead, trail];
+    };
+  }
+
+  /** @param {{fatal: boolean}} options */
+  encoders['ISO-2022-JP'] = function(options) {
+    return new ISO2022JPEncoder(options);
+  };
+  /** @param {{fatal: boolean}} options */
+  decoders['ISO-2022-JP'] = function(options) {
+    return new ISO2022JPDecoder(options);
+  };
+
+  // 13.3 Shift_JIS
+
+  // 13.3.1 Shift_JIS decoder
+  /**
+   * @constructor
+   * @implements {Decoder}
+   * @param {{fatal: boolean}} options
+   */
+  function ShiftJISDecoder(options) {
+    var fatal = options.fatal;
+    // Shift_JIS's decoder has an associated Shift_JIS lead (initially
+    // 0x00).
+    var /** @type {number} */ Shift_JIS_lead = 0x00;
+    /**
+     * @param {Stream} stream The stream of bytes being decoded.
+     * @param {number} bite The next byte read from the stream.
+     * @return {?(number|!Array.<number>)} The next code point(s)
+     *     decoded, or null if not enough data exists in the input
+     *     stream to decode a complete code point.
+     */
+    this.handler = function(stream, bite) {
+      // 1. If byte is end-of-stream and Shift_JIS lead is not 0x00,
+      // set Shift_JIS lead to 0x00 and return error.
+      if (bite === end_of_stream && Shift_JIS_lead !== 0x00) {
+        Shift_JIS_lead = 0x00;
+        return decoderError(fatal);
+      }
+
+      // 2. If byte is end-of-stream and Shift_JIS lead is 0x00,
+      // return finished.
+      if (bite === end_of_stream && Shift_JIS_lead === 0x00)
+        return finished;
+
+      // 3. If Shift_JIS lead is not 0x00, let lead be Shift_JIS lead,
+      // let pointer be null, set Shift_JIS lead to 0x00, and then run
+      // these substeps:
+      if (Shift_JIS_lead !== 0x00) {
+        var lead = Shift_JIS_lead;
+        var pointer = null;
+        Shift_JIS_lead = 0x00;
+
+        // 1. Let offset be 0x40, if byte is less than 0x7F, and 0x41
+        // otherwise.
+        var offset = (bite < 0x7F) ? 0x40 : 0x41;
+
+        // 2. Let lead offset be 0x81, if lead is less than 0xA0, and
+        // 0xC1 otherwise.
+        var lead_offset = (lead < 0xA0) ? 0x81 : 0xC1;
+
+        // 3. If byte is in the range 0x40 to 0x7E, inclusive, or 0x80
+        // to 0xFC, inclusive, set pointer to (lead − lead offset) ×
+        // 188 + byte − offset.
+        if (inRange(bite, 0x40, 0x7E) || inRange(bite, 0x80, 0xFC))
+          pointer = (lead - lead_offset) * 188 + bite - offset;
+
+        // 4. If pointer is in the range 8836 to 10715, inclusive,
+        // return a code point whose value is 0xE000 − 8836 + pointer.
+        if (inRange(pointer, 8836, 10715))
+          return 0xE000 - 8836 + pointer;
+
+        // 5. Let code point be null, if pointer is null, and the
+        // index code point for pointer in index jis0208 otherwise.
+        var code_point = (pointer === null) ? null :
+              indexCodePointFor(pointer, index('jis0208'));
+
+        // 6. If code point is null and byte is an ASCII byte, prepend
+        // byte to stream.
+        if (code_point === null && isASCIIByte(bite))
+          stream.prepend(bite);
+
+        // 7. If code point is null, return error.
+        if (code_point === null)
+          return decoderError(fatal);
+
+        // 8. Return a code point whose value is code point.
+        return code_point;
+      }
+
+      // 4. If byte is an ASCII byte or 0x80, return a code point
+      // whose value is byte.
+      if (isASCIIByte(bite) || bite === 0x80)
+        return bite;
+
+      // 5. If byte is in the range 0xA1 to 0xDF, inclusive, return a
+      // code point whose value is 0xFF61 − 0xA1 + byte.
+      if (inRange(bite, 0xA1, 0xDF))
+        return 0xFF61 - 0xA1 + bite;
+
+      // 6. If byte is in the range 0x81 to 0x9F, inclusive, or 0xE0
+      // to 0xFC, inclusive, set Shift_JIS lead to byte and return
+      // continue.
+      if (inRange(bite, 0x81, 0x9F) || inRange(bite, 0xE0, 0xFC)) {
+        Shift_JIS_lead = bite;
+        return null;
+      }
+
+      // 7. Return error.
+      return decoderError(fatal);
+    };
+  }
+
+  // 13.3.2 Shift_JIS encoder
+  /**
+   * @constructor
+   * @implements {Encoder}
+   * @param {{fatal: boolean}} options
+   */
+  function ShiftJISEncoder(options) {
+    var fatal = options.fatal;
+    /**
+     * @param {Stream} stream Input stream.
+     * @param {number} code_point Next code point read from the stream.
+     * @return {(number|!Array.<number>)} Byte(s) to emit.
+     */
+    this.handler = function(stream, code_point) {
+      // 1. If code point is end-of-stream, return finished.
+      if (code_point === end_of_stream)
+        return finished;
+
+      // 2. If code point is an ASCII code point or U+0080, return a
+      // byte whose value is code point.
+      if (isASCIICodePoint(code_point) || code_point === 0x0080)
+        return code_point;
+
+      // 3. If code point is U+00A5, return byte 0x5C.
+      if (code_point === 0x00A5)
+        return 0x5C;
+
+      // 4. If code point is U+203E, return byte 0x7E.
+      if (code_point === 0x203E)
+        return 0x7E;
+
+      // 5. If code point is in the range U+FF61 to U+FF9F, inclusive,
+      // return a byte whose value is code point − 0xFF61 + 0xA1.
+      if (inRange(code_point, 0xFF61, 0xFF9F))
+        return code_point - 0xFF61 + 0xA1;
+
+      // 6. If code point is U+2212, set it to U+FF0D.
+      if (code_point === 0x2212)
+        code_point = 0xFF0D;
+
+      // 7. Let pointer be the index Shift_JIS pointer for code point.
+      var pointer = indexShiftJISPointerFor(code_point);
+
+      // 8. If pointer is null, return error with code point.
+      if (pointer === null)
+        return encoderError(code_point);
+
+      // 9. Let lead be floor(pointer / 188).
+      var lead = floor(pointer / 188);
+
+      // 10. Let lead offset be 0x81, if lead is less than 0x1F, and
+      // 0xC1 otherwise.
+      var lead_offset = (lead < 0x1F) ? 0x81 : 0xC1;
+
+      // 11. Let trail be pointer % 188.
+      var trail = pointer % 188;
+
+      // 12. Let offset be 0x40, if trail is less than 0x3F, and 0x41
+      // otherwise.
+      var offset = (trail < 0x3F) ? 0x40 : 0x41;
+
+      // 13. Return two bytes whose values are lead + lead offset and
+      // trail + offset.
+      return [lead + lead_offset, trail + offset];
+    };
+  }
+
+  /** @param {{fatal: boolean}} options */
+  encoders['Shift_JIS'] = function(options) {
+    return new ShiftJISEncoder(options);
+  };
+  /** @param {{fatal: boolean}} options */
+  decoders['Shift_JIS'] = function(options) {
+    return new ShiftJISDecoder(options);
+  };
+
+  //
+  // 14. Legacy multi-byte Korean encodings
+  //
+
+  // 14.1 euc-kr
+
+  // 14.1.1 euc-kr decoder
+  /**
+   * @constructor
+   * @implements {Decoder}
+   * @param {{fatal: boolean}} options
+   */
+  function EUCKRDecoder(options) {
+    var fatal = options.fatal;
+
+    // euc-kr's decoder has an associated euc-kr lead (initially 0x00).
+    var /** @type {number} */ euckr_lead = 0x00;
+    /**
+     * @param {Stream} stream The stream of bytes being decoded.
+     * @param {number} bite The next byte read from the stream.
+     * @return {?(number|!Array.<number>)} The next code point(s)
+     *     decoded, or null if not enough data exists in the input
+     *     stream to decode a complete code point.
+     */
+    this.handler = function(stream, bite) {
+      // 1. If byte is end-of-stream and euc-kr lead is not 0x00, set
+      // euc-kr lead to 0x00 and return error.
+      if (bite === end_of_stream && euckr_lead !== 0) {
+        euckr_lead = 0x00;
+        return decoderError(fatal);
+      }
+
+      // 2. If byte is end-of-stream and euc-kr lead is 0x00, return
+      // finished.
+      if (bite === end_of_stream && euckr_lead === 0)
+        return finished;
+
+      // 3. If euc-kr lead is not 0x00, let lead be euc-kr lead, let
+      // pointer be null, set euc-kr lead to 0x00, and then run these
+      // substeps:
+      if (euckr_lead !== 0x00) {
+        var lead = euckr_lead;
+        var pointer = null;
+        euckr_lead = 0x00;
+
+        // 1. If byte is in the range 0x41 to 0xFE, inclusive, set
+        // pointer to (lead − 0x81) × 190 + (byte − 0x41).
+        if (inRange(bite, 0x41, 0xFE))
+          pointer = (lead - 0x81) * 190 + (bite - 0x41);
+
+        // 2. Let code point be null, if pointer is null, and the
+        // index code point for pointer in index euc-kr otherwise.
+        var code_point = (pointer === null)
+              ? null : indexCodePointFor(pointer, index('euc-kr'));
+
+        // 3. If code point is null and byte is an ASCII byte, prepend
+        // byte to stream.
+        if (pointer === null && isASCIIByte(bite))
+          stream.prepend(bite);
+
+        // 4. If code point is null, return error.
+        if (code_point === null)
+          return decoderError(fatal);
+
+        // 5. Return a code point whose value is code point.
+        return code_point;
+      }
+
+      // 4. If byte is an ASCII byte, return a code point whose value
+      // is byte.
+      if (isASCIIByte(bite))
+        return bite;
+
+      // 5. If byte is in the range 0x81 to 0xFE, inclusive, set
+      // euc-kr lead to byte and return continue.
+      if (inRange(bite, 0x81, 0xFE)) {
+        euckr_lead = bite;
+        return null;
+      }
+
+      // 6. Return error.
+      return decoderError(fatal);
+    };
+  }
+
+  // 14.1.2 euc-kr encoder
+  /**
+   * @constructor
+   * @implements {Encoder}
+   * @param {{fatal: boolean}} options
+   */
+  function EUCKREncoder(options) {
+    var fatal = options.fatal;
+    /**
+     * @param {Stream} stream Input stream.
+     * @param {number} code_point Next code point read from the stream.
+     * @return {(number|!Array.<number>)} Byte(s) to emit.
+     */
+    this.handler = function(stream, code_point) {
+      // 1. If code point is end-of-stream, return finished.
+      if (code_point === end_of_stream)
+        return finished;
+
+      // 2. If code point is an ASCII code point, return a byte whose
+      // value is code point.
+      if (isASCIICodePoint(code_point))
+        return code_point;
+
+      // 3. Let pointer be the index pointer for code point in index
+      // euc-kr.
+      var pointer = indexPointerFor(code_point, index('euc-kr'));
+
+      // 4. If pointer is null, return error with code point.
+      if (pointer === null)
+        return encoderError(code_point);
+
+      // 5. Let lead be floor(pointer / 190) + 0x81.
+      var lead = floor(pointer / 190) + 0x81;
+
+      // 6. Let trail be pointer % 190 + 0x41.
+      var trail = (pointer % 190) + 0x41;
+
+      // 7. Return two bytes whose values are lead and trail.
+      return [lead, trail];
+    };
+  }
+
+  /** @param {{fatal: boolean}} options */
+  encoders['EUC-KR'] = function(options) {
+    return new EUCKREncoder(options);
+  };
+  /** @param {{fatal: boolean}} options */
+  decoders['EUC-KR'] = function(options) {
+    return new EUCKRDecoder(options);
+  };
+
+
+  //
+  // 15. Legacy miscellaneous encodings
+  //
+
+  // 15.1 replacement
+
+  // Not needed - API throws RangeError
+
+  // 15.2 Common infrastructure for utf-16be and utf-16le
+
+  /**
+   * @param {number} code_unit
+   * @param {boolean} utf16be
+   * @return {!Array.<number>} bytes
+   */
+  function convertCodeUnitToBytes(code_unit, utf16be) {
+    // 1. Let byte1 be code unit >> 8.
+    var byte1 = code_unit >> 8;
+
+    // 2. Let byte2 be code unit & 0x00FF.
+    var byte2 = code_unit & 0x00FF;
+
+    // 3. Then return the bytes in order:
+        // utf-16be flag is set: byte1, then byte2.
+    if (utf16be)
+      return [byte1, byte2];
+    // utf-16be flag is unset: byte2, then byte1.
+    return [byte2, byte1];
+  }
+
+  // 15.2.1 shared utf-16 decoder
+  /**
+   * @constructor
+   * @implements {Decoder}
+   * @param {boolean} utf16_be True if big-endian, false if little-endian.
+   * @param {{fatal: boolean}} options
+   */
+  function UTF16Decoder(utf16_be, options) {
+    var fatal = options.fatal;
+    var /** @type {?number} */ utf16_lead_byte = null,
+        /** @type {?number} */ utf16_lead_surrogate = null;
+    /**
+     * @param {Stream} stream The stream of bytes being decoded.
+     * @param {number} bite The next byte read from the stream.
+     * @return {?(number|!Array.<number>)} The next code point(s)
+     *     decoded, or null if not enough data exists in the input
+     *     stream to decode a complete code point.
+     */
+    this.handler = function(stream, bite) {
+      // 1. If byte is end-of-stream and either utf-16 lead byte or
+      // utf-16 lead surrogate is not null, set utf-16 lead byte and
+      // utf-16 lead surrogate to null, and return error.
+      if (bite === end_of_stream && (utf16_lead_byte !== null ||
+                                utf16_lead_surrogate !== null)) {
+        return decoderError(fatal);
+      }
+
+      // 2. If byte is end-of-stream and utf-16 lead byte and utf-16
+      // lead surrogate are null, return finished.
+      if (bite === end_of_stream && utf16_lead_byte === null &&
+          utf16_lead_surrogate === null) {
+        return finished;
+      }
+
+      // 3. If utf-16 lead byte is null, set utf-16 lead byte to byte
+      // and return continue.
+      if (utf16_lead_byte === null) {
+        utf16_lead_byte = bite;
+        return null;
+      }
+
+      // 4. Let code unit be the result of:
+      var code_unit;
+      if (utf16_be) {
+        // utf-16be decoder flag is set
+        //   (utf-16 lead byte << 8) + byte.
+        code_unit = (utf16_lead_byte << 8) + bite;
+      } else {
+        // utf-16be decoder flag is unset
+        //   (byte << 8) + utf-16 lead byte.
+        code_unit = (bite << 8) + utf16_lead_byte;
+      }
+      // Then set utf-16 lead byte to null.
+      utf16_lead_byte = null;
+
+      // 5. If utf-16 lead surrogate is not null, let lead surrogate
+      // be utf-16 lead surrogate, set utf-16 lead surrogate to null,
+      // and then run these substeps:
+      if (utf16_lead_surrogate !== null) {
+        var lead_surrogate = utf16_lead_surrogate;
+        utf16_lead_surrogate = null;
+
+        // 1. If code unit is in the range U+DC00 to U+DFFF,
+        // inclusive, return a code point whose value is 0x10000 +
+        // ((lead surrogate − 0xD800) << 10) + (code unit − 0xDC00).
+        if (inRange(code_unit, 0xDC00, 0xDFFF)) {
+          return 0x10000 + (lead_surrogate - 0xD800) * 0x400 +
+              (code_unit - 0xDC00);
+        }
+
+        // 2. Prepend the sequence resulting of converting code unit
+        // to bytes using utf-16be decoder flag to stream and return
+        // error.
+        stream.prepend(convertCodeUnitToBytes(code_unit, utf16_be));
+        return decoderError(fatal);
+      }
+
+      // 6. If code unit is in the range U+D800 to U+DBFF, inclusive,
+      // set utf-16 lead surrogate to code unit and return continue.
+      if (inRange(code_unit, 0xD800, 0xDBFF)) {
+        utf16_lead_surrogate = code_unit;
+        return null;
+      }
+
+      // 7. If code unit is in the range U+DC00 to U+DFFF, inclusive,
+      // return error.
+      if (inRange(code_unit, 0xDC00, 0xDFFF))
+        return decoderError(fatal);
+
+      // 8. Return code point code unit.
+      return code_unit;
+    };
+  }
+
+  // 15.2.2 shared utf-16 encoder
+  /**
+   * @constructor
+   * @implements {Encoder}
+   * @param {boolean} utf16_be True if big-endian, false if little-endian.
+   * @param {{fatal: boolean}} options
+   */
+  function UTF16Encoder(utf16_be, options) {
+    var fatal = options.fatal;
+    /**
+     * @param {Stream} stream Input stream.
+     * @param {number} code_point Next code point read from the stream.
+     * @return {(number|!Array.<number>)} Byte(s) to emit.
+     */
+    this.handler = function(stream, code_point) {
+      // 1. If code point is end-of-stream, return finished.
+      if (code_point === end_of_stream)
+        return finished;
+
+      // 2. If code point is in the range U+0000 to U+FFFF, inclusive,
+      // return the sequence resulting of converting code point to
+      // bytes using utf-16be encoder flag.
+      if (inRange(code_point, 0x0000, 0xFFFF))
+        return convertCodeUnitToBytes(code_point, utf16_be);
+
+      // 3. Let lead be ((code point − 0x10000) >> 10) + 0xD800,
+      // converted to bytes using utf-16be encoder flag.
+      var lead = convertCodeUnitToBytes(
+        ((code_point - 0x10000) >> 10) + 0xD800, utf16_be);
+
+      // 4. Let trail be ((code point − 0x10000) & 0x3FF) + 0xDC00,
+      // converted to bytes using utf-16be encoder flag.
+      var trail = convertCodeUnitToBytes(
+        ((code_point - 0x10000) & 0x3FF) + 0xDC00, utf16_be);
+
+      // 5. Return a byte sequence of lead followed by trail.
+      return lead.concat(trail);
+    };
+  }
+
+  // 15.3 utf-16be
+  // 15.3.1 utf-16be decoder
+  /** @param {{fatal: boolean}} options */
+  encoders['UTF-16BE'] = function(options) {
+    return new UTF16Encoder(true, options);
+  };
+  // 15.3.2 utf-16be encoder
+  /** @param {{fatal: boolean}} options */
+  decoders['UTF-16BE'] = function(options) {
+    return new UTF16Decoder(true, options);
+  };
+
+  // 15.4 utf-16le
+  // 15.4.1 utf-16le decoder
+  /** @param {{fatal: boolean}} options */
+  encoders['UTF-16LE'] = function(options) {
+    return new UTF16Encoder(false, options);
+  };
+  // 15.4.2 utf-16le encoder
+  /** @param {{fatal: boolean}} options */
+  decoders['UTF-16LE'] = function(options) {
+    return new UTF16Decoder(false, options);
+  };
+
+  // 15.5 x-user-defined
+
+  // 15.5.1 x-user-defined decoder
+  /**
+   * @constructor
+   * @implements {Decoder}
+   * @param {{fatal: boolean}} options
+   */
+  function XUserDefinedDecoder(options) {
+    var fatal = options.fatal;
+    /**
+     * @param {Stream} stream The stream of bytes being decoded.
+     * @param {number} bite The next byte read from the stream.
+     * @return {?(number|!Array.<number>)} The next code point(s)
+     *     decoded, or null if not enough data exists in the input
+     *     stream to decode a complete code point.
+     */
+    this.handler = function(stream, bite) {
+      // 1. If byte is end-of-stream, return finished.
+      if (bite === end_of_stream)
+        return finished;
+
+      // 2. If byte is an ASCII byte, return a code point whose value
+      // is byte.
+      if (isASCIIByte(bite))
+        return bite;
+
+      // 3. Return a code point whose value is 0xF780 + byte − 0x80.
+      return 0xF780 + bite - 0x80;
+    };
+  }
+
+  // 15.5.2 x-user-defined encoder
+  /**
+   * @constructor
+   * @implements {Encoder}
+   * @param {{fatal: boolean}} options
+   */
+  function XUserDefinedEncoder(options) {
+    var fatal = options.fatal;
+    /**
+     * @param {Stream} stream Input stream.
+     * @param {number} code_point Next code point read from the stream.
+     * @return {(number|!Array.<number>)} Byte(s) to emit.
+     */
+    this.handler = function(stream, code_point) {
+      // 1.If code point is end-of-stream, return finished.
+      if (code_point === end_of_stream)
+        return finished;
+
+      // 2. If code point is an ASCII code point, return a byte whose
+      // value is code point.
+      if (isASCIICodePoint(code_point))
+        return code_point;
+
+      // 3. If code point is in the range U+F780 to U+F7FF, inclusive,
+      // return a byte whose value is code point − 0xF780 + 0x80.
+      if (inRange(code_point, 0xF780, 0xF7FF))
+        return code_point - 0xF780 + 0x80;
+
+      // 4. Return error with code point.
+      return encoderError(code_point);
+    };
+  }
+
+  /** @param {{fatal: boolean}} options */
+  encoders['x-user-defined'] = function(options) {
+    return new XUserDefinedEncoder(options);
+  };
+  /** @param {{fatal: boolean}} options */
+  decoders['x-user-defined'] = function(options) {
+    return new XUserDefinedDecoder(options);
+  };
+
+  if (!global['TextEncoder'])
+    global['TextEncoder'] = TextEncoder;
+  if (!global['TextDecoder'])
+    global['TextDecoder'] = TextDecoder;
+
+  if (typeof module !== "undefined" && module.exports) {
+    module.exports = {
+      TextEncoder: global['TextEncoder'],
+      TextDecoder: global['TextDecoder'],
+      EncodingIndexes: global["encoding-indexes"]
+    };
+  }
+
+// For strict environments where `this` inside the global scope
+// is `undefined`, take a pure object instead
+}(this || {}));

+ 313 - 0
components/kk-printer/printer/esc.js

@@ -0,0 +1,313 @@
+var encode = require("./encoding.js")
+var jpPrinter = {
+	createNew: function() {
+		var jpPrinter = {};
+		var data = [];
+
+		var bar = ["UPC-A", "UPC-E", "EAN13", "EAN8", "CODE39", "ITF", "CODABAR", "CODE93", "CODE128"];
+
+		jpPrinter.name = "账单模式";
+
+		jpPrinter.init = function() { //初始化打印机
+			data.push(27)
+			data.push(64)
+		};
+
+		jpPrinter.setText = function(content) { //设置文本内容
+			var code = new encode.TextEncoder(
+				'gb18030', {
+					NONSTANDARD_allowLegacyEncoding: true
+				}).encode(content)
+			for (var i = 0; i < code.length; ++i) {
+				data.push(code[i])
+			}
+		}
+
+		jpPrinter.setBarcodeWidth = function(width) { //设置条码宽度
+			data.push(29)
+			data.push(119)
+			if (width > 6) {
+				width = 6;
+			}
+			if (width < 2) {
+				width = 1;
+			}
+			data.push(width)
+		}
+
+		jpPrinter.setBarcodeHeight = function(height) { //设置条码高度
+			data.push(29)
+			data.push(104)
+			data.push(height)
+		}
+
+		jpPrinter.setBarcodeContent = function(t, content) {
+			var ty = 73;
+			data.push(29)
+			data.push(107)
+			switch (t) {
+				case bar[0]:
+					ty = 65;
+					break;
+				case bar[1]:
+					ty = 66;
+					break;
+				case bar[2]:
+					ty = 67;
+					break;
+				case bar[3]:
+					ty = 68;
+					break;
+				case bar[4]:
+					ty = 69;
+					break;
+				case bar[5]:
+					ty = 70;
+					break;
+				case bar[6]:
+					ty = 71;
+					break;
+				case bar[7]:
+					ty = 72;
+					break;
+				case bar[8]:
+					ty = 73;
+					break;
+			}
+			data.push(ty)
+		}
+
+		jpPrinter.setSelectSizeOfModuleForQRCode = function(n) { //设置二维码大小
+			data.push(29)
+			data.push(40)
+			data.push(107)
+			data.push(3)
+			data.push(0)
+			data.push(49)
+			data.push(67)
+			if (n > 15) {
+				n = 15
+			}
+			if (n < 1) {
+				n = 1
+			}
+			data.push(n)
+		}
+
+		jpPrinter.setSelectErrorCorrectionLevelForQRCode = function(n) { //设置纠错等级
+			/*
+			n      功能      纠错能力
+			48 选择纠错等级 L 7
+			49 选择纠错等级 M 15
+			50 选择纠错等级 Q 25
+			51 选择纠错等级 H 30
+			*/
+			data.push(29)
+			data.push(40)
+			data.push(107)
+			data.push(3)
+			data.push(0)
+			data.push(49)
+			data.push(69)
+			data.push(n)
+		}
+
+		jpPrinter.setStoreQRCodeData = function(content) { //设置二维码内容
+			var code = new encode.TextEncoder(
+				'gb18030', {
+					NONSTANDARD_allowLegacyEncoding: true
+				}).encode(content)
+			data.push(29)
+			data.push(40)
+			data.push(107)
+			data.push(parseInt((code.length + 3) % 256))
+			data.push(parseInt((code.length + 3) / 256))
+			data.push(49)
+			data.push(80)
+			data.push(48)
+
+			for (var i = 0; i < code.length; ++i) {
+				data.push(code[i])
+			}
+		}
+
+		jpPrinter.setPrintQRCode = function() { //打印二维码
+			data.push(29)
+			data.push(40)
+			data.push(107)
+			data.push(3)
+			data.push(0)
+			data.push(49)
+			data.push(81)
+			data.push(48)
+		}
+
+		jpPrinter.setHorTab = function() { //移动打印位置到下一个水平定位点的位置
+			data.push(9)
+		}
+
+		jpPrinter.setAbsolutePrintPosition = function(where) { //设置绝对打印位置
+			data.push(27)
+			data.push(36)
+			data.push(parseInt(where % 256))
+			data.push(parseInt(where / 256))
+		}
+
+		jpPrinter.setRelativePrintPositon = function(where) { //设置相对横向打印位置
+			data.push(27)
+			data.push(92)
+			data.push(parseInt(where % 256))
+			data.push(parseInt(where / 256))
+		}
+
+		jpPrinter.setSelectJustification = function(which) { //对齐方式
+			/*
+			0, 48 左对齐
+			1, 49 中间对齐
+			2, 50 右对齐
+			*/
+			data.push(27)
+			data.push(97)
+			data.push(which)
+		}
+
+		jpPrinter.setLeftMargin = function(n) { //设置左边距
+			data.push(29)
+			data.push(76)
+			data.push(parseInt(n % 256))
+			data.push(parseInt(n / 256))
+		}
+
+		jpPrinter.setPrintingAreaWidth = function(width) { //设置打印区域宽度
+			data.push(29)
+			data.push(87)
+			data.push(parseInt(width % 256))
+			data.push(parseInt(width / 256))
+		}
+
+		jpPrinter.setSound = function(n, t) { //设置蜂鸣器
+			data.push(27)
+			data.push(66)
+			if (n < 0) {
+				n = 1;
+			} else if (n > 9) {
+				n = 9;
+			}
+
+			if (t < 0) {
+				t = 1;
+			} else if (t > 9) {
+				t = 9;
+			}
+			data.push(n)
+			data.push(t)
+		}
+
+		jpPrinter.setBitmap = function(res) { //参数,画布的参数
+			console.log(res)
+			var width = parseInt((res.width + 7) / 8 * 8 / 8)
+			var height = res.height;
+			var time = 1;
+			var temp = res.data.length - width * 32;
+			var point_list = []
+			console.log(width + "--" + height)
+			data.push(29)
+			data.push(118)
+			data.push(48)
+			data.push(0)
+			data.push((parseInt((res.width + 7) / 8) * 8) / 8)
+			data.push(0)
+			data.push(parseInt(res.height % 256))
+			data.push(parseInt(res.height / 256))
+			console.log(res.data.length)
+			console.log("temp=" + temp)
+			for (var i = 0; i < height; ++i) {
+				for (var j = 0; j < width; ++j) {
+					for (var k = 0; k < 32; k += 4) {
+						var po = {}
+						if (res.data[temp] == 0 && res.data[temp + 1] == 0 && res.data[temp + 2] == 0 && res
+							.data[temp + 3] == 0) {
+							po.point = 0;
+						} else {
+							po.point = 1;
+						}
+						point_list.push(po)
+						temp += 4
+					}
+				}
+				time++
+				temp = res.data.length - width * 32 * time
+			}
+			for (var i = 0; i < point_list.length; i += 8) {
+				var p = point_list[i].point * 128 + point_list[i + 1].point * 64 + point_list[i + 2].point *
+					32 + point_list[i + 3].point * 16 + point_list[i + 4].point * 8 + point_list[i + 5]
+					.point * 4 + point_list[i + 6].point * 2 + point_list[i + 7].point
+				data.push(p)
+			}
+		}
+
+		jpPrinter.setPrint = function() { //打印并换行
+			data.push(10)
+		}
+
+		jpPrinter.setPrintAndFeed = function(feed) { //打印并走纸feed个单位
+			data.push(27)
+			data.push(74)
+			data.push(feed)
+		}
+
+		jpPrinter.setPrintAndFeedRow = function(row) { //打印并走纸row行
+			data.push(27)
+			data.push(100)
+			data.push(row)
+		}
+
+		jpPrinter.getData = function() { //获取打印数据
+			return data;
+		};
+
+
+		return jpPrinter;
+	},
+
+	Query: function() {
+		var queryStatus = {};
+		var buf;
+		var dateView;
+		queryStatus.getRealtimeStatusTransmission = function(n) { //查询打印机实时状态
+			/*
+			n = 1:传送打印机状态
+			n = 2:传送脱机状态
+			n = 3:传送错误状态
+			n = 4:传送纸传感器状态
+			*/
+			buf = new ArrayBuffer(3)
+			dateView = new DataView(buf)
+			dateView.setUint8(0, 16)
+			dateView.setUint8(1, 4)
+			dateView.setUint8(2, n)
+			queryStatus.query(buf)
+		}
+
+		queryStatus.query = function(buf) {
+			wx.writeBLECharacteristicValue({
+				deviceId: app.BLEInformation.deviceId,
+				serviceId: app.BLEInformation.writeServiceId,
+				characteristicId: app.BLEInformation.writeCharaterId,
+				value: buf,
+				success: function(res) {
+
+				},
+				complete: function(res) {
+					console.log(res)
+					buf = null
+					dateView = null;
+				}
+			})
+		}
+		return queryStatus;
+	}
+
+};
+
+module.exports.jpPrinter = jpPrinter;

+ 386 - 0
components/kk-printer/printer/tsc.js

@@ -0,0 +1,386 @@
+/**
+ * tsc 命令打印工具类
+ * 2021.04.26 uni-app版本
+ * @auth boolTrue
+ */
+var encode = require("./encoding.js");
+var jpPrinter = {
+	createNew: function() {
+		var jpPrinter = {};
+		var data = "";
+		var command = []
+		var rawCommand = ''
+
+		jpPrinter.name = "标签模式";
+
+		jpPrinter.init = function() {};
+
+		jpPrinter.addCommand = function(content) { //将指令转成数组装起
+			var code = new encode.TextEncoder(
+				'gb18030', {
+					NONSTANDARD_allowLegacyEncoding: true
+				}).encode(content)
+			for (var i = 0; i < code.length; ++i) {
+				command.push(code[i])
+			}
+			
+			//#ifdef APP-PLUS
+			// 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)
+			rawCommand += content
+		}
+		
+		function intToByte(i) {
+			// 此处关键 -- android是java平台 byte数值范围是 [-128, 127]
+			// 因为java平台的byte类型是有符号的 最高位表示符号,所以数值范围固定
+			// 而图片计算出来的是数值是 0 -255 属于int类型
+			// 所以把int 转换成byte类型 
+			//#ifdef APP-PLUS
+				var b = i & 0xFF;
+				var c = 0;
+				if (b >= 128) {
+					c = b % 128;
+					c = -1 * (128 - c);
+				} else {
+					c = b;
+				}
+				return c
+			//#endif
+			// 而微信小程序不需要,因为小程序api接收的是 无符号8位
+			//#ifdef MP-WEIXIN
+				return i
+			//#endif
+		}
+
+		jpPrinter.setSize = function(pageWidght, pageHeight) { //设置页面大小
+			data = "SIZE " + pageWidght.toString() + " mm" + "," + pageHeight.toString() + " mm" + "\r\n";
+			jpPrinter.addCommand(data)
+		};
+
+		jpPrinter.setSpeed = function(printSpeed) { //设置打印机速度
+			data = "SPEED " + printSpeed.toString() + "\r\n";
+			jpPrinter.addCommand(data)
+		};
+
+		jpPrinter.setDensity = function(printDensity) { //设置打印机浓度
+			data = "DENSITY " + printDensity.toString() + "\r\n";
+			jpPrinter.addCommand(data)
+		};
+
+		jpPrinter.setGap = function(printGap) { //传感器
+			data = "GAP " + printGap.toString() + " mm\r\n";
+			jpPrinter.addCommand(data)
+		};
+
+		jpPrinter.setCountry = function(country) { //选择国际字符集
+			/*
+			001:USA
+			002:French
+			003:Latin America
+			034:Spanish
+			039:Italian
+			044:United Kingdom
+			046:Swedish
+			047:Norwegian
+			049:German
+			 */
+			data = "COUNTRY " + country + "\r\n";
+			jpPrinter.addCommand(data)
+		};
+
+		jpPrinter.setCodepage = function(codepage) { //选择国际代码页
+			/*
+			8-bit codepage 字符集代表
+			437:United States
+			850:Multilingual
+			852:Slavic
+			860:Portuguese
+			863:Canadian/French
+			865:Nordic
+			Windows code page
+			1250:Central Europe
+			1252:Latin I
+			1253:Greek
+			1254:Turkish
+			以下代码页仅限于 12×24 dot 英数字体
+			WestEurope:WestEurope
+			Greek:Greek
+			Hebrew:Hebrew
+			EastEurope:EastEurope
+			Iran:Iran
+			IranII:IranII
+			Latvian:Latvian
+			Arabic:Arabic
+			Vietnam:Vietnam
+			Uygur:Uygur
+			Thai:Thai
+			1252:Latin I
+			1257:WPC1257
+			1251:WPC1251
+			866:Cyrillic
+			858:PC858
+			747:PC747
+			864:PC864
+			1001:PC100
+			*/
+			data = "CODEPAGE " + codepage + "\r\n";
+			jpPrinter.addCommand(data)
+		}
+
+		jpPrinter.setCls = function() { //清除打印机缓存
+			data = "CLS" + "\r\n";
+			jpPrinter.addCommand(data)
+		};
+
+		jpPrinter.setFeed = function(feed) { //将纸向前推出n
+			data = "FEED " + feed + "\r\n";
+			jpPrinter.addCommand(data)
+		};
+
+		jpPrinter.setBackFeed = function(backup) { //将纸向后回拉n
+			data = "BACKFEED " + backup + "\r\n";
+			jpPrinter.addCommand(data)
+		}
+
+		jpPrinter.setDirection = function(direction) { //设置打印方向,参考编程手册  
+			data = "DIRECTION " + direction + "\r\n";
+			jpPrinter.addCommand(data)
+		};
+
+		jpPrinter.setReference = function(x, y) { //设置坐标原点,与打印方向有关
+			data = "REFERENCE " + x + "," + y + "\r\n";
+			jpPrinter.addCommand(data)
+		};
+
+		jpPrinter.setFromfeed = function() { //根据Size进一张标签纸
+			data = "FORMFEED \r\n";
+			jpPrinter.addCommand(data)
+		};
+
+		jpPrinter.setHome = function() { //根据Size找到下一张标签纸的位置
+			data = "HOME \r\n";
+			jpPrinter.addCommand(data)
+		};
+
+		jpPrinter.setSound = function(level, interval) { //控制蜂鸣器
+			data = "SOUND " + level + "," + interval + "\r\n";
+			jpPrinter.addCommand(data)
+		};
+
+		jpPrinter.setLimitfeed = function(limit) { // 检测垂直间距
+			data = "LIMITFEED " + limit + "\r\n";
+			jpPrinter.addCommand(data)
+		};
+
+		jpPrinter.setBar = function(x, y, width, height) { //绘制线条
+			data = "BAR " + x + "," + y + "," + width + "," + height + "\r\n"
+			jpPrinter.addCommand(data)
+		};
+
+		jpPrinter.setBox = function(x_start, y_start, x_end, y_end, thickness) { //绘制方框
+			data = "BOX " + x_start + "," + y_start + "," + x_end + "," + y_end + "," + thickness + "\r\n";
+			jpPrinter.addCommand(data)
+		};
+
+		jpPrinter.setErase = function(x_start, y_start, x_width, y_height) { //清除指定区域的数据
+			data = "ERASE " + x_start + "," + y_start + "," + x_width + "," + y_height + "\r\n";
+			jpPrinter.addCommand(data)
+		};
+
+		jpPrinter.setReverse = function(x_start, y_start, x_width, y_height) { //将指定的区域反相打印
+			data = "REVERSE " + x_start + "," + y_start + "," + x_width + "," + y_height + "\r\n";
+			jpPrinter.addCommand(data)
+		};
+
+		jpPrinter.setText = function(x, y, font, x_, y_, str) { //打印文字
+			data = "TEXT " + x + "," + y + ",\"" + font + "\"," + 0 + "," + x_ + "," + y_ + "," + "\"" +
+				str + "\"\r\n"
+			jpPrinter.addCommand(data)
+		};
+
+		jpPrinter.setQR = function(x, y, level, width, mode, content) { //打印二维码
+			data = "QRCODE " + x + "," + y + "," + level + "," + width + "," + mode + "," + 0 + ",\"" +
+				content + "\"\r\n"
+			jpPrinter.addCommand(data)
+		};
+
+		jpPrinter.setBar = function(x, y, codetype, height, readable, narrow, wide, content) { //打印条形码
+			data = "BARCODE " + x + "," + y + ",\"" + codetype + "\"," + height + "," + readable + "," + 0 +
+				"," + narrow + "," + wide + ",\"" + content + "\"\r\n"
+			jpPrinter.addCommand(data)
+		};
+
+		// 固定灰度阈值(128以上的都看作白色)
+		jpPrinter.setBitmap = function(x, y, mode, res) { //添加图片,res为画布参数
+			var width = parseInt((res.width) / 8 * 8 / 8)
+			var height = res.height
+			var imgWidth = res.width
+			var time = 1;
+			var temp = res.data.length - width * 32;
+			var pointList = []
+			var resultData = []
+			console.log(width + "--" + height)
+			data = "BITMAP " + x + "," + y + "," + width + "," + height + "," + mode + ","
+			jpPrinter.addCommand(data)
+			//console.log(res.data)
+			console.log('---以上是原始数据---')
+
+			//for循环顺序不要错了,外层遍历高度,内层遍历宽度,因为横向每8个像素点组成一个字节
+			for (var y = 0; y < height; y++) {
+				for (var x = 0; x < imgWidth; x++) {
+					let r = res.data[(y * imgWidth + x) * 4];
+					let g = res.data[(y * imgWidth + x) * 4 + 1];
+					let b = res.data[(y * imgWidth + x) * 4 + 2];
+					let a = res.data[(y * imgWidth + x) * 4 + 3]
+					//console.log(`当前${y}行${x}列像素,rgba值:(${r},${g},${b},${a})`)
+					// 像素灰度值
+					let grayColor = r * 0.299 + g * 0.587 + b * 0.114
+					//灰度值大于128位 
+					//1不打印, 0打印 (参考:佳博标签打印机编程手册tspl)
+					if (grayColor > 128) {
+						pointList.push(1)
+					} else {
+						pointList.push(0)
+					}
+				}
+			}
+			//console.log(pointList)
+			for (var i = 0; i < pointList.length; i += 8) {
+				var p = pointList[i] * 128 + pointList[i + 1] * 64 + pointList[i + 2] * 32 + pointList[i +
+						3] * 16 + pointList[i + 4] * 8 + pointList[i + 5] * 4 + pointList[i + 6] * 2 +
+					pointList[i + 7]
+				resultData.push(p)
+			}
+			console.log('最终数据:')
+			//console.log(resultData)
+			for (var i = 0; i < resultData.length; ++i) {
+				command.push(intToByte(resultData[i]))
+			}
+		}
+
+		
+
+		jpPrinter.setBitmap2 = function(x, y, mode, res) { //添加图片,res为画布参数
+			var w = res.width
+			var width = parseInt((res.width + 7) / 8 * 8 / 8)
+			var height = res.height;
+			console.log(width + "--" + height)
+			data = "BITMAP " + x + "," + y + "," + width + "," + height + "," + mode + ","
+			jpPrinter.addCommand(data)
+			var r = []
+			var bits = new Uint8Array(height * width);
+			for (y = 0; y < height; y++) {
+				for (x = 0; x < w; x++) {
+					let r = res.data[(y * w + x) * 4];
+					let g = res.data[(y * w + x) * 4 + 1];
+					let b = res.data[(y * w + x) * 4 + 2];
+					let a = res.data[(y * w + x) * 4 + 3]
+					var color = ((a & 0xFF) << 24) | ((r & 0xFF) << 16) | ((g & 0xFF) << 8) | ((b & 0xFF) <<
+						0);
+					if ((color & 0xFF) > 128) {
+						bits[parseInt(y * width + x / 8)] |= (0x80 >> (x % 8));
+					}
+				}
+			}
+			for (var i = 0; i < bits.length; i++) {
+				//command.push((~bits[i]) & 0xFF);
+				command.push(intToByte(bits[i]));
+				//r.push((~bits[i]) & 0xFF);
+			}
+		}
+
+		// 平均灰度阈值(先计算平均灰度,然后大于平均灰度的都算作白色)
+		jpPrinter.setBitmap3 = function(x, y, mode, res) { //添加图片,res为画布参数
+			var width = parseInt((res.width) / 8 * 8 / 8)
+			var height = res.height
+			var imgWidth = res.width
+			var time = 1;
+			var temp = res.data.length - width * 32;
+			var pointList = []
+			var resultData = []
+			console.log(width + "--" + height)
+			data = "BITMAP " + x + "," + y + "," + width + "," + height + "," + mode + ","
+			jpPrinter.addCommand(data)
+			//console.log(res.data)
+			console.log('---以上是原始数据---')
+
+			let sumRed = 0,
+				sumGreen = 0,
+				sumBlue = 0;
+			let total = height * imgWidth;
+			let pix = res.data;
+			for (var i = 0; i < pix.length; i += 4) {
+				sumRed += pix[i]
+				sumGreen += pix[i + 1]
+				sumBlue += pix[i + 2]
+			}
+
+			let avgRed = parseInt(sumRed / total);
+			let avgGreen = parseInt(sumGreen / total);
+			let avgBlue = parseInt(sumBlue / total);
+			let avgGrayColor = avgRed * 0.299 + avgGreen * 0.587 + avgBlue * 0.114
+
+
+			//for循环顺序不要错了,外层遍历高度,内层遍历宽度,因为横向每8个像素点组成一个字节
+			for (var y = 0; y < height; y++) {
+				for (var x = 0; x < imgWidth; x++) {
+					let r = res.data[(y * imgWidth + x) * 4];
+					let g = res.data[(y * imgWidth + x) * 4 + 1];
+					let b = res.data[(y * imgWidth + x) * 4 + 2];
+					let a = res.data[(y * imgWidth + x) * 4 + 3]
+					// 像素灰度值
+					let grayColor = r * 0.299 + g * 0.587 + b * 0.114
+					//灰度值大于128位 
+					//1不打印, 0打印 (参考:佳博标签打印机编程手册tspl)
+					if (grayColor > avgGrayColor) {
+						pointList.push(1)
+					} else {
+						pointList.push(0)
+					}
+				}
+			}
+			//console.log(pointList)
+			for (var i = 0; i < pointList.length; i += 8) {
+				var p = pointList[i] * 128 + pointList[i + 1] * 64 + pointList[i + 2] * 32 + pointList[i +
+						3] * 16 + pointList[i + 4] * 8 + pointList[i + 5] * 4 + pointList[i + 6] * 2 +
+					pointList[i + 7]
+				resultData.push(p)
+
+			}
+			console.log('最终数据:')
+			//console.log(resultData)
+			for (var i = 0; i < resultData.length; ++i) {
+				command.push(intToByte(resultData[i]))
+			}
+		}
+
+		jpPrinter.RawCommand = function(data) {
+			jpPrinter.addCommand(data)
+		}
+
+		jpPrinter.setPagePrint = function(m,n) { //打印页面
+			data = "PRINT "+m+","+n+"\r\n"
+			jpPrinter.addCommand(data)
+		};
+		//获取打印数据
+		jpPrinter.getData = function() {
+			return command;
+		};
+
+		jpPrinter.getRawData = function() {
+			return rawCommand;
+		};
+		jpPrinter.clearCommand = function() {
+			rawCommand = ''
+		};
+
+		return jpPrinter;
+	}
+};
+
+module.exports.jpPrinter = jpPrinter;

+ 326 - 0
components/kk-printer/utils/bluetoolth.js

@@ -0,0 +1,326 @@
+/**
+ * @export
+ * @param {string} name 微信api的名称 ,如 uniAsyncPromise("getSystemInfo",options)
+ * @param {object} options 除了success 和 fail 的其他参数
+ * @returns
+ */
+export function uniAsyncPromise(name, options) {
+	return new Promise((resolve, reject) => {
+		uni[name]({
+			...(options || {}),
+			// ...options,
+			success: (res) => {
+				resolve(res);
+			},
+			fail: (err) => {
+				reject(err);
+			}
+		});
+	});
+}
+//微信小程序向蓝牙打印机发送数据进行打印的坑:
+//小程序api向蓝牙打印机发送数据打印,发送的任何内容都应该要转成二进制数据,而且蓝牙打印的文本编码是GBK的,发送中文需转成GBK编码再转成二进制数据发送
+//发送打印机指令也要转成二进制数据发送
+//蓝牙打印机一次接收的二级制数据有限制,不同的系统不同的蓝牙设备限制可能不同,微信建议一次20个字节,需做递归分包发送
+//发送完要打印的内容后,一定要发送一个打印的指令才能顺利打印 (有些指令就不需要)
+
+//一、初始化蓝牙、开始检索蓝牙设备
+// { allowDuplicatesKey: true, interval: 500}
+export function openBlue() {
+	return uniAsyncPromise('openBluetoothAdapter')
+}
+
+export function startBluetoothDevicesDiscovery(option) {
+	console.log('开始蓝牙扫描');
+	uniAsyncPromise('startBluetoothDevicesDiscovery', option).then((res) => {
+		console.log('正在搜寻蓝牙设备', res);
+	});
+}
+
+export function getConnectedBluetoothDevices(option) {
+	console.log('开始获取已连接设备');
+	return uniAsyncPromise('getConnectedBluetoothDevices', option)
+}
+//二、
+/**
+ *
+ *
+ * @export
+ * @param {function} getDevices uni.getBluetoothDevices的监听回调函数
+ */
+export function onfindBlueDevices(getDevices) {
+	//监听寻找到新设备的事件
+	uni.onBluetoothDeviceFound((devices)=>{
+		//获取在蓝牙模块生效期间所有已发现的蓝牙设备
+		uniAsyncPromise('getBluetoothDevices').then((res) => {
+			getDevices && getDevices(res.devices);
+		});
+	});
+}
+
+/**
+ * @export
+ * @param {function} stopBlueDevicesDiscovery 关闭蓝牙扫描
+ */
+export function stopBlueDevicesDiscovery() {
+	//监听寻找到新设备的事件
+	console.log('停止蓝牙扫描');
+	return uniAsyncPromise('stopBluetoothDevicesDiscovery').then((res) => {
+		console.log('停止搜寻蓝牙设备', res);
+	});
+}
+
+
+
+//三、连接蓝牙设备
+/**
+ * @export
+ * @param {function} createBLEConnection 
+ * @param {number} deviceId 蓝牙设备id
+ */
+export function createBLEConnection(deviceId, sucess, fail) {
+	//连接蓝牙设备
+	console.log('连接蓝牙设备', deviceId);
+	uniAsyncPromise("createBLEConnection", {
+			deviceId,
+			timeout: 10000
+		})
+		.then(res => {
+			//连接成功可选择停止搜索蓝牙
+			stopBlueDevicesDiscovery();
+			console.log('连接成功');
+			sucess && sucess({
+				res: res,
+			});
+		})
+		.catch(res => {
+			console.log('连接设备异常' + res);
+			fail && fail({
+				res: res,
+			});
+		})
+	/*.finally(res=>{
+	    console.log('连接成功');
+	    sucess && sucess({
+	        res: res,
+	    });
+	});*/
+}
+
+export function closeBLEConnection(deviceId) {
+	console.log('断开蓝牙设备', deviceId);
+	uniAsyncPromise("closeBLEConnection", {
+			deviceId
+		})
+		.then(res => {
+			console.log('BLEDisconnect complete', res);
+		})
+		.catch(res => {
+			console.log('断开设备异常' + res);
+		})
+	/*.finally(res=>{
+	    console.log('BLEDisconnect complete', res);            
+	});  */
+}
+
+//四、连接成功后, 获取蓝牙设备的service服务
+// uniAsyncPromise("getBLEDeviceServices",{deviceId:""}).then(res=>{})
+export function getBLEDeviceServices(deviceId, success, fail) {
+	console.log('获取ServiceId', deviceId);
+	//加延迟避免取不到service
+	setTimeout(()=>{
+		uniAsyncPromise("getBLEDeviceServices", {
+			deviceId:deviceId
+		})
+		.then(res => {
+			console.log('服务', res);
+			success && success({
+				serviceId: res.services,
+			});
+		})
+		.catch((res) => {
+			//getBLEDeviceServices(deviceId, success, fail);
+			console.log('获取ServiceId异常' + res);
+			fail && fail({
+				res: res,
+			});
+		});
+	},1000)
+}
+
+//五、获取的service服务可能有多个,递归获取特征值(最后要用的是能读,能写,能监听的那个值的uuid作为特征值id)
+/**
+ *
+ *
+ * @export
+ * @param {number} deviceId 蓝牙设备id
+ * @param {array} services uniAsyncPromise("getBLEDeviceServices",{deviceId:""}).then(res=>{})获取的res.services
+ * @param {function} success 成功取得有用特征值uuid的回调函数
+ */
+export function getDeviceCharacteristics(deviceId, services, success, fail) {
+	//services = services.slice(0);
+	console.log('获取Characteristics', deviceId, services);
+	if (services.length) {
+		const serviceId = services.shift().uuid;
+		console.log('ServceID ', serviceId);
+		uniAsyncPromise('getBLEDeviceCharacteristics', {
+				deviceId,
+				serviceId,
+			})
+			.then((res) => {
+				console.log('getBLEDeviceCharacteristics', deviceId, serviceId, res);
+				let finished = false;
+				let write = false;
+				let notify = false;
+				let indicate = false;
+				var readId;
+				var writeId;
+				//有斑马品牌的一款打印机中res.characteristics的所有uuid都是相同的,找所有的properties存在(notify || indicate) && write这种情况就说明这个uuid是可用的(不确保所有的打印机都能用这种方式取得uuid,在主要测试得凯盛诺打印机res.characteristic只有一个uuid,所以也能用这个方式)
+				for (var i = 0; i < res.characteristics.length; i++) {
+					if (!notify) {
+						notify = res.characteristics[i].properties.notify;
+						if (notify) readId = res.characteristics[i].uuid;
+					}
+					if (!indicate) {
+						indicate = res.characteristics[i].properties.indicate;
+						if (indicate) readId = res.characteristics[i].uuid;
+					}
+					if (!write) {
+						write = res.characteristics[i].properties.write;
+						writeId = res.characteristics[i].uuid;
+					}
+					if ((notify || indicate) && write) {
+						/* 获取蓝牙特征值uuid */
+						success &&
+							success({
+								serviceId,
+								writeId: writeId,
+								readId: readId,
+							});
+						finished = true;
+						break;
+					}
+				}
+
+				if (!finished) {
+					getDeviceCharacteristics(deviceId, services, success, fail);
+				}
+			})
+			.catch((res) => {
+				getDeviceCharacteristics(deviceId, services, success, fail);
+			});
+	} else {
+		fail && fail();
+	}
+}
+
+//六、启动notify 蓝牙监听功能 然后使用 uni.onBLECharacteristicValueChange用来监听蓝牙设备传递数据
+/**
+ * @export
+ * @param {object} options
+ * {
+            deviceId,//蓝牙设备id
+            serviceId,//服务id
+            characteristicId,//可用特征值uuid
+    }
+ * @param {function} onChange 监听蓝牙设备传递数据回调函数
+ */
+export function onGetBLECharacteristicValueChange(options, onChange = function() {}) {
+	console.log('deviceId ', options.deviceId);
+	console.log('serviceId ', options.serviceId);
+	console.log('characteristicId ', options.characteristicId);
+	uniAsyncPromise('notifyBLECharacteristicValueChange', {
+		state: true,
+		...options,
+	}).then((res) => {
+		console.log('onBLECharacteristicValueChange ');
+		uni.onBLECharacteristicValueChange(onChange);
+	});
+}
+
+//七、发送数据(递归分包发送)
+/**
+ * @export
+ * @param {object} options
+ * {
+            deviceId,
+            serviceId,
+            characteristicId,
+			value [ArrayBuffer],
+			lasterSuccess,
+    }
+ */
+export function senBlData(deviceId, serviceId, characteristicId,uint8Array,lasterSuccess) {
+	console.log('************deviceId = [' + deviceId + ']  serviceId = [' + serviceId + '] characteristics=[' +characteristicId+ "]")
+	var uint8Buf = Array.from(uint8Array);
+	function split_array(datas,size){
+		var result = {};
+		var j = 0
+		if(datas.length < size) {
+			size = datas.length
+		}
+		for (var i = 0; i < datas.length; i += size) {
+			result[j] = datas.slice(i, i + size)
+			j++
+		}
+		return result
+	}
+	var sendloop = split_array(uint8Buf, 20);
+	console.log(sendloop.length)
+	function realWriteData(sendloop, i) {
+		var data = sendloop[i]
+		if(typeof(data) == "undefined"){
+			lasterSuccess()
+			return
+		}
+		//console.log("第【" + i + "】次写数据"+data)
+		var buffer = new ArrayBuffer(data.length)
+		var dataView = new DataView(buffer)
+		for (var j = 0; j < data.length; j++) {
+			dataView.setUint8(j, data[j]);
+		}
+		uni.writeBLECharacteristicValue({
+			deviceId,
+			serviceId,
+			characteristicId,
+			value: buffer,
+			success(res) {
+				console.log('发送成功',i)
+				setTimeout(()=>{
+					realWriteData(sendloop, i + 1);
+				},100)
+			},
+			fail(e) {
+				console.log('发送数据失败',e)
+			}
+		})
+	}
+   var i = 0;
+	realWriteData(sendloop, i);
+}
+ 
+/**
+ * toast显示捕获的蓝牙异常
+ */
+export function catchToast(err) {
+	const errMsg = {
+		10000: '未初始化蓝牙模块',
+		10001: '蓝牙未打开',
+		10002: '没有找到指定设备',
+		10003: '连接失败',
+		10004: '没有找到指定服务',
+		10005: '没有找到指定特征值',
+		10006: '当前连接已断开',
+		10007: '当前特征值不支持此操作',
+		10008: '系统上报异常',
+		10009: '系统版本低于 4.3 不支持BLE',
+		10012: '连接超时,请检查打印机是否被其它手机连接中'
+	};
+	let coode = err.errCode ? err.errCode.toString() : '';
+	let msg = errMsg[coode];
+	plus.nativeUI.toast(msg || coode, {
+		align: 'center',
+		verticalAlign: 'center',
+		duration:'long'
+	});
+}

+ 171 - 0
components/kk-printer/utils/util.js

@@ -0,0 +1,171 @@
+//const gbk = require('./gbk.js');
+//console.log("sasas" + gbk);
+const formatTime = date => {
+  const year = date.getFullYear()
+  const month = date.getMonth() + 1
+  const day = date.getDate()
+  const hour = date.getHours()
+  const minute = date.getMinutes()
+  const second = date.getSeconds()
+
+  return [year, month, day].map(formatNumber).join('/') + ' ' + [hour, minute, second].map(formatNumber).join(':')
+}
+
+const formatNumber = n => {
+  n = n.toString()
+  return n[1] ? n : '0' + n
+}
+
+/*
+const hexStringToBuff = str => { //str='中国:WXHSH'
+  const buffer = new ArrayBuffer((sumStrLength(str)) * 4)
+  const dataView = new DataView(buffer)
+  var data = str.toString();
+  var p = 0; //ArrayBuffer 偏移量
+  for (var i = 0; i < data.length; i++) {
+    if (isCN(data[i])) { //是中文
+      //调用GBK 转码
+      var t = gbk.encode(data[i]);
+      for (var j = 0; j < 2; j++) {
+        //var code = t[j * 2] + t[j * 2 + 1];
+        var code = t[j * 3 + 1] + t[j * 3 + 2];
+         var temp = parseInt(code, 16)
+        //var temp = strToHexCharCode(code);
+        dataView.setUint8(p++, temp)
+      }
+    } else {
+      var temp = data.charCodeAt(i);
+      dataView.setUint8(p++, temp)
+    }
+  }
+  return buffer;
+}
+*/
+function toUnicode(s) {
+  var str = "";
+  for (var i = 0; i < s.length; i++) {
+    str += "\\u" + s.charCodeAt(i).toString(16) + "\t";
+  }
+  return str;
+}
+
+function strToHexCharCode(str) {
+  if (str === "")
+    return "";
+  var hexCharCode = [];
+  hexCharCode.push("0x");
+  for (var i = 0; i < str.length; i++) {
+    hexCharCode.push((str.charCodeAt(i)).toString(16));
+  }
+  return hexCharCode.join("");
+}
+
+function sumStrLength(str) {
+  var length = 0;
+  var data = str.toString();
+  for (var i = 0; i < data.length; i++) {
+    if (isCN(data[i])) { //是中文
+      length += 2;
+    } else {
+      length += 1;
+    }
+  }
+  return length;
+}
+
+function isCN(str) {
+  if (/^[\u3220-\uFA29]+$/.test(str)) {
+    return true;
+  } else {
+    return false;
+  }
+}
+
+//汉字转码
+function hexStringToArrayBuffer(str) {
+  const buffer = new ArrayBuffer((str.length / 2) + 1)
+  const dataView = new DataView(buffer)
+  for (var i = 0; i < str.length / 2; i++) {
+    var temp = parseInt(str[i * 2] + str[i * 2 + 1], 16)
+    dataView.setUint8(i, temp)
+  }
+  dataView.setUint8((str.length / 2), 0x0a)
+  return buffer;
+}
+
+//返回八位数组
+function subString(str) {
+  var arr = [];
+  if (str.length > 8) { //大于8
+    for (var i = 0;
+      (i * 8) < str.length; i++) {
+      var temp = str.substring(i * 8, 8 * i + 8);
+      arr.push(temp)
+    }
+    return arr;
+  } else {
+    return str
+  }
+}
+
+//不带有汉字
+function hexStringToArrayBufferstr(str) {
+  let val = ""
+  for (let i = 0; i < str.length; i++) {
+    if (val === '') {
+      val = str.charCodeAt(i).toString(16)
+    } else {
+      val += ',' + str.charCodeAt(i).toString(16)
+    }
+  }
+  val += "," + "0x0a";
+  console.log(val)
+  // 将16进制转化为ArrayBuffer
+  return new Uint8Array(val.match(/[\da-f]{2}/gi).map(function(h) {
+    return parseInt(h, 16)
+  })).buffer
+}
+
+function ab2hex(buffer) {
+  let hexArr = Array.prototype.map.call(
+    new Uint8Array(buffer),
+    function (bit) {
+      return ('00' + bit.toString(16)).slice(-2)
+    })
+  return hexArr.join('');
+}
+
+// ArrayBuffer转为字符串,参数为ArrayBuffer对象
+function ab2str(buf) {
+  return String.fromCharCode.apply(null, new Uint8Array(buf));
+}
+
+// 字符串转为ArrayBuffer对象,参数为字符串
+function str2ab(str) {
+  var buf = new ArrayBuffer(str.length+1); // 补充/0
+  var bufView = new Uint8Array(buf);
+  for (var i = 0, strLen = str.length; i < strLen; i++) {
+    bufView[i] = str.charCodeAt(i);    
+  }
+  return buf;
+}
+
+function send0X0A() {
+  const buffer = new ArrayBuffer(1)
+  const dataView = new DataView(buffer)
+  dataView.setUint8(0, 0x0a)
+  return buffer;
+}
+
+function buf2hex(buffer) {
+  return Array.prototype.map.call(new Uint8Array(buffer), x => ('00' + x.toString(16)).slice(-2)).join('');
+}
+
+module.exports = {
+  hexStringToArrayBuffer: hexStringToArrayBuffer,
+  send0X0A: send0X0A,
+  ab2hex: ab2hex,
+  str2ab: str2ab,
+  ab2str: ab2str,
+  buf2hex: buf2hex
+}

+ 118 - 0
components/select/v-select.vue

@@ -0,0 +1,118 @@
+<template>
+	<picker @change="toChange" :value="index" :range="datalist" range-key="dispName">
+		<view style="display: flex;align-items: center;">
+			<input class="form-input" :disabled="disabled" style="width: 100%;" v-model="selected" placeholder-style="color:#C0C4CC" :placeholder="getPlaceholderText" />
+			<u-icon name="arrow-right" color="#C0C4CC" ></u-icon>
+		</view>
+	</picker>
+</template>
+
+<script>
+import { getLookUpDatas, listLookUp } from '@/api/data'
+export default {
+  name: 'v-select',
+  data () {
+    return {
+      selected: '',
+      datalist: [],
+      placeholderText: '请选择',
+      lookUp: [],
+	  index: 0
+    }
+  },
+  props: {
+    disabled: {
+      type: [Boolean, String],
+      default: false
+    },
+    multiple: {
+      type: [Boolean, String],
+      default: false
+    },
+    value: [String, Number, Array],
+    code: {
+      type: String,
+      required: true
+    },
+    placeholder: {
+      type: String,
+      default: ''
+    },
+    size: [String]
+  },
+  computed: {
+    getVal () {
+      return this.value
+    },
+    getPlaceholderText () {
+      let _this = this
+	  console.log(_this.lookUp,'_this.lookUp')
+      for (let i = 0; i < _this.lookUp.length; i++) {
+        if (_this.lookUp[i].code == _this.code) {
+          if (this.placeholder === '') _this.placeholderText = _this.lookUp[i].name
+          break
+        }
+      }
+      return _this.placeholderText
+    }
+  },
+  created () {
+    if (this.code) {
+      if (this.placeholder) {
+        this.placeholderText = this.placeholder
+      }
+      getLookUpDatas({
+        lookupCode: this.code,pageNo:1,pageSize:1000
+      }).then(result => {
+		  console.log(result, 'result')
+        if (result && result.status + '' === '200') {
+          this.datalist = result.data.list
+          
+        }
+      })
+    } else {
+      // console.log('请确认传递类型')
+    }
+    // 获取所有数据字典
+    this.lookUp = this.$store.state.vuex_allLookUp
+  },
+  methods: {
+    getDataList (){
+      return this.datalist
+    },
+    getOptionName (val) {
+      return this.datalist.find((item) => {
+        return item.code == val
+      })
+    },
+    getCodeByName (dispName) {
+      return this.datalist.find((item) => {
+        return item.dispName == dispName
+      })
+    },
+	resetVal(){
+		this.selected = ''
+		this.index = 0
+	},
+	// 赋值
+	setVal(code){
+		let index = this.datalist.findIndex(item=>{
+			return item.code == code
+		})
+		console.log(this.datalist,code,index)
+		this.index = index
+		this.selected = this.datalist[index].dispName
+	},
+    toChange (e) {
+		this.index = e.target.value
+		this.selected = this.datalist[this.index].dispName
+        this.$emit('itemChange', this.datalist[this.index].code)
+    }
+  }
+
+}
+</script>
+
+<style scoped>
+
+</style>

+ 32 - 0
config/index.js

@@ -0,0 +1,32 @@
+// 主题配置信息
+const getConfig = (theme) => {
+	const config = {
+		// 默认主题
+		"default":{
+			themePath: 'default',
+			pro_URL: 'https://iscm.360arrow.com/qpls-md/', // 生产地址
+			uat_URL: 'http://p.iscm.360arrow.com/qpls-md/', // 预发布地址
+			dev_URL: 'http://192.168.16.151:8503/qpls-md/', // 本地地址
+			appName: 'iSCM智慧供应链', // app 名称
+			company: '陕西山海高科信息技术有限公司',
+			loadText:{
+					loadmore: '轻轻上拉',
+					loading: '努力加载中',
+					nomore: '没有了'
+				},
+			primaryColor: '#335fb6', // 主色调
+			warringColor: '#f3bb12', // 警告
+			errorColor: '#E70012', // 错误
+			successColor: '#13C442', // 成功
+			infoColor: '#909399',
+			topBarBackground: 'linear-gradient(45deg, #fff, #fff)', // 顶部栏渐变色
+			topBarTitleColors: '#222222', // 顶部栏文字颜色
+		},
+		// 其它主题
+		"other":{}
+	}
+	
+	return config[theme]
+}
+
+export default getConfig

+ 1380 - 0
js_sdk/Sansnn-uQRCode/uqrcode.js

@@ -0,0 +1,1380 @@
+//---------------------------------------------------------------------
+// github https://github.com/Sansnn/uQRCode
+//---------------------------------------------------------------------
+
+let uQRCode = {};
+
+(function() {
+	//---------------------------------------------------------------------
+	// QRCode for JavaScript
+	//
+	// Copyright (c) 2009 Kazuhiko Arase
+	//
+	// URL: http://www.d-project.com/
+	//
+	// Licensed under the MIT license:
+	//   http://www.opensource.org/licenses/mit-license.php
+	//
+	// The word "QR Code" is registered trademark of 
+	// DENSO WAVE INCORPORATED
+	//   http://www.denso-wave.com/qrcode/faqpatent-e.html
+	//
+	//---------------------------------------------------------------------
+
+	//---------------------------------------------------------------------
+	// QR8bitByte
+	//---------------------------------------------------------------------
+
+	function QR8bitByte(data) {
+		this.mode = QRMode.MODE_8BIT_BYTE;
+		this.data = data;
+	}
+
+	QR8bitByte.prototype = {
+
+		getLength: function(buffer) {
+			return this.data.length;
+		},
+
+		write: function(buffer) {
+			for (var i = 0; i < this.data.length; i++) {
+				// not JIS ...
+				buffer.put(this.data.charCodeAt(i), 8);
+			}
+		}
+	};
+
+	//---------------------------------------------------------------------
+	// QRCode
+	//---------------------------------------------------------------------
+
+	function QRCode(typeNumber, errorCorrectLevel) {
+		this.typeNumber = typeNumber;
+		this.errorCorrectLevel = errorCorrectLevel;
+		this.modules = null;
+		this.moduleCount = 0;
+		this.dataCache = null;
+		this.dataList = new Array();
+	}
+
+	QRCode.prototype = {
+
+		addData: function(data) {
+			var newData = new QR8bitByte(data);
+			this.dataList.push(newData);
+			this.dataCache = null;
+		},
+
+		isDark: function(row, col) {
+			if (row < 0 || this.moduleCount <= row || col < 0 || this.moduleCount <= col) {
+				throw new Error(row + "," + col);
+			}
+			return this.modules[row][col];
+		},
+
+		getModuleCount: function() {
+			return this.moduleCount;
+		},
+
+		make: function() {
+			// Calculate automatically typeNumber if provided is < 1
+			if (this.typeNumber < 1) {
+				var typeNumber = 1;
+				for (typeNumber = 1; typeNumber < 40; typeNumber++) {
+					var rsBlocks = QRRSBlock.getRSBlocks(typeNumber, this.errorCorrectLevel);
+
+					var buffer = new QRBitBuffer();
+					var totalDataCount = 0;
+					for (var i = 0; i < rsBlocks.length; i++) {
+						totalDataCount += rsBlocks[i].dataCount;
+					}
+
+					for (var i = 0; i < this.dataList.length; i++) {
+						var data = this.dataList[i];
+						buffer.put(data.mode, 4);
+						buffer.put(data.getLength(), QRUtil.getLengthInBits(data.mode, typeNumber));
+						data.write(buffer);
+					}
+					if (buffer.getLengthInBits() <= totalDataCount * 8)
+						break;
+				}
+				this.typeNumber = typeNumber;
+			}
+			this.makeImpl(false, this.getBestMaskPattern());
+		},
+
+		makeImpl: function(test, maskPattern) {
+
+			this.moduleCount = this.typeNumber * 4 + 17;
+			this.modules = new Array(this.moduleCount);
+
+			for (var row = 0; row < this.moduleCount; row++) {
+
+				this.modules[row] = new Array(this.moduleCount);
+
+				for (var col = 0; col < this.moduleCount; col++) {
+					this.modules[row][col] = null; //(col + row) % 3;
+				}
+			}
+
+			this.setupPositionProbePattern(0, 0);
+			this.setupPositionProbePattern(this.moduleCount - 7, 0);
+			this.setupPositionProbePattern(0, this.moduleCount - 7);
+			this.setupPositionAdjustPattern();
+			this.setupTimingPattern();
+			this.setupTypeInfo(test, maskPattern);
+
+			if (this.typeNumber >= 7) {
+				this.setupTypeNumber(test);
+			}
+
+			if (this.dataCache == null) {
+				this.dataCache = QRCode.createData(this.typeNumber, this.errorCorrectLevel, this.dataList);
+			}
+
+			this.mapData(this.dataCache, maskPattern);
+		},
+
+		setupPositionProbePattern: function(row, col) {
+
+			for (var r = -1; r <= 7; r++) {
+
+				if (row + r <= -1 || this.moduleCount <= row + r) continue;
+
+				for (var c = -1; c <= 7; c++) {
+
+					if (col + c <= -1 || this.moduleCount <= col + c) continue;
+
+					if ((0 <= r && r <= 6 && (c == 0 || c == 6)) ||
+						(0 <= c && c <= 6 && (r == 0 || r == 6)) ||
+						(2 <= r && r <= 4 && 2 <= c && c <= 4)) {
+						this.modules[row + r][col + c] = true;
+					} else {
+						this.modules[row + r][col + c] = false;
+					}
+				}
+			}
+		},
+
+		getBestMaskPattern: function() {
+
+			var minLostPoint = 0;
+			var pattern = 0;
+
+			for (var i = 0; i < 8; i++) {
+
+				this.makeImpl(true, i);
+
+				var lostPoint = QRUtil.getLostPoint(this);
+
+				if (i == 0 || minLostPoint > lostPoint) {
+					minLostPoint = lostPoint;
+					pattern = i;
+				}
+			}
+
+			return pattern;
+		},
+
+		createMovieClip: function(target_mc, instance_name, depth) {
+
+			var qr_mc = target_mc.createEmptyMovieClip(instance_name, depth);
+			var cs = 1;
+
+			this.make();
+
+			for (var row = 0; row < this.modules.length; row++) {
+
+				var y = row * cs;
+
+				for (var col = 0; col < this.modules[row].length; col++) {
+
+					var x = col * cs;
+					var dark = this.modules[row][col];
+
+					if (dark) {
+						qr_mc.beginFill(0, 100);
+						qr_mc.moveTo(x, y);
+						qr_mc.lineTo(x + cs, y);
+						qr_mc.lineTo(x + cs, y + cs);
+						qr_mc.lineTo(x, y + cs);
+						qr_mc.endFill();
+					}
+				}
+			}
+
+			return qr_mc;
+		},
+
+		setupTimingPattern: function() {
+
+			for (var r = 8; r < this.moduleCount - 8; r++) {
+				if (this.modules[r][6] != null) {
+					continue;
+				}
+				this.modules[r][6] = (r % 2 == 0);
+			}
+
+			for (var c = 8; c < this.moduleCount - 8; c++) {
+				if (this.modules[6][c] != null) {
+					continue;
+				}
+				this.modules[6][c] = (c % 2 == 0);
+			}
+		},
+
+		setupPositionAdjustPattern: function() {
+
+			var pos = QRUtil.getPatternPosition(this.typeNumber);
+
+			for (var i = 0; i < pos.length; i++) {
+
+				for (var j = 0; j < pos.length; j++) {
+
+					var row = pos[i];
+					var col = pos[j];
+
+					if (this.modules[row][col] != null) {
+						continue;
+					}
+
+					for (var r = -2; r <= 2; r++) {
+
+						for (var c = -2; c <= 2; c++) {
+
+							if (r == -2 || r == 2 || c == -2 || c == 2 ||
+								(r == 0 && c == 0)) {
+								this.modules[row + r][col + c] = true;
+							} else {
+								this.modules[row + r][col + c] = false;
+							}
+						}
+					}
+				}
+			}
+		},
+
+		setupTypeNumber: function(test) {
+
+			var bits = QRUtil.getBCHTypeNumber(this.typeNumber);
+
+			for (var i = 0; i < 18; i++) {
+				var mod = (!test && ((bits >> i) & 1) == 1);
+				this.modules[Math.floor(i / 3)][i % 3 + this.moduleCount - 8 - 3] = mod;
+			}
+
+			for (var i = 0; i < 18; i++) {
+				var mod = (!test && ((bits >> i) & 1) == 1);
+				this.modules[i % 3 + this.moduleCount - 8 - 3][Math.floor(i / 3)] = mod;
+			}
+		},
+
+		setupTypeInfo: function(test, maskPattern) {
+
+			var data = (this.errorCorrectLevel << 3) | maskPattern;
+			var bits = QRUtil.getBCHTypeInfo(data);
+
+			// vertical		
+			for (var i = 0; i < 15; i++) {
+
+				var mod = (!test && ((bits >> i) & 1) == 1);
+
+				if (i < 6) {
+					this.modules[i][8] = mod;
+				} else if (i < 8) {
+					this.modules[i + 1][8] = mod;
+				} else {
+					this.modules[this.moduleCount - 15 + i][8] = mod;
+				}
+			}
+
+			// horizontal
+			for (var i = 0; i < 15; i++) {
+
+				var mod = (!test && ((bits >> i) & 1) == 1);
+
+				if (i < 8) {
+					this.modules[8][this.moduleCount - i - 1] = mod;
+				} else if (i < 9) {
+					this.modules[8][15 - i - 1 + 1] = mod;
+				} else {
+					this.modules[8][15 - i - 1] = mod;
+				}
+			}
+
+			// fixed module
+			this.modules[this.moduleCount - 8][8] = (!test);
+
+		},
+
+		mapData: function(data, maskPattern) {
+
+			var inc = -1;
+			var row = this.moduleCount - 1;
+			var bitIndex = 7;
+			var byteIndex = 0;
+
+			for (var col = this.moduleCount - 1; col > 0; col -= 2) {
+
+				if (col == 6) col--;
+
+				while (true) {
+
+					for (var c = 0; c < 2; c++) {
+
+						if (this.modules[row][col - c] == null) {
+
+							var dark = false;
+
+							if (byteIndex < data.length) {
+								dark = (((data[byteIndex] >>> bitIndex) & 1) == 1);
+							}
+
+							var mask = QRUtil.getMask(maskPattern, row, col - c);
+
+							if (mask) {
+								dark = !dark;
+							}
+
+							this.modules[row][col - c] = dark;
+							bitIndex--;
+
+							if (bitIndex == -1) {
+								byteIndex++;
+								bitIndex = 7;
+							}
+						}
+					}
+
+					row += inc;
+
+					if (row < 0 || this.moduleCount <= row) {
+						row -= inc;
+						inc = -inc;
+						break;
+					}
+				}
+			}
+
+		}
+
+	};
+
+	QRCode.PAD0 = 0xEC;
+	QRCode.PAD1 = 0x11;
+
+	QRCode.createData = function(typeNumber, errorCorrectLevel, dataList) {
+
+		var rsBlocks = QRRSBlock.getRSBlocks(typeNumber, errorCorrectLevel);
+
+		var buffer = new QRBitBuffer();
+
+		for (var i = 0; i < dataList.length; i++) {
+			var data = dataList[i];
+			buffer.put(data.mode, 4);
+			buffer.put(data.getLength(), QRUtil.getLengthInBits(data.mode, typeNumber));
+			data.write(buffer);
+		}
+
+		// calc num max data.
+		var totalDataCount = 0;
+		for (var i = 0; i < rsBlocks.length; i++) {
+			totalDataCount += rsBlocks[i].dataCount;
+		}
+
+		if (buffer.getLengthInBits() > totalDataCount * 8) {
+			throw new Error("code length overflow. (" +
+				buffer.getLengthInBits() +
+				">" +
+				totalDataCount * 8 +
+				")");
+		}
+
+		// end code
+		if (buffer.getLengthInBits() + 4 <= totalDataCount * 8) {
+			buffer.put(0, 4);
+		}
+
+		// padding
+		while (buffer.getLengthInBits() % 8 != 0) {
+			buffer.putBit(false);
+		}
+
+		// padding
+		while (true) {
+
+			if (buffer.getLengthInBits() >= totalDataCount * 8) {
+				break;
+			}
+			buffer.put(QRCode.PAD0, 8);
+
+			if (buffer.getLengthInBits() >= totalDataCount * 8) {
+				break;
+			}
+			buffer.put(QRCode.PAD1, 8);
+		}
+
+		return QRCode.createBytes(buffer, rsBlocks);
+	}
+
+	QRCode.createBytes = function(buffer, rsBlocks) {
+
+		var offset = 0;
+
+		var maxDcCount = 0;
+		var maxEcCount = 0;
+
+		var dcdata = new Array(rsBlocks.length);
+		var ecdata = new Array(rsBlocks.length);
+
+		for (var r = 0; r < rsBlocks.length; r++) {
+
+			var dcCount = rsBlocks[r].dataCount;
+			var ecCount = rsBlocks[r].totalCount - dcCount;
+
+			maxDcCount = Math.max(maxDcCount, dcCount);
+			maxEcCount = Math.max(maxEcCount, ecCount);
+
+			dcdata[r] = new Array(dcCount);
+
+			for (var i = 0; i < dcdata[r].length; i++) {
+				dcdata[r][i] = 0xff & buffer.buffer[i + offset];
+			}
+			offset += dcCount;
+
+			var rsPoly = QRUtil.getErrorCorrectPolynomial(ecCount);
+			var rawPoly = new QRPolynomial(dcdata[r], rsPoly.getLength() - 1);
+
+			var modPoly = rawPoly.mod(rsPoly);
+			ecdata[r] = new Array(rsPoly.getLength() - 1);
+			for (var i = 0; i < ecdata[r].length; i++) {
+				var modIndex = i + modPoly.getLength() - ecdata[r].length;
+				ecdata[r][i] = (modIndex >= 0) ? modPoly.get(modIndex) : 0;
+			}
+
+		}
+
+		var totalCodeCount = 0;
+		for (var i = 0; i < rsBlocks.length; i++) {
+			totalCodeCount += rsBlocks[i].totalCount;
+		}
+
+		var data = new Array(totalCodeCount);
+		var index = 0;
+
+		for (var i = 0; i < maxDcCount; i++) {
+			for (var r = 0; r < rsBlocks.length; r++) {
+				if (i < dcdata[r].length) {
+					data[index++] = dcdata[r][i];
+				}
+			}
+		}
+
+		for (var i = 0; i < maxEcCount; i++) {
+			for (var r = 0; r < rsBlocks.length; r++) {
+				if (i < ecdata[r].length) {
+					data[index++] = ecdata[r][i];
+				}
+			}
+		}
+
+		return data;
+
+	}
+
+	//---------------------------------------------------------------------
+	// QRMode
+	//---------------------------------------------------------------------
+
+	var QRMode = {
+		MODE_NUMBER: 1 << 0,
+		MODE_ALPHA_NUM: 1 << 1,
+		MODE_8BIT_BYTE: 1 << 2,
+		MODE_KANJI: 1 << 3
+	};
+
+	//---------------------------------------------------------------------
+	// QRErrorCorrectLevel
+	//---------------------------------------------------------------------
+
+	var QRErrorCorrectLevel = {
+		L: 1,
+		M: 0,
+		Q: 3,
+		H: 2
+	};
+
+	//---------------------------------------------------------------------
+	// QRMaskPattern
+	//---------------------------------------------------------------------
+
+	var QRMaskPattern = {
+		PATTERN000: 0,
+		PATTERN001: 1,
+		PATTERN010: 2,
+		PATTERN011: 3,
+		PATTERN100: 4,
+		PATTERN101: 5,
+		PATTERN110: 6,
+		PATTERN111: 7
+	};
+
+	//---------------------------------------------------------------------
+	// QRUtil
+	//---------------------------------------------------------------------
+
+	var QRUtil = {
+
+		PATTERN_POSITION_TABLE: [
+			[],
+			[6, 18],
+			[6, 22],
+			[6, 26],
+			[6, 30],
+			[6, 34],
+			[6, 22, 38],
+			[6, 24, 42],
+			[6, 26, 46],
+			[6, 28, 50],
+			[6, 30, 54],
+			[6, 32, 58],
+			[6, 34, 62],
+			[6, 26, 46, 66],
+			[6, 26, 48, 70],
+			[6, 26, 50, 74],
+			[6, 30, 54, 78],
+			[6, 30, 56, 82],
+			[6, 30, 58, 86],
+			[6, 34, 62, 90],
+			[6, 28, 50, 72, 94],
+			[6, 26, 50, 74, 98],
+			[6, 30, 54, 78, 102],
+			[6, 28, 54, 80, 106],
+			[6, 32, 58, 84, 110],
+			[6, 30, 58, 86, 114],
+			[6, 34, 62, 90, 118],
+			[6, 26, 50, 74, 98, 122],
+			[6, 30, 54, 78, 102, 126],
+			[6, 26, 52, 78, 104, 130],
+			[6, 30, 56, 82, 108, 134],
+			[6, 34, 60, 86, 112, 138],
+			[6, 30, 58, 86, 114, 142],
+			[6, 34, 62, 90, 118, 146],
+			[6, 30, 54, 78, 102, 126, 150],
+			[6, 24, 50, 76, 102, 128, 154],
+			[6, 28, 54, 80, 106, 132, 158],
+			[6, 32, 58, 84, 110, 136, 162],
+			[6, 26, 54, 82, 110, 138, 166],
+			[6, 30, 58, 86, 114, 142, 170]
+		],
+
+		G15: (1 << 10) | (1 << 8) | (1 << 5) | (1 << 4) | (1 << 2) | (1 << 1) | (1 << 0),
+		G18: (1 << 12) | (1 << 11) | (1 << 10) | (1 << 9) | (1 << 8) | (1 << 5) | (1 << 2) | (1 << 0),
+		G15_MASK: (1 << 14) | (1 << 12) | (1 << 10) | (1 << 4) | (1 << 1),
+
+		getBCHTypeInfo: function(data) {
+			var d = data << 10;
+			while (QRUtil.getBCHDigit(d) - QRUtil.getBCHDigit(QRUtil.G15) >= 0) {
+				d ^= (QRUtil.G15 << (QRUtil.getBCHDigit(d) - QRUtil.getBCHDigit(QRUtil.G15)));
+			}
+			return ((data << 10) | d) ^ QRUtil.G15_MASK;
+		},
+
+		getBCHTypeNumber: function(data) {
+			var d = data << 12;
+			while (QRUtil.getBCHDigit(d) - QRUtil.getBCHDigit(QRUtil.G18) >= 0) {
+				d ^= (QRUtil.G18 << (QRUtil.getBCHDigit(d) - QRUtil.getBCHDigit(QRUtil.G18)));
+			}
+			return (data << 12) | d;
+		},
+
+		getBCHDigit: function(data) {
+
+			var digit = 0;
+
+			while (data != 0) {
+				digit++;
+				data >>>= 1;
+			}
+
+			return digit;
+		},
+
+		getPatternPosition: function(typeNumber) {
+			return QRUtil.PATTERN_POSITION_TABLE[typeNumber - 1];
+		},
+
+		getMask: function(maskPattern, i, j) {
+
+			switch (maskPattern) {
+
+				case QRMaskPattern.PATTERN000:
+					return (i + j) % 2 == 0;
+				case QRMaskPattern.PATTERN001:
+					return i % 2 == 0;
+				case QRMaskPattern.PATTERN010:
+					return j % 3 == 0;
+				case QRMaskPattern.PATTERN011:
+					return (i + j) % 3 == 0;
+				case QRMaskPattern.PATTERN100:
+					return (Math.floor(i / 2) + Math.floor(j / 3)) % 2 == 0;
+				case QRMaskPattern.PATTERN101:
+					return (i * j) % 2 + (i * j) % 3 == 0;
+				case QRMaskPattern.PATTERN110:
+					return ((i * j) % 2 + (i * j) % 3) % 2 == 0;
+				case QRMaskPattern.PATTERN111:
+					return ((i * j) % 3 + (i + j) % 2) % 2 == 0;
+
+				default:
+					throw new Error("bad maskPattern:" + maskPattern);
+			}
+		},
+
+		getErrorCorrectPolynomial: function(errorCorrectLength) {
+
+			var a = new QRPolynomial([1], 0);
+
+			for (var i = 0; i < errorCorrectLength; i++) {
+				a = a.multiply(new QRPolynomial([1, QRMath.gexp(i)], 0));
+			}
+
+			return a;
+		},
+
+		getLengthInBits: function(mode, type) {
+
+			if (1 <= type && type < 10) {
+
+				// 1 - 9
+
+				switch (mode) {
+					case QRMode.MODE_NUMBER:
+						return 10;
+					case QRMode.MODE_ALPHA_NUM:
+						return 9;
+					case QRMode.MODE_8BIT_BYTE:
+						return 8;
+					case QRMode.MODE_KANJI:
+						return 8;
+					default:
+						throw new Error("mode:" + mode);
+				}
+
+			} else if (type < 27) {
+
+				// 10 - 26
+
+				switch (mode) {
+					case QRMode.MODE_NUMBER:
+						return 12;
+					case QRMode.MODE_ALPHA_NUM:
+						return 11;
+					case QRMode.MODE_8BIT_BYTE:
+						return 16;
+					case QRMode.MODE_KANJI:
+						return 10;
+					default:
+						throw new Error("mode:" + mode);
+				}
+
+			} else if (type < 41) {
+
+				// 27 - 40
+
+				switch (mode) {
+					case QRMode.MODE_NUMBER:
+						return 14;
+					case QRMode.MODE_ALPHA_NUM:
+						return 13;
+					case QRMode.MODE_8BIT_BYTE:
+						return 16;
+					case QRMode.MODE_KANJI:
+						return 12;
+					default:
+						throw new Error("mode:" + mode);
+				}
+
+			} else {
+				throw new Error("type:" + type);
+			}
+		},
+
+		getLostPoint: function(qrCode) {
+
+			var moduleCount = qrCode.getModuleCount();
+
+			var lostPoint = 0;
+
+			// LEVEL1
+
+			for (var row = 0; row < moduleCount; row++) {
+
+				for (var col = 0; col < moduleCount; col++) {
+
+					var sameCount = 0;
+					var dark = qrCode.isDark(row, col);
+
+					for (var r = -1; r <= 1; r++) {
+
+						if (row + r < 0 || moduleCount <= row + r) {
+							continue;
+						}
+
+						for (var c = -1; c <= 1; c++) {
+
+							if (col + c < 0 || moduleCount <= col + c) {
+								continue;
+							}
+
+							if (r == 0 && c == 0) {
+								continue;
+							}
+
+							if (dark == qrCode.isDark(row + r, col + c)) {
+								sameCount++;
+							}
+						}
+					}
+
+					if (sameCount > 5) {
+						lostPoint += (3 + sameCount - 5);
+					}
+				}
+			}
+
+			// LEVEL2
+
+			for (var row = 0; row < moduleCount - 1; row++) {
+				for (var col = 0; col < moduleCount - 1; col++) {
+					var count = 0;
+					if (qrCode.isDark(row, col)) count++;
+					if (qrCode.isDark(row + 1, col)) count++;
+					if (qrCode.isDark(row, col + 1)) count++;
+					if (qrCode.isDark(row + 1, col + 1)) count++;
+					if (count == 0 || count == 4) {
+						lostPoint += 3;
+					}
+				}
+			}
+
+			// LEVEL3
+
+			for (var row = 0; row < moduleCount; row++) {
+				for (var col = 0; col < moduleCount - 6; col++) {
+					if (qrCode.isDark(row, col) &&
+						!qrCode.isDark(row, col + 1) &&
+						qrCode.isDark(row, col + 2) &&
+						qrCode.isDark(row, col + 3) &&
+						qrCode.isDark(row, col + 4) &&
+						!qrCode.isDark(row, col + 5) &&
+						qrCode.isDark(row, col + 6)) {
+						lostPoint += 40;
+					}
+				}
+			}
+
+			for (var col = 0; col < moduleCount; col++) {
+				for (var row = 0; row < moduleCount - 6; row++) {
+					if (qrCode.isDark(row, col) &&
+						!qrCode.isDark(row + 1, col) &&
+						qrCode.isDark(row + 2, col) &&
+						qrCode.isDark(row + 3, col) &&
+						qrCode.isDark(row + 4, col) &&
+						!qrCode.isDark(row + 5, col) &&
+						qrCode.isDark(row + 6, col)) {
+						lostPoint += 40;
+					}
+				}
+			}
+
+			// LEVEL4
+
+			var darkCount = 0;
+
+			for (var col = 0; col < moduleCount; col++) {
+				for (var row = 0; row < moduleCount; row++) {
+					if (qrCode.isDark(row, col)) {
+						darkCount++;
+					}
+				}
+			}
+
+			var ratio = Math.abs(100 * darkCount / moduleCount / moduleCount - 50) / 5;
+			lostPoint += ratio * 10;
+
+			return lostPoint;
+		}
+
+	};
+
+
+	//---------------------------------------------------------------------
+	// QRMath
+	//---------------------------------------------------------------------
+
+	var QRMath = {
+
+		glog: function(n) {
+
+			if (n < 1) {
+				throw new Error("glog(" + n + ")");
+			}
+
+			return QRMath.LOG_TABLE[n];
+		},
+
+		gexp: function(n) {
+
+			while (n < 0) {
+				n += 255;
+			}
+
+			while (n >= 256) {
+				n -= 255;
+			}
+
+			return QRMath.EXP_TABLE[n];
+		},
+
+		EXP_TABLE: new Array(256),
+
+		LOG_TABLE: new Array(256)
+
+	};
+
+	for (var i = 0; i < 8; i++) {
+		QRMath.EXP_TABLE[i] = 1 << i;
+	}
+	for (var i = 8; i < 256; i++) {
+		QRMath.EXP_TABLE[i] = QRMath.EXP_TABLE[i - 4] ^
+			QRMath.EXP_TABLE[i - 5] ^
+			QRMath.EXP_TABLE[i - 6] ^
+			QRMath.EXP_TABLE[i - 8];
+	}
+	for (var i = 0; i < 255; i++) {
+		QRMath.LOG_TABLE[QRMath.EXP_TABLE[i]] = i;
+	}
+
+	//---------------------------------------------------------------------
+	// QRPolynomial
+	//---------------------------------------------------------------------
+
+	function QRPolynomial(num, shift) {
+
+		if (num.length == undefined) {
+			throw new Error(num.length + "/" + shift);
+		}
+
+		var offset = 0;
+
+		while (offset < num.length && num[offset] == 0) {
+			offset++;
+		}
+
+		this.num = new Array(num.length - offset + shift);
+		for (var i = 0; i < num.length - offset; i++) {
+			this.num[i] = num[i + offset];
+		}
+	}
+
+	QRPolynomial.prototype = {
+
+		get: function(index) {
+			return this.num[index];
+		},
+
+		getLength: function() {
+			return this.num.length;
+		},
+
+		multiply: function(e) {
+
+			var num = new Array(this.getLength() + e.getLength() - 1);
+
+			for (var i = 0; i < this.getLength(); i++) {
+				for (var j = 0; j < e.getLength(); j++) {
+					num[i + j] ^= QRMath.gexp(QRMath.glog(this.get(i)) + QRMath.glog(e.get(j)));
+				}
+			}
+
+			return new QRPolynomial(num, 0);
+		},
+
+		mod: function(e) {
+
+			if (this.getLength() - e.getLength() < 0) {
+				return this;
+			}
+
+			var ratio = QRMath.glog(this.get(0)) - QRMath.glog(e.get(0));
+
+			var num = new Array(this.getLength());
+
+			for (var i = 0; i < this.getLength(); i++) {
+				num[i] = this.get(i);
+			}
+
+			for (var i = 0; i < e.getLength(); i++) {
+				num[i] ^= QRMath.gexp(QRMath.glog(e.get(i)) + ratio);
+			}
+
+			// recursive call
+			return new QRPolynomial(num, 0).mod(e);
+		}
+	};
+
+	//---------------------------------------------------------------------
+	// QRRSBlock
+	//---------------------------------------------------------------------
+
+	function QRRSBlock(totalCount, dataCount) {
+		this.totalCount = totalCount;
+		this.dataCount = dataCount;
+	}
+
+	QRRSBlock.RS_BLOCK_TABLE = [
+
+		// L
+		// M
+		// Q
+		// H
+
+		// 1
+		[1, 26, 19],
+		[1, 26, 16],
+		[1, 26, 13],
+		[1, 26, 9],
+
+		// 2
+		[1, 44, 34],
+		[1, 44, 28],
+		[1, 44, 22],
+		[1, 44, 16],
+
+		// 3
+		[1, 70, 55],
+		[1, 70, 44],
+		[2, 35, 17],
+		[2, 35, 13],
+
+		// 4		
+		[1, 100, 80],
+		[2, 50, 32],
+		[2, 50, 24],
+		[4, 25, 9],
+
+		// 5
+		[1, 134, 108],
+		[2, 67, 43],
+		[2, 33, 15, 2, 34, 16],
+		[2, 33, 11, 2, 34, 12],
+
+		// 6
+		[2, 86, 68],
+		[4, 43, 27],
+		[4, 43, 19],
+		[4, 43, 15],
+
+		// 7		
+		[2, 98, 78],
+		[4, 49, 31],
+		[2, 32, 14, 4, 33, 15],
+		[4, 39, 13, 1, 40, 14],
+
+		// 8
+		[2, 121, 97],
+		[2, 60, 38, 2, 61, 39],
+		[4, 40, 18, 2, 41, 19],
+		[4, 40, 14, 2, 41, 15],
+
+		// 9
+		[2, 146, 116],
+		[3, 58, 36, 2, 59, 37],
+		[4, 36, 16, 4, 37, 17],
+		[4, 36, 12, 4, 37, 13],
+
+		// 10		
+		[2, 86, 68, 2, 87, 69],
+		[4, 69, 43, 1, 70, 44],
+		[6, 43, 19, 2, 44, 20],
+		[6, 43, 15, 2, 44, 16],
+
+		// 11
+		[4, 101, 81],
+		[1, 80, 50, 4, 81, 51],
+		[4, 50, 22, 4, 51, 23],
+		[3, 36, 12, 8, 37, 13],
+
+		// 12
+		[2, 116, 92, 2, 117, 93],
+		[6, 58, 36, 2, 59, 37],
+		[4, 46, 20, 6, 47, 21],
+		[7, 42, 14, 4, 43, 15],
+
+		// 13
+		[4, 133, 107],
+		[8, 59, 37, 1, 60, 38],
+		[8, 44, 20, 4, 45, 21],
+		[12, 33, 11, 4, 34, 12],
+
+		// 14
+		[3, 145, 115, 1, 146, 116],
+		[4, 64, 40, 5, 65, 41],
+		[11, 36, 16, 5, 37, 17],
+		[11, 36, 12, 5, 37, 13],
+
+		// 15
+		[5, 109, 87, 1, 110, 88],
+		[5, 65, 41, 5, 66, 42],
+		[5, 54, 24, 7, 55, 25],
+		[11, 36, 12],
+
+		// 16
+		[5, 122, 98, 1, 123, 99],
+		[7, 73, 45, 3, 74, 46],
+		[15, 43, 19, 2, 44, 20],
+		[3, 45, 15, 13, 46, 16],
+
+		// 17
+		[1, 135, 107, 5, 136, 108],
+		[10, 74, 46, 1, 75, 47],
+		[1, 50, 22, 15, 51, 23],
+		[2, 42, 14, 17, 43, 15],
+
+		// 18
+		[5, 150, 120, 1, 151, 121],
+		[9, 69, 43, 4, 70, 44],
+		[17, 50, 22, 1, 51, 23],
+		[2, 42, 14, 19, 43, 15],
+
+		// 19
+		[3, 141, 113, 4, 142, 114],
+		[3, 70, 44, 11, 71, 45],
+		[17, 47, 21, 4, 48, 22],
+		[9, 39, 13, 16, 40, 14],
+
+		// 20
+		[3, 135, 107, 5, 136, 108],
+		[3, 67, 41, 13, 68, 42],
+		[15, 54, 24, 5, 55, 25],
+		[15, 43, 15, 10, 44, 16],
+
+		// 21
+		[4, 144, 116, 4, 145, 117],
+		[17, 68, 42],
+		[17, 50, 22, 6, 51, 23],
+		[19, 46, 16, 6, 47, 17],
+
+		// 22
+		[2, 139, 111, 7, 140, 112],
+		[17, 74, 46],
+		[7, 54, 24, 16, 55, 25],
+		[34, 37, 13],
+
+		// 23
+		[4, 151, 121, 5, 152, 122],
+		[4, 75, 47, 14, 76, 48],
+		[11, 54, 24, 14, 55, 25],
+		[16, 45, 15, 14, 46, 16],
+
+		// 24
+		[6, 147, 117, 4, 148, 118],
+		[6, 73, 45, 14, 74, 46],
+		[11, 54, 24, 16, 55, 25],
+		[30, 46, 16, 2, 47, 17],
+
+		// 25
+		[8, 132, 106, 4, 133, 107],
+		[8, 75, 47, 13, 76, 48],
+		[7, 54, 24, 22, 55, 25],
+		[22, 45, 15, 13, 46, 16],
+
+		// 26
+		[10, 142, 114, 2, 143, 115],
+		[19, 74, 46, 4, 75, 47],
+		[28, 50, 22, 6, 51, 23],
+		[33, 46, 16, 4, 47, 17],
+
+		// 27
+		[8, 152, 122, 4, 153, 123],
+		[22, 73, 45, 3, 74, 46],
+		[8, 53, 23, 26, 54, 24],
+		[12, 45, 15, 28, 46, 16],
+
+		// 28
+		[3, 147, 117, 10, 148, 118],
+		[3, 73, 45, 23, 74, 46],
+		[4, 54, 24, 31, 55, 25],
+		[11, 45, 15, 31, 46, 16],
+
+		// 29
+		[7, 146, 116, 7, 147, 117],
+		[21, 73, 45, 7, 74, 46],
+		[1, 53, 23, 37, 54, 24],
+		[19, 45, 15, 26, 46, 16],
+
+		// 30
+		[5, 145, 115, 10, 146, 116],
+		[19, 75, 47, 10, 76, 48],
+		[15, 54, 24, 25, 55, 25],
+		[23, 45, 15, 25, 46, 16],
+
+		// 31
+		[13, 145, 115, 3, 146, 116],
+		[2, 74, 46, 29, 75, 47],
+		[42, 54, 24, 1, 55, 25],
+		[23, 45, 15, 28, 46, 16],
+
+		// 32
+		[17, 145, 115],
+		[10, 74, 46, 23, 75, 47],
+		[10, 54, 24, 35, 55, 25],
+		[19, 45, 15, 35, 46, 16],
+
+		// 33
+		[17, 145, 115, 1, 146, 116],
+		[14, 74, 46, 21, 75, 47],
+		[29, 54, 24, 19, 55, 25],
+		[11, 45, 15, 46, 46, 16],
+
+		// 34
+		[13, 145, 115, 6, 146, 116],
+		[14, 74, 46, 23, 75, 47],
+		[44, 54, 24, 7, 55, 25],
+		[59, 46, 16, 1, 47, 17],
+
+		// 35
+		[12, 151, 121, 7, 152, 122],
+		[12, 75, 47, 26, 76, 48],
+		[39, 54, 24, 14, 55, 25],
+		[22, 45, 15, 41, 46, 16],
+
+		// 36
+		[6, 151, 121, 14, 152, 122],
+		[6, 75, 47, 34, 76, 48],
+		[46, 54, 24, 10, 55, 25],
+		[2, 45, 15, 64, 46, 16],
+
+		// 37
+		[17, 152, 122, 4, 153, 123],
+		[29, 74, 46, 14, 75, 47],
+		[49, 54, 24, 10, 55, 25],
+		[24, 45, 15, 46, 46, 16],
+
+		// 38
+		[4, 152, 122, 18, 153, 123],
+		[13, 74, 46, 32, 75, 47],
+		[48, 54, 24, 14, 55, 25],
+		[42, 45, 15, 32, 46, 16],
+
+		// 39
+		[20, 147, 117, 4, 148, 118],
+		[40, 75, 47, 7, 76, 48],
+		[43, 54, 24, 22, 55, 25],
+		[10, 45, 15, 67, 46, 16],
+
+		// 40
+		[19, 148, 118, 6, 149, 119],
+		[18, 75, 47, 31, 76, 48],
+		[34, 54, 24, 34, 55, 25],
+		[20, 45, 15, 61, 46, 16]
+	];
+
+	QRRSBlock.getRSBlocks = function(typeNumber, errorCorrectLevel) {
+
+		var rsBlock = QRRSBlock.getRsBlockTable(typeNumber, errorCorrectLevel);
+
+		if (rsBlock == undefined) {
+			throw new Error("bad rs block @ typeNumber:" + typeNumber + "/errorCorrectLevel:" + errorCorrectLevel);
+		}
+
+		var length = rsBlock.length / 3;
+
+		var list = new Array();
+
+		for (var i = 0; i < length; i++) {
+
+			var count = rsBlock[i * 3 + 0];
+			var totalCount = rsBlock[i * 3 + 1];
+			var dataCount = rsBlock[i * 3 + 2];
+
+			for (var j = 0; j < count; j++) {
+				list.push(new QRRSBlock(totalCount, dataCount));
+			}
+		}
+
+		return list;
+	}
+
+	QRRSBlock.getRsBlockTable = function(typeNumber, errorCorrectLevel) {
+
+		switch (errorCorrectLevel) {
+			case QRErrorCorrectLevel.L:
+				return QRRSBlock.RS_BLOCK_TABLE[(typeNumber - 1) * 4 + 0];
+			case QRErrorCorrectLevel.M:
+				return QRRSBlock.RS_BLOCK_TABLE[(typeNumber - 1) * 4 + 1];
+			case QRErrorCorrectLevel.Q:
+				return QRRSBlock.RS_BLOCK_TABLE[(typeNumber - 1) * 4 + 2];
+			case QRErrorCorrectLevel.H:
+				return QRRSBlock.RS_BLOCK_TABLE[(typeNumber - 1) * 4 + 3];
+			default:
+				return undefined;
+		}
+	}
+
+	//---------------------------------------------------------------------
+	// QRBitBuffer
+	//---------------------------------------------------------------------
+
+	function QRBitBuffer() {
+		this.buffer = new Array();
+		this.length = 0;
+	}
+
+	QRBitBuffer.prototype = {
+
+		get: function(index) {
+			var bufIndex = Math.floor(index / 8);
+			return ((this.buffer[bufIndex] >>> (7 - index % 8)) & 1) == 1;
+		},
+
+		put: function(num, length) {
+			for (var i = 0; i < length; i++) {
+				this.putBit(((num >>> (length - i - 1)) & 1) == 1);
+			}
+		},
+
+		getLengthInBits: function() {
+			return this.length;
+		},
+
+		putBit: function(bit) {
+
+			var bufIndex = Math.floor(this.length / 8);
+			if (this.buffer.length <= bufIndex) {
+				this.buffer.push(0);
+			}
+
+			if (bit) {
+				this.buffer[bufIndex] |= (0x80 >>> (this.length % 8));
+			}
+
+			this.length++;
+		}
+	};
+
+	//---------------------------------------------------------------------
+	// Support Chinese
+	//---------------------------------------------------------------------
+	function utf16To8(text) {
+		var result = '';
+		var c;
+		for (var i = 0; i < text.length; i++) {
+			c = text.charCodeAt(i);
+			if (c >= 0x0001 && c <= 0x007F) {
+				result += text.charAt(i);
+			} else if (c > 0x07FF) {
+				result += String.fromCharCode(0xE0 | c >> 12 & 0x0F);
+				result += String.fromCharCode(0x80 | c >> 6 & 0x3F);
+				result += String.fromCharCode(0x80 | c >> 0 & 0x3F);
+			} else {
+				result += String.fromCharCode(0xC0 | c >> 6 & 0x1F);
+				result += String.fromCharCode(0x80 | c >> 0 & 0x3F);
+			}
+		}
+		return result;
+	}
+
+	uQRCode = {
+		
+		defaults: {
+			size: 258,
+			margin: 0,
+			backgroundColor: '#ffffff',
+			foregroundColor: '#000000',
+			fileType: 'png', // 'jpg', 'png'
+			correctLevel: 3,
+			typeNumber: -1
+		},
+
+		make: function(options) {
+			var defaultOptions = {
+				canvasId: options.canvasId,
+				componentInstance: options.componentInstance,
+				text: options.text,
+				size: this.defaults.size,
+				margin: this.defaults.margin,
+				backgroundColor: this.defaults.backgroundColor,
+				foregroundColor: this.defaults.foregroundColor,
+				fileType: this.defaults.fileType,
+				correctLevel: this.defaults.correctLevel,
+				typeNumber: this.defaults.typeNumber
+			};
+			if (options) {
+				for (var i in options) {
+					defaultOptions[i] = options[i];
+				}
+			}
+			options = defaultOptions;
+			if (!options.canvasId) {
+				console.error('uQRCode: Please set canvasId!');
+				return;
+			}
+
+			function createCanvas() {
+				var qrcode = new QRCode(options.typeNumber, options.correctLevel);
+				qrcode.addData(utf16To8(options.text));
+				qrcode.make();
+
+				var ctx = uni.createCanvasContext(options.canvasId, options.componentInstance);
+				ctx.setFillStyle(options.backgroundColor);
+				ctx.fillRect(0, 0, options.size, options.size);
+
+				var tileW = (options.size - options.margin * 2) / qrcode.getModuleCount();
+				var tileH = tileW;
+
+				for (var row = 0; row < qrcode.getModuleCount(); row++) {
+					for (var col = 0; col < qrcode.getModuleCount(); col++) {
+						var style = qrcode.isDark(row, col) ? options.foregroundColor : options.backgroundColor;
+						ctx.setFillStyle(style);
+						var x = Math.round(col * tileW) + options.margin;
+						var y = Math.round(row * tileH) + options.margin;
+						var w = Math.ceil((col + 1) * tileW) - Math.floor(col * tileW);
+						var h = Math.ceil((row + 1) * tileW) - Math.floor(row * tileW);
+						ctx.fillRect(x, y, w, h);
+					}
+				}
+
+				setTimeout(function() {
+					ctx.draw(false, function() {
+						setTimeout(function() {
+							uni.canvasToTempFilePath({
+								canvasId: options.canvasId,
+								fileType: options.fileType,
+								width: options.size,
+								height: options.size,
+								destWidth: options.size,
+								destHeight: options.size,
+								success: function(res) {
+									options.success && options.success(res.tempFilePath);
+								},
+								fail: function(error) {
+									options.fail && options.fail(error);
+								},
+								complete: function(res) {
+									options.complete && options.complete(res);
+								}
+							}, options.componentInstance);
+						}, options.text.length + 100);
+					});
+				}, 150);
+			}
+			
+			createCanvas();
+		}
+
+	}
+
+})()
+
+export default uQRCode

+ 49 - 0
js_sdk/dc-clipboard/clipboard.js

@@ -0,0 +1,49 @@
+
+/**
+ * 设置粘贴板数据
+ * @param {String} text 要设置的字符串
+ * 如果未设置参数,则清空数据
+ */
+function setClipboardText(text){
+	try{
+	var os = plus.os.name;
+	text = text||'';
+	if('iOS' == os){
+		// var UIPasteboard  = plus.ios.importClass('UIPasteboard');  
+		// var pasteboard = UIPasteboard.generalPasteboard();  
+		// pasteboard.setValueforPasteboardType(text, 'public.utf8-plain-text');
+		var pasteboard = plus.ios.invoke('UIPasteboard', 'generalPasteboard');
+		plus.ios.invoke(pasteboard, 'setValue:forPasteboardType:', text, 'public.utf8-plain-text');
+	}else{
+		var main = plus.android.runtimeMainActivity();
+		// var Context = plus.android.importClass('android.content.Context');
+		// var clip = main.getSystemService(Context.CLIPBOARD_SERVICE);
+		var clip = main.getSystemService('clipboard');
+		plus.android.invoke(clip, 'setText', text);
+	}
+	}catch(e){
+		console.error('error @setClipboardText!!');
+	}
+}
+
+function getClipboardText(){
+	try{
+	var os = plus.os.name;
+	if('iOS' == os){
+		var pasteboard = plus.ios.invoke('UIPasteboard', 'generalPasteboard');
+		return plus.ios.invoke(pasteboard, 'valueForPasteboardType:', 'public.utf8-plain-text')
+	}else{
+		var main = plus.android.runtimeMainActivity();
+		var clip = main.getSystemService('clipboard');
+		return plus.android.invoke(clip, 'getText');
+	}
+	}catch(e){
+		console.error('error @getClipboardText!!');
+	}
+}
+
+
+module.exports = {
+	setText: setClipboardText,
+	getText: getClipboardText
+}

+ 165 - 0
js_sdk/u-charts/u-charts/component.vue

@@ -0,0 +1,165 @@
+<template>
+	<canvas v-if="canvasId" :id="canvasId" :canvasId="canvasId" :style="{'width':cWidth*pixelRatio+'px','height':cHeight*pixelRatio+'px', 'transform': 'scale('+(1/pixelRatio)+')','margin-left':-cWidth*(pixelRatio-1)/2+'px','margin-top':-cHeight*(pixelRatio-1)/2+'px'}"
+	 @touchstart="touchStart" @touchmove="touchMove" @touchend="touchEnd" @error="error">
+	</canvas>
+</template>
+
+<script>
+	import uCharts from './u-charts.js';
+	var canvases = {};
+	
+	export default {
+		props: {
+			chartType: {
+				required: true,
+				type: String,
+				default: 'column'
+			},
+			opts: {
+				required: true,
+				type: Object,
+				default () {
+					return null;
+				},
+			},
+			canvasId: {
+				type: String,
+				default: 'u-canvas',
+			},
+			cWidth: {
+				default: 375,
+			},
+			cHeight: {
+				default: 250,
+			},
+			pixelRatio: {
+				type: Number,
+				default: 1,
+			},
+		},
+		mounted() {
+			this.init();
+		},
+		methods: {
+			init() {
+				switch (this.chartType) {
+					case 'column':
+						this.initColumnChart();
+						break;
+					case 'line':
+						this.initLineChart();
+						break;
+					default:
+						break;
+				}
+			},
+			initColumnChart() {
+				canvases[this.canvasId] = new uCharts({
+					$this: this,
+					canvasId: this.canvasId,
+					type: 'column',
+					legend: true,
+					fontSize: 11,
+					background: '#FFFFFF',
+					pixelRatio: this.pixelRatio,
+					animation: true,
+					categories: this.opts.categories,
+					series: this.opts.series,
+					enableScroll: true,
+					xAxis: {
+						disableGrid: true,
+						itemCount: 4,
+						scrollShow: true
+					},
+					yAxis: {
+						//disabled:true
+					},
+					dataLabel: true,
+					width: this.cWidth * this.pixelRatio,
+					height: this.cHeight * this.pixelRatio,
+					extra: {
+						column: {
+							type: 'group',
+						}
+					}
+				});
+			},
+			initLineChart() {
+				canvases[this.canvasId] = new uCharts({
+					$this: this,
+					canvasId: this.canvasId,
+					type: 'line',
+					fontSize: 11,
+					legend: true,
+					dataLabel: false,
+					dataPointShape: true,
+					background: '#FFFFFF',
+					pixelRatio: this.pixelRatio,
+					categories: this.opts.categories,
+					series: this.opts.series,
+					animation: true,
+					enableScroll: true,
+					xAxis: {
+						type: 'grid',
+						gridColor: '#CCCCCC',
+						gridType: 'dash',
+						dashLength: 8,
+						itemCount: 4,
+						scrollShow: true
+					},
+					yAxis: {
+						gridType: 'dash',
+						gridColor: '#CCCCCC',
+						dashLength: 8,
+						splitNumber: 5,
+						min: 10,
+						max: 180,
+						format: (val) => {
+							return val.toFixed(0) + '元'
+						}
+					},
+					width: this.cWidth * this.pixelRatio,
+					height: this.cHeight * this.pixelRatio,
+					extra: {
+						line: {
+							type: 'straight'
+						}
+					}
+				});
+			},
+			// 这里仅作为示例传入两个参数,cid为canvas-id,newdata为更新的数据,需要更多参数请自行修改
+			changeData(cid,newdata) {
+				canvases[cid].updateData({
+					series: newdata.series,
+					categories: newdata.categories
+				});
+			},
+			touchStart(e) {
+				canvases[this.canvasId].showToolTip(e, {
+					format: function(item, category) {
+						return category + ' ' + item.name + ':' + item.data
+					}
+				});
+				canvases[this.canvasId].scrollStart(e);
+			},
+			touchMove(e) {
+				canvases[this.canvasId].scroll(e);
+			},
+			touchEnd(e) {
+				canvases[this.canvasId].scrollEnd(e);
+			},
+			error(e) {
+				console.log(e)
+			}
+		},
+	};
+</script>
+
+<style scoped>
+	.charts {
+		width: 100%;
+		height: 100%;
+		flex: 1;
+		background-color: #FFFFFF;
+	}
+</style>

+ 5662 - 0
js_sdk/u-charts/u-charts/u-charts.js

@@ -0,0 +1,5662 @@
+/*
+ * uCharts v1.9.4.20200331
+ * uni-app平台高性能跨全端图表,支持H5、APP、小程序(微信/支付宝/百度/头条/QQ/360)
+ * Copyright (c) 2019 QIUN秋云 https://www.ucharts.cn All rights reserved.
+ * Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )
+ * 
+ * uCharts官方网站
+ * https://www.uCharts.cn
+ * 
+ * 开源地址:
+ * https://gitee.com/uCharts/uCharts
+ * 
+ * uni-app插件市场地址:
+ * http://ext.dcloud.net.cn/plugin?id=271
+ * 
+ */
+
+'use strict';
+
+var config = {
+  yAxisWidth: 15,
+  yAxisSplit: 5,
+  xAxisHeight: 15,
+  xAxisLineHeight: 15,
+  legendHeight: 15,
+  yAxisTitleWidth: 15,
+  padding: [10, 10, 10, 10],
+  pixelRatio: 1,
+  rotate: false,
+  columePadding: 3,
+  fontSize: 13,
+  //dataPointShape: ['diamond', 'circle', 'triangle', 'rect'],
+  dataPointShape: ['circle', 'circle', 'circle', 'circle'],
+  colors: ['#1890ff', '#2fc25b', '#facc14', '#f04864', '#8543e0', '#90ed7d'],
+  pieChartLinePadding: 15,
+  pieChartTextPadding: 5,
+  xAxisTextPadding: 3,
+  titleColor: '#333333',
+  titleFontSize: 20,
+  subtitleColor: '#999999',
+  subtitleFontSize: 15,
+  toolTipPadding: 3,
+  toolTipBackground: '#000000',
+  toolTipOpacity: 0.7,
+  toolTipLineHeight: 20,
+  radarLabelTextMargin: 15,
+  gaugeLabelTextMargin: 15
+};
+
+let assign = function (target, ...varArgs) {
+    if (target == null) {
+        throw new TypeError('Cannot convert undefined or null to object');
+    }
+    if (!varArgs || varArgs.length <= 0) {
+        return target;
+    }
+    // 深度合并对象
+    function deepAssign(obj1, obj2) {
+        for (let key in obj2) {
+            obj1[key] = obj1[key] && obj1[key].toString() === "[object Object]" ?
+                deepAssign(obj1[key], obj2[key]) : obj1[key] = obj2[key];
+        }
+        return obj1;
+    }
+
+    varArgs.forEach(val => {
+        target = deepAssign(target, val);
+    });
+    return target;
+};
+
+var util = {
+  toFixed: function toFixed(num, limit) {
+    limit = limit || 2;
+    if (this.isFloat(num)) {
+      num = num.toFixed(limit);
+    }
+    return num;
+  },
+  isFloat: function isFloat(num) {
+    return num % 1 !== 0;
+  },
+  approximatelyEqual: function approximatelyEqual(num1, num2) {
+    return Math.abs(num1 - num2) < 1e-10;
+  },
+  isSameSign: function isSameSign(num1, num2) {
+    return Math.abs(num1) === num1 && Math.abs(num2) === num2 || Math.abs(num1) !== num1 && Math.abs(num2) !== num2;
+  },
+  isSameXCoordinateArea: function isSameXCoordinateArea(p1, p2) {
+    return this.isSameSign(p1.x, p2.x);
+  },
+  isCollision: function isCollision(obj1, obj2) {
+    obj1.end = {};
+    obj1.end.x = obj1.start.x + obj1.width;
+    obj1.end.y = obj1.start.y - obj1.height;
+    obj2.end = {};
+    obj2.end.x = obj2.start.x + obj2.width;
+    obj2.end.y = obj2.start.y - obj2.height;
+    var flag = obj2.start.x > obj1.end.x || obj2.end.x < obj1.start.x || obj2.end.y > obj1.start.y || obj2.start.y < obj1.end.y;
+    return !flag;
+  }
+};
+
+//兼容H5点击事件
+function getH5Offset(e) {
+  e.mp = {
+    changedTouches: []
+  };
+  e.mp.changedTouches.push({
+    x: e.offsetX,
+    y: e.offsetY
+  });
+  return e;
+}
+
+// hex 转 rgba
+function hexToRgb(hexValue, opc) {
+  var rgx = /^#?([a-f\d])([a-f\d])([a-f\d])$/i;
+  var hex = hexValue.replace(rgx, function(m, r, g, b) {
+    return r + r + g + g + b + b;
+  });
+  var rgb = /^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(hex);
+  var r = parseInt(rgb[1], 16);
+  var g = parseInt(rgb[2], 16);
+  var b = parseInt(rgb[3], 16);
+  return 'rgba(' + r + ',' + g + ',' + b + ',' + opc + ')';
+}
+
+function findRange(num, type, limit) {
+  if (isNaN(num)) {
+    throw new Error('[uCharts] unvalid series data!');
+  }
+  limit = limit || 10;
+  type = type ? type : 'upper';
+  var multiple = 1;
+  while (limit < 1) {
+    limit *= 10;
+    multiple *= 10;
+  }
+  if (type === 'upper') {
+    num = Math.ceil(num * multiple);
+  } else {
+    num = Math.floor(num * multiple);
+  }
+  while (num % limit !== 0) {
+    if (type === 'upper') {
+      num++;
+    } else {
+      num--;
+    }
+  }
+  return num / multiple;
+}
+
+function calCandleMA(dayArr, nameArr, colorArr, kdata) {
+  let seriesTemp = [];
+  for (let k = 0; k < dayArr.length; k++) {
+    let seriesItem = {
+      data: [],
+      name: nameArr[k],
+      color: colorArr[k]
+    };
+    for (let i = 0, len = kdata.length; i < len; i++) {
+      if (i < dayArr[k]) {
+        seriesItem.data.push(null);
+        continue;
+      }
+      let sum = 0;
+      for (let j = 0; j < dayArr[k]; j++) {
+        sum += kdata[i - j][1];
+      }
+      seriesItem.data.push(+(sum / dayArr[k]).toFixed(3));
+    }
+    seriesTemp.push(seriesItem);
+  }
+  return seriesTemp;
+}
+
+function calValidDistance(self,distance, chartData, config, opts) {
+  var dataChartAreaWidth = opts.width - opts.area[1] - opts.area[3];
+  var dataChartWidth = chartData.eachSpacing * (opts.chartData.xAxisData.xAxisPoints.length-1);
+  var validDistance = distance;
+  if (distance >= 0) {
+    validDistance = 0;
+		self.event.trigger('scrollLeft');
+  } else if (Math.abs(distance) >= dataChartWidth - dataChartAreaWidth) {
+    validDistance = dataChartAreaWidth - dataChartWidth;
+		self.event.trigger('scrollRight');
+  }
+  return validDistance;
+}
+
+function isInAngleRange(angle, startAngle, endAngle) {
+  function adjust(angle) {
+    while (angle < 0) {
+      angle += 2 * Math.PI;
+    }
+    while (angle > 2 * Math.PI) {
+      angle -= 2 * Math.PI;
+    }
+    return angle;
+  }
+  angle = adjust(angle);
+  startAngle = adjust(startAngle);
+  endAngle = adjust(endAngle);
+  if (startAngle > endAngle) {
+    endAngle += 2 * Math.PI;
+    if (angle < startAngle) {
+      angle += 2 * Math.PI;
+    }
+  }
+  return angle >= startAngle && angle <= endAngle;
+}
+
+function calRotateTranslate(x, y, h) {
+  var xv = x;
+  var yv = h - y;
+  var transX = xv + (h - yv - xv) / Math.sqrt(2);
+  transX *= -1;
+  var transY = (h - yv) * (Math.sqrt(2) - 1) - (h - yv - xv) / Math.sqrt(2);
+  return {
+    transX: transX,
+    transY: transY
+  };
+}
+
+function createCurveControlPoints(points, i) {
+
+  function isNotMiddlePoint(points, i) {
+    if (points[i - 1] && points[i + 1]) {
+      return points[i].y >= Math.max(points[i - 1].y, points[i + 1].y) || points[i].y <= Math.min(points[i - 1].y,points[i + 1].y);
+    } else {
+      return false;
+    }
+  }
+	function isNotMiddlePointX(points, i) {
+	  if (points[i - 1] && points[i + 1]) {
+	    return points[i].x >= Math.max(points[i - 1].x, points[i + 1].x) || points[i].x <= Math.min(points[i - 1].x,points[i + 1].x);
+	  } else {
+	    return false;
+	  }
+	}
+  var a = 0.2;
+  var b = 0.2;
+  var pAx = null;
+  var pAy = null;
+  var pBx = null;
+  var pBy = null;
+  if (i < 1) {
+    pAx = points[0].x + (points[1].x - points[0].x) * a;
+    pAy = points[0].y + (points[1].y - points[0].y) * a;
+  } else {
+    pAx = points[i].x + (points[i + 1].x - points[i - 1].x) * a;
+    pAy = points[i].y + (points[i + 1].y - points[i - 1].y) * a;
+  }
+
+  if (i > points.length - 3) {
+    var last = points.length - 1;
+    pBx = points[last].x - (points[last].x - points[last - 1].x) * b;
+    pBy = points[last].y - (points[last].y - points[last - 1].y) * b;
+  } else {
+    pBx = points[i + 1].x - (points[i + 2].x - points[i].x) * b;
+    pBy = points[i + 1].y - (points[i + 2].y - points[i].y) * b;
+  }
+  if (isNotMiddlePoint(points, i + 1)) {
+    pBy = points[i + 1].y;
+  }
+  if (isNotMiddlePoint(points, i)) {
+    pAy = points[i].y;
+  }
+	if (isNotMiddlePointX(points, i + 1)) {
+	  pBx = points[i + 1].x;
+	}
+	if (isNotMiddlePointX(points, i)) {
+	  pAx = points[i].x;
+	}
+	if (pAy >= Math.max(points[i].y, points[i + 1].y) || pAy <= Math.min(points[i].y, points[i + 1].y)) {
+	pAy = points[i].y;
+	}
+	if (pBy >= Math.max(points[i].y, points[i + 1].y) || pBy <= Math.min(points[i].y, points[i + 1].y)) {
+	pBy = points[i + 1].y;
+	}
+	if (pAx >= Math.max(points[i].x, points[i + 1].x) || pAx <= Math.min(points[i].x, points[i + 1].x)) {
+	pAx = points[i].x;
+	}
+	if (pBx >= Math.max(points[i].x, points[i + 1].x) || pBx <= Math.min(points[i].x, points[i + 1].x)) {
+	pBx = points[i + 1].x;
+	}
+  return {
+    ctrA: {
+      x: pAx,
+      y: pAy
+    },
+    ctrB: {
+      x: pBx,
+      y: pBy
+    }
+  };
+}
+
+function convertCoordinateOrigin(x, y, center) {
+  return {
+    x: center.x + x,
+    y: center.y - y
+  };
+}
+
+function avoidCollision(obj, target) {
+  if (target) {
+    // is collision test
+    while (util.isCollision(obj, target)) {
+      if (obj.start.x > 0) {
+        obj.start.y--;
+      } else if (obj.start.x < 0) {
+        obj.start.y++;
+      } else {
+        if (obj.start.y > 0) {
+          obj.start.y++;
+        } else {
+          obj.start.y--;
+        }
+      }
+    }
+  }
+  return obj;
+}
+
+function fillSeries(series, opts, config) {
+  var index = 0;
+  return series.map(function(item) {
+    if (!item.color) {
+      item.color = config.colors[index];
+      index = (index + 1) % config.colors.length;
+    }
+    if (!item.index) {
+      item.index = 0;
+    }
+    if (!item.type) {
+      item.type = opts.type;
+    }
+    if (typeof item.show == "undefined") {
+      item.show = true;
+    }
+    if (!item.type) {
+      item.type = opts.type;
+    }
+    if (!item.pointShape) {
+      item.pointShape = "circle";
+    }
+    if (!item.legendShape) {
+      switch (item.type) {
+        case 'line':
+          item.legendShape = "line";
+          break;
+        case 'column':
+          item.legendShape = "rect";
+          break;
+        case 'area':
+          item.legendShape = "triangle";
+          break;
+        default:
+          item.legendShape = "circle";
+      }
+    }
+    return item;
+  });
+}
+
+function getDataRange(minData, maxData) {
+  var limit = 0;
+  var range = maxData - minData;
+  if (range >= 10000) {
+    limit = 1000;
+  } else if (range >= 1000) {
+    limit = 100;
+  } else if (range >= 100) {
+    limit = 10;
+  } else if (range >= 10) {
+    limit = 5;
+  } else if (range >= 1) {
+    limit = 1;
+  } else if (range >= 0.1) {
+    limit = 0.1;
+  } else if (range >= 0.01) {
+    limit = 0.01;
+  } else if (range >= 0.001) {
+    limit = 0.001;
+  } else if (range >= 0.0001) {
+    limit = 0.0001;
+  } else if (range >= 0.00001) {
+    limit = 0.00001;
+  } else {
+    limit = 0.000001;
+  }
+  return {
+    minRange: findRange(minData, 'lower', limit),
+    maxRange: findRange(maxData, 'upper', limit)
+  };
+}
+
+function measureText(text) {
+  var fontSize = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : config.fontSize;
+  text = String(text);
+  var text = text.split('');
+  var width = 0;
+  for (let i = 0; i < text.length; i++) {
+    let item = text[i];
+    if (/[a-zA-Z]/.test(item)) {
+      width += 7;
+    } else if (/[0-9]/.test(item)) {
+      width += 5.5;
+    } else if (/\./.test(item)) {
+      width += 2.7;
+    } else if (/-/.test(item)) {
+      width += 3.25;
+    } else if (/[\u4e00-\u9fa5]/.test(item)) {
+      width += 10;
+    } else if (/\(|\)/.test(item)) {
+      width += 3.73;
+    } else if (/\s/.test(item)) {
+      width += 2.5;
+    } else if (/%/.test(item)) {
+      width += 8;
+    } else {
+      width += 10;
+    }
+  }
+  return width * fontSize / 10;
+}
+
+function dataCombine(series) {
+  return series.reduce(function(a, b) {
+    return (a.data ? a.data : a).concat(b.data);
+  }, []);
+}
+
+function dataCombineStack(series, len) {
+  var sum = new Array(len);
+  for (var j = 0; j < sum.length; j++) {
+    sum[j] = 0;
+  }
+  for (var i = 0; i < series.length; i++) {
+    for (var j = 0; j < sum.length; j++) {
+      sum[j] += series[i].data[j];
+    }
+  }
+  return series.reduce(function(a, b) {
+    return (a.data ? a.data : a).concat(b.data).concat(sum);
+  }, []);
+}
+
+function getTouches(touches, opts, e) {
+  let x, y;
+  if (touches.clientX) {
+    if (opts.rotate) {
+      y = opts.height - touches.clientX * opts.pixelRatio;
+      x = (touches.pageY - e.currentTarget.offsetTop - (opts.height / opts.pixelRatio / 2) * (opts.pixelRatio - 1)) *
+        opts.pixelRatio;
+    } else {
+      x = touches.clientX * opts.pixelRatio;
+      y = (touches.pageY - e.currentTarget.offsetTop - (opts.height / opts.pixelRatio / 2) * (opts.pixelRatio - 1)) *
+        opts.pixelRatio;
+    }
+  } else {
+    if (opts.rotate) {
+      y = opts.height - touches.x * opts.pixelRatio;
+      x = touches.y * opts.pixelRatio;
+    } else {
+      x = touches.x * opts.pixelRatio;
+      y = touches.y * opts.pixelRatio;
+    }
+  }
+  return {
+    x: x,
+    y: y
+  }
+}
+
+function getSeriesDataItem(series, index) {
+  var data = [];
+  for (let i = 0; i < series.length; i++) {
+    let item = series[i];
+    if (item.data[index] !== null && typeof item.data[index] !== 'undefined' && item.show) {
+      let seriesItem = {};
+      seriesItem.color = item.color;
+      seriesItem.type = item.type;
+      seriesItem.style = item.style;
+      seriesItem.pointShape = item.pointShape;
+      seriesItem.disableLegend = item.disableLegend;
+      seriesItem.name = item.name;
+      seriesItem.show = item.show;
+      seriesItem.data = item.format ? item.format(item.data[index]) : item.data[index];
+      data.push(seriesItem);
+    }
+  }
+  return data;
+}
+
+function getMaxTextListLength(list) {
+  var lengthList = list.map(function(item) {
+    return measureText(item);
+  });
+  return Math.max.apply(null, lengthList);
+}
+
+function getRadarCoordinateSeries(length) {
+  var eachAngle = 2 * Math.PI / length;
+  var CoordinateSeries = [];
+  for (var i = 0; i < length; i++) {
+    CoordinateSeries.push(eachAngle * i);
+  }
+
+  return CoordinateSeries.map(function(item) {
+    return -1 * item + Math.PI / 2;
+  });
+}
+
+function getToolTipData(seriesData, calPoints, index, categories) {
+  var option = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : {};
+
+  var textList = seriesData.map(function(item) {
+		let titleText=[];
+		if(categories){
+			titleText=categories;
+		}else{
+			titleText=item.data;
+		}
+    return {
+      text: option.format ? option.format(item, titleText[index]) : item.name + ': ' + item.data,
+      color: item.color
+    };
+  });
+  var validCalPoints = [];
+  var offset = {
+    x: 0,
+    y: 0
+  };
+  for (let i = 0; i < calPoints.length; i++) {
+    let points = calPoints[i];
+    if (typeof points[index] !== 'undefined' && points[index] !== null) {
+      validCalPoints.push(points[index]);
+    }
+  }
+  for (let i = 0; i < validCalPoints.length; i++) {
+    let item = validCalPoints[i];
+    offset.x = Math.round(item.x);
+    offset.y += item.y;
+  }
+  offset.y /= validCalPoints.length;
+  return {
+    textList: textList,
+    offset: offset
+  };
+}
+
+function getMixToolTipData(seriesData, calPoints, index, categories) {
+  var option = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : {};
+  var textList = seriesData.map(function(item) {
+    return {
+      text: option.format ? option.format(item, categories[index]) : item.name + ': ' + item.data,
+      color: item.color,
+      disableLegend: item.disableLegend ? true : false
+    };
+  });
+  textList = textList.filter(function(item) {
+    if (item.disableLegend !== true) {
+      return item;
+    }
+  });
+  var validCalPoints = [];
+  var offset = {
+    x: 0,
+    y: 0
+  };
+  for (let i = 0; i < calPoints.length; i++) {
+    let points = calPoints[i];
+    if (typeof points[index] !== 'undefined' && points[index] !== null) {
+      validCalPoints.push(points[index]);
+    }
+  }
+  for (let i = 0; i < validCalPoints.length; i++) {
+    let item = validCalPoints[i];
+    offset.x = Math.round(item.x);
+    offset.y += item.y;
+  }
+  offset.y /= validCalPoints.length;
+  return {
+    textList: textList,
+    offset: offset
+  };
+}
+
+function getCandleToolTipData(series, seriesData, calPoints, index, categories, extra) {
+  var option = arguments.length > 6 && arguments[6] !== undefined ? arguments[6] : {};
+  let upColor = extra.color.upFill;
+  let downColor = extra.color.downFill;
+  //颜色顺序为开盘,收盘,最低,最高
+  let color = [upColor, upColor, downColor, upColor];
+  var textList = [];
+  let text0 = {
+    text: categories[index],
+    color: null
+  };
+  textList.push(text0);
+  seriesData.map(function(item) {
+    if (index == 0) {
+      if(item.data[1] - item.data[0] < 0){
+      	color[1] = downColor;
+      }else{
+      	color[1] = upColor;
+      }
+    } else {
+      if (item.data[0] < series[index - 1][1]) {
+        color[0] = downColor;
+      }
+      if (item.data[1] < item.data[0]) {
+        color[1] = downColor;
+      }
+      if (item.data[2] > series[index - 1][1]) {
+        color[2] = upColor;
+      }
+      if (item.data[3] < series[index - 1][1]) {
+        color[3] = downColor;
+      }
+    }
+    let text1 = {
+      text: '开盘:' + item.data[0],
+      color: color[0]
+    };
+    let text2 = {
+      text: '收盘:' + item.data[1],
+      color: color[1]
+    };
+    let text3 = {
+      text: '最低:' + item.data[2],
+      color: color[2]
+    };
+    let text4 = {
+      text: '最高:' + item.data[3],
+      color: color[3]
+    };
+    textList.push(text1, text2, text3, text4);
+  });
+  var validCalPoints = [];
+  var offset = {
+    x: 0,
+    y: 0
+  };
+  for (let i = 0; i < calPoints.length; i++) {
+    let points = calPoints[i];
+    if (typeof points[index] !== 'undefined' && points[index] !== null) {
+      validCalPoints.push(points[index]);
+    }
+  }
+  offset.x = Math.round(validCalPoints[0][0].x);
+  return {
+    textList: textList,
+    offset: offset
+  };
+}
+
+function filterSeries(series) {
+  let tempSeries = [];
+  for (let i = 0; i < series.length; i++) {
+    if (series[i].show == true) {
+      tempSeries.push(series[i])
+    }
+  }
+  return tempSeries;
+}
+
+function findCurrentIndex(currentPoints, calPoints, opts, config) {
+  var offset = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : 0;
+  var currentIndex = -1;
+  var spacing = opts.chartData.eachSpacing/2;
+	let xAxisPoints=[];
+	if(calPoints.length>0){
+		if(opts.type=='candle'){
+			for(let i=0;i<calPoints[0].length;i++){
+				xAxisPoints.push(calPoints[0][i][0].x)
+			}
+		}else{
+			for(let i=0;i<calPoints[0].length;i++){
+				xAxisPoints.push(calPoints[0][i].x)
+			}
+		}
+		if((opts.type=='line' || opts.type=='area') && opts.xAxis.boundaryGap=='justify'){
+		  spacing = opts.chartData.eachSpacing/2;
+		}
+		if(!opts.categories){
+			spacing=0
+		}
+		if (isInExactChartArea(currentPoints, opts, config)) {
+		  xAxisPoints.forEach(function(item, index) {
+		    if (currentPoints.x + offset + spacing > item) {
+		      currentIndex = index;
+		    }
+		  });
+		}
+	}
+  return currentIndex;
+}
+
+function findLegendIndex(currentPoints, legendData, opts) {
+  let currentIndex = -1;
+  if (isInExactLegendArea(currentPoints, legendData.area)) {
+    let points = legendData.points;
+    let index = -1;
+    for (let i = 0, len = points.length; i < len; i++) {
+      let item = points[i];
+      for (let j = 0; j < item.length; j++) {
+        index += 1;
+        let area = item[j]['area'];
+        if (currentPoints.x > area[0] && currentPoints.x < area[2] && currentPoints.y > area[1] && currentPoints.y < area[3]) {
+          currentIndex = index;
+          break;
+        }
+      }
+    }
+    return currentIndex;
+  }
+  return currentIndex;
+}
+
+function isInExactLegendArea(currentPoints, area) {
+  return currentPoints.x > area.start.x && currentPoints.x < area.end.x && currentPoints.y > area.start.y &&
+    currentPoints.y < area.end.y;
+}
+
+function isInExactChartArea(currentPoints, opts, config) {
+  return currentPoints.x <= opts.width - opts.area[1] + 10 && currentPoints.x >= opts.area[3] -10 && currentPoints.y >= opts.area[0] && currentPoints.y <= opts.height - opts.area[2];
+}
+
+function findRadarChartCurrentIndex(currentPoints, radarData, count) {
+  var eachAngleArea = 2 * Math.PI / count;
+  var currentIndex = -1;
+  if (isInExactPieChartArea(currentPoints, radarData.center, radarData.radius)) {
+    var fixAngle = function fixAngle(angle) {
+      if (angle < 0) {
+        angle += 2 * Math.PI;
+      }
+      if (angle > 2 * Math.PI) {
+        angle -= 2 * Math.PI;
+      }
+      return angle;
+    };
+
+    var angle = Math.atan2(radarData.center.y - currentPoints.y, currentPoints.x - radarData.center.x);
+    angle = -1 * angle;
+    if (angle < 0) {
+      angle += 2 * Math.PI;
+    }
+
+    var angleList = radarData.angleList.map(function(item) {
+      item = fixAngle(-1 * item);
+
+      return item;
+    });
+
+    angleList.forEach(function(item, index) {
+      var rangeStart = fixAngle(item - eachAngleArea / 2);
+      var rangeEnd = fixAngle(item + eachAngleArea / 2);
+      if (rangeEnd < rangeStart) {
+        rangeEnd += 2 * Math.PI;
+      }
+      if (angle >= rangeStart && angle <= rangeEnd || angle + 2 * Math.PI >= rangeStart && angle + 2 * Math.PI <=
+        rangeEnd) {
+        currentIndex = index;
+      }
+    });
+  }
+
+  return currentIndex;
+}
+
+function findFunnelChartCurrentIndex(currentPoints, funnelData) {
+  var currentIndex = -1;
+  for (var i = 0, len = funnelData.series.length; i < len; i++) {
+    var item = funnelData.series[i];
+    if (currentPoints.x > item.funnelArea[0] && currentPoints.x < item.funnelArea[2] && currentPoints.y > item.funnelArea[1] && currentPoints.y < item.funnelArea[3]) {
+      currentIndex = i;
+      break;
+    }
+  }
+  return currentIndex;
+}
+
+function findWordChartCurrentIndex(currentPoints, wordData) {
+  var currentIndex = -1;
+  for (var i = 0, len = wordData.length; i < len; i++) {
+    var item = wordData[i];
+    if (currentPoints.x > item.area[0] && currentPoints.x < item.area[2] && currentPoints.y > item.area[1] && currentPoints.y < item.area[3]) {
+      currentIndex = i;
+      break;
+    }
+  }
+  return currentIndex;
+}
+
+function findMapChartCurrentIndex(currentPoints, opts) {
+  var currentIndex = -1;
+  var cData=opts.chartData.mapData;
+  var data=opts.series;
+  var tmp=pointToCoordinate(currentPoints.y, currentPoints.x,cData.bounds,cData.scale,cData.xoffset,cData.yoffset);
+  var poi=[tmp.x, tmp.y];
+  for (var i = 0, len = data.length; i < len; i++) {
+    var item = data[i].geometry.coordinates;
+    if(isPoiWithinPoly(poi,item)){
+      currentIndex = i;
+      break;
+    }
+  }
+  return currentIndex;
+}
+
+function findPieChartCurrentIndex(currentPoints, pieData) {
+  var currentIndex = -1;
+  if (isInExactPieChartArea(currentPoints, pieData.center, pieData.radius)) {
+    var angle = Math.atan2(pieData.center.y - currentPoints.y, currentPoints.x - pieData.center.x);
+    angle = -angle;
+    for (var i = 0, len = pieData.series.length; i < len; i++) {
+      var item = pieData.series[i];
+      if (isInAngleRange(angle, item._start_, item._start_ + item._proportion_ * 2 * Math.PI)) {
+        currentIndex = i;
+        break;
+      }
+    }
+  }
+
+  return currentIndex;
+}
+
+function isInExactPieChartArea(currentPoints, center, radius) {
+  return Math.pow(currentPoints.x - center.x, 2) + Math.pow(currentPoints.y - center.y, 2) <= Math.pow(radius, 2);
+}
+
+function splitPoints(points) {
+  var newPoints = [];
+  var items = [];
+  points.forEach(function(item, index) {
+    if (item !== null) {
+      items.push(item);
+    } else {
+      if (items.length) {
+        newPoints.push(items);
+      }
+      items = [];
+    }
+  });
+  if (items.length) {
+    newPoints.push(items);
+  }
+
+  return newPoints;
+}
+
+function calLegendData(series, opts, config, chartData) {
+  let legendData = {
+    area: {
+      start: {
+        x: 0,
+        y: 0
+      },
+      end: {
+        x: 0,
+        y: 0
+      },
+      width: 0,
+      height: 0,
+      wholeWidth: 0,
+      wholeHeight: 0
+    },
+    points: [],
+    widthArr: [],
+    heightArr: []
+  };
+  if (opts.legend.show === false) {
+    chartData.legendData = legendData;
+    return legendData;
+  }
+
+  let padding = opts.legend.padding;
+  let margin = opts.legend.margin;
+  let fontSize = opts.legend.fontSize;
+  let shapeWidth = 15 * opts.pixelRatio;
+  let shapeRight = 5 * opts.pixelRatio;
+  let lineHeight = Math.max(opts.legend.lineHeight * opts.pixelRatio, fontSize);
+  if (opts.legend.position == 'top' || opts.legend.position == 'bottom') {
+    let legendList = [];
+    let widthCount = 0;
+    let widthCountArr = [];
+    let currentRow = [];
+    for (let i = 0; i < series.length; i++) {
+      let item = series[i];
+      let itemWidth = shapeWidth + shapeRight + measureText(item.name || 'undefined', fontSize) + opts.legend.itemGap;
+      if (widthCount + itemWidth > opts.width - opts.padding[1] - opts.padding[3]) {
+        legendList.push(currentRow);
+        widthCountArr.push(widthCount - opts.legend.itemGap);
+        widthCount = itemWidth;
+        currentRow = [item];
+      } else {
+        widthCount += itemWidth;
+        currentRow.push(item);
+      }
+    }
+    if (currentRow.length) {
+      legendList.push(currentRow);
+      widthCountArr.push(widthCount - opts.legend.itemGap);
+      legendData.widthArr = widthCountArr;
+      let legendWidth = Math.max.apply(null, widthCountArr);
+      switch (opts.legend.float) {
+        case 'left':
+          legendData.area.start.x = opts.padding[3];
+          legendData.area.end.x = opts.padding[3] + 2 * padding;
+          break;
+        case 'right':
+          legendData.area.start.x = opts.width - opts.padding[1] - legendWidth - 2 * padding;
+          legendData.area.end.x = opts.width - opts.padding[1];
+          break;
+        default:
+          legendData.area.start.x = (opts.width - legendWidth) / 2 - padding;
+          legendData.area.end.x = (opts.width + legendWidth) / 2 + padding;
+      }
+      legendData.area.width = legendWidth + 2 * padding;
+      legendData.area.wholeWidth = legendWidth + 2 * padding;
+      legendData.area.height = legendList.length * lineHeight + 2 * padding;
+      legendData.area.wholeHeight = legendList.length * lineHeight + 2 * padding + 2 * margin;
+      legendData.points = legendList;
+    }
+  } else {
+    let len = series.length;
+    let maxHeight = opts.height - opts.padding[0] - opts.padding[2] - 2 * margin - 2 * padding;
+    let maxLength = Math.min(Math.floor(maxHeight / lineHeight), len);
+    legendData.area.height = maxLength * lineHeight + padding * 2;
+    legendData.area.wholeHeight = maxLength * lineHeight + padding * 2;
+    switch (opts.legend.float) {
+      case 'top':
+        legendData.area.start.y = opts.padding[0] + margin;
+        legendData.area.end.y = opts.padding[0] + margin + legendData.area.height;
+        break;
+      case 'bottom':
+        legendData.area.start.y = opts.height - opts.padding[2] - margin - legendData.area.height;
+        legendData.area.end.y = opts.height - opts.padding[2] - margin;
+        break;
+      default:
+        legendData.area.start.y = (opts.height - legendData.area.height) / 2;
+        legendData.area.end.y = (opts.height + legendData.area.height) / 2;
+    }
+    let lineNum = len % maxLength === 0 ? len / maxLength : Math.floor((len / maxLength) + 1);
+    let currentRow = [];
+    for (let i = 0; i < lineNum; i++) {
+      let temp = series.slice(i * maxLength, i * maxLength + maxLength);
+      currentRow.push(temp);
+    }
+
+    legendData.points = currentRow;
+
+    if (currentRow.length) {
+      for (let i = 0; i < currentRow.length; i++) {
+        let item = currentRow[i];
+        let maxWidth = 0;
+        for (let j = 0; j < item.length; j++) {
+          let itemWidth = shapeWidth + shapeRight + measureText(item[j].name || 'undefined', fontSize) + opts.legend.itemGap;
+          if (itemWidth > maxWidth) {
+            maxWidth = itemWidth;
+          }
+        }
+        legendData.widthArr.push(maxWidth);
+        legendData.heightArr.push(item.length * lineHeight + padding * 2);
+      }
+      let legendWidth = 0
+      for (let i = 0; i < legendData.widthArr.length; i++) {
+        legendWidth += legendData.widthArr[i];
+      }
+      legendData.area.width = legendWidth - opts.legend.itemGap + 2 * padding;
+      legendData.area.wholeWidth = legendData.area.width + padding;
+    }
+  }
+
+  switch (opts.legend.position) {
+    case 'top':
+      legendData.area.start.y = opts.padding[0] + margin;
+      legendData.area.end.y = opts.padding[0] + margin + legendData.area.height;
+      break;
+    case 'bottom':
+      legendData.area.start.y = opts.height - opts.padding[2] - legendData.area.height - margin;
+      legendData.area.end.y = opts.height - opts.padding[2] - margin;
+      break;
+    case 'left':
+      legendData.area.start.x = opts.padding[3];
+      legendData.area.end.x = opts.padding[3] + legendData.area.width;
+      break;
+    case 'right':
+      legendData.area.start.x = opts.width - opts.padding[1] - legendData.area.width;
+      legendData.area.end.x = opts.width - opts.padding[1];
+      break;
+  }
+  chartData.legendData = legendData;
+  return legendData;
+}
+
+function calCategoriesData(categories, opts, config, eachSpacing) {
+  var result = {
+    angle: 0,
+    xAxisHeight: config.xAxisHeight
+  };
+  var categoriesTextLenth = categories.map(function(item) {
+    return measureText(item,opts.xAxis.fontSize||config.fontSize);
+  });
+  var maxTextLength = Math.max.apply(this, categoriesTextLenth);
+
+  if (opts.xAxis.rotateLabel == true && maxTextLength + 2 * config.xAxisTextPadding > eachSpacing) {
+    result.angle = 45 * Math.PI / 180;
+    result.xAxisHeight = 2 * config.xAxisTextPadding + maxTextLength * Math.sin(result.angle);
+  }
+  return result;
+}
+
+function getXAxisTextList(series, opts, config) {
+  var index = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : -1;
+  var data = dataCombine(series);
+  var sorted = [];
+  // remove null from data
+  data = data.filter(function(item) {
+    //return item !== null;
+    if (typeof item === 'object' && item !== null) {
+      if (item.constructor.toString().indexOf('Array')>-1) {
+        return item !== null;
+      } else {
+        return item.value !== null;
+      }
+    } else {
+      return item !== null;
+    }
+  });
+  data.map(function(item) {
+    if (typeof item === 'object') {
+      if (item.constructor.toString().indexOf('Array')>-1) {
+				if(opts.type=='candle'){
+					item.map(function(subitem) {
+					  sorted.push(subitem);
+					})
+				}else{
+					sorted.push(item[0]);
+				}
+      } else {
+        sorted.push(item.value);
+      }
+    } else {
+      sorted.push(item);
+    }
+  })
+	
+  var minData = 0;
+  var maxData = 0;
+  if (sorted.length > 0) {
+    minData = Math.min.apply(this, sorted);
+    maxData = Math.max.apply(this, sorted);
+  }
+  //为了兼容v1.9.0之前的项目
+  if(index>-1){
+    if (typeof opts.xAxis.data[index].min === 'number') {
+      minData = Math.min(opts.xAxis.data[index].min, minData);
+    }
+    if (typeof opts.xAxis.data[index].max === 'number') {
+      maxData = Math.max(opts.xAxis.data[index].max, maxData);
+    }
+  }else{
+    if (typeof opts.xAxis.min === 'number') {
+      minData = Math.min(opts.xAxis.min, minData);
+    }
+    if (typeof opts.xAxis.max === 'number') {
+      maxData = Math.max(opts.xAxis.max, maxData);
+    }
+  }
+  
+
+  if (minData === maxData) {
+    var rangeSpan = maxData || 10;
+    maxData += rangeSpan;
+  }
+
+  //var dataRange = getDataRange(minData, maxData);
+  var minRange = minData;
+  var maxRange = maxData;
+
+  var range = [];
+  var eachRange = (maxRange - minRange) / opts.xAxis.splitNumber;
+
+  for (var i = 0; i <= opts.xAxis.splitNumber; i++) {
+    range.push(minRange + eachRange * i);
+  }
+  return range;
+}
+
+function calXAxisData(series, opts, config){
+    var result = {
+        angle: 0,
+        xAxisHeight: config.xAxisHeight
+    };
+
+    result.ranges = getXAxisTextList(series, opts, config);
+    result.rangesFormat = result.ranges.map(function(item){
+        item = opts.xAxis.format? opts.xAxis.format(item):util.toFixed(item, 2);
+        return item;
+    });
+		
+    var xAxisScaleValues = result.ranges.map(function (item) {
+        // 如果刻度值是浮点数,则保留两位小数
+        item = util.toFixed(item, 2);
+        // 若有自定义格式则调用自定义的格式化函数
+        item = opts.xAxis.format ? opts.xAxis.format(Number(item)) : item;
+        return item;
+    });
+
+    result = Object.assign(result,getXAxisPoints(xAxisScaleValues, opts, config));
+    // 计算X轴刻度的属性譬如每个刻度的间隔,刻度的起始点\结束点以及总长
+    var eachSpacing = result.eachSpacing;
+
+    var textLength = xAxisScaleValues.map(function (item) {
+        return measureText(item);
+    });
+    
+    // get max length of categories text
+    var maxTextLength = Math.max.apply(this, textLength);
+
+    // 如果刻度值文本内容过长,则将其逆时针旋转45°
+    if (maxTextLength + 2 * config.xAxisTextPadding > eachSpacing) {
+        result.angle = 45 * Math.PI / 180;
+        result.xAxisHeight = 2 * config.xAxisTextPadding + maxTextLength * Math.sin(result.angle);
+    }
+
+    if (opts.xAxis.disabled === true) {
+        result.xAxisHeight = 0;
+    }
+
+    return result;
+}
+
+function getRadarDataPoints(angleList, center, radius, series, opts) {
+  var process = arguments.length > 5 && arguments[5] !== undefined ? arguments[5] : 1;
+
+  var radarOption = opts.extra.radar || {};
+  radarOption.max = radarOption.max || 0;
+  var maxData = Math.max(radarOption.max, Math.max.apply(null, dataCombine(series)));
+
+  var data = [];
+  for (let i = 0; i < series.length; i++) {
+    let each = series[i];
+    let listItem = {};
+    listItem.color = each.color;
+		listItem.legendShape = each.legendShape;
+		listItem.pointShape = each.pointShape;
+    listItem.data = [];
+    each.data.forEach(function(item, index) {
+      let tmp = {};
+      tmp.angle = angleList[index];
+
+      tmp.proportion = item / maxData;
+      tmp.position = convertCoordinateOrigin(radius * tmp.proportion * process * Math.cos(tmp.angle), radius * tmp.proportion *
+        process * Math.sin(tmp.angle), center);
+      listItem.data.push(tmp);
+    });
+
+    data.push(listItem);
+  }
+
+  return data;
+}
+
+function getPieDataPoints(series, radius) {
+  var process = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 1;
+
+  var count = 0;
+  var _start_ = 0;
+  for (let i = 0; i < series.length; i++) {
+    let item = series[i];
+    item.data = item.data === null ? 0 : item.data;
+    count += item.data;
+  }
+  for (let i = 0; i < series.length; i++) {
+    let item = series[i];
+    item.data = item.data === null ? 0 : item.data;
+    if (count === 0) {
+      item._proportion_ = 1 / series.length * process;
+    } else {
+      item._proportion_ = item.data / count * process;
+    }
+    item._radius_ = radius;
+  }
+  for (let i = 0; i < series.length; i++) {
+    let item = series[i];
+    item._start_ = _start_;
+    _start_ += 2 * item._proportion_ * Math.PI;
+  }
+
+  return series;
+}
+
+function getFunnelDataPoints(series, radius) {
+  var process = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 1;
+  series = series.sort(function(a,b){return parseInt(b.data)-parseInt(a.data);});
+  for (let i = 0; i < series.length; i++) {
+    series[i].radius = series[i].data/series[0].data*radius*process;
+    series[i]._proportion_ = series[i].data/series[0].data;
+  }
+  return series.reverse();
+}
+
+function getRoseDataPoints(series, type, minRadius, radius) {
+  var process = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : 1;
+  var count = 0;
+  var _start_ = 0;
+
+  var dataArr = [];
+  for (let i = 0; i < series.length; i++) {
+    let item = series[i];
+    item.data = item.data === null ? 0 : item.data;
+    count += item.data;
+    dataArr.push(item.data);
+  }
+  
+  var minData = Math.min.apply(null, dataArr);
+  var maxData = Math.max.apply(null, dataArr);
+  var radiusLength = radius - minRadius;
+  
+  for (let i = 0; i < series.length; i++) {
+    let item = series[i];
+    item.data = item.data === null ? 0 : item.data;
+    if (count === 0 || type == 'area') {
+      item._proportion_ = item.data / count * process;
+      item._rose_proportion_ = 1 / series.length * process;
+    } else {
+      item._proportion_ = item.data / count * process;
+      item._rose_proportion_ = item.data / count * process;
+    }
+    item._radius_ = minRadius + radiusLength * ((item.data - minData) / (maxData - minData));
+  }
+  for (let i = 0; i < series.length; i++) {
+    let item = series[i];
+    item._start_ = _start_;
+    _start_ += 2 * item._rose_proportion_ * Math.PI;
+  }
+
+  return series;
+}
+
+function getArcbarDataPoints(series, arcbarOption) {
+  var process = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 1;
+  if (process == 1) {
+    process = 0.999999;
+  }
+  for (let i = 0; i < series.length; i++) {
+    let item = series[i];
+    item.data = item.data === null ? 0 : item.data;
+    let totalAngle;
+    if (arcbarOption.type == 'circle') {
+      totalAngle = 2;
+    } else {
+			if (arcbarOption.endAngle < arcbarOption.startAngle) {
+			  totalAngle = 2 + arcbarOption.endAngle - arcbarOption.startAngle;
+			} else{
+			  totalAngle = arcbarOption.startAngle - arcbarOption.endAngle;
+			}
+    }
+    item._proportion_ = totalAngle * item.data * process + arcbarOption.startAngle;
+    if (item._proportion_ >= 2) {
+      item._proportion_ = item._proportion_ % 2;
+    }
+  }
+  return series;
+}
+
+function getGaugeAxisPoints(categories, startAngle, endAngle) {
+  let totalAngle = startAngle - endAngle + 1;
+  let tempStartAngle = startAngle;
+  for (let i = 0; i < categories.length; i++) {
+    categories[i].value = categories[i].value === null ? 0 : categories[i].value;
+    categories[i]._startAngle_ = tempStartAngle;
+    categories[i]._endAngle_ = totalAngle * categories[i].value + startAngle;
+    if (categories[i]._endAngle_ >= 2) {
+      categories[i]._endAngle_ = categories[i]._endAngle_ % 2;
+    }
+    tempStartAngle = categories[i]._endAngle_;
+  }
+  return categories;
+}
+
+function getGaugeDataPoints(series, categories, gaugeOption) {
+  let process = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : 1;
+  for (let i = 0; i < series.length; i++) {
+    let item = series[i];
+    item.data = item.data === null ? 0 : item.data;
+    if (gaugeOption.pointer.color == 'auto') {
+      for (let i = 0; i < categories.length; i++) {
+        if (item.data <= categories[i].value) {
+          item.color = categories[i].color;
+          break;
+        }
+      }
+    } else {
+      item.color = gaugeOption.pointer.color;
+    }
+    let totalAngle = gaugeOption.startAngle - gaugeOption.endAngle + 1;
+    item._endAngle_ = totalAngle * item.data + gaugeOption.startAngle;
+    item._oldAngle_ = gaugeOption.oldAngle;
+    if (gaugeOption.oldAngle < gaugeOption.endAngle) {
+      item._oldAngle_ += 2;
+    }
+    if (item.data >= gaugeOption.oldData) {
+      item._proportion_ = (item._endAngle_ - item._oldAngle_) * process + gaugeOption.oldAngle;
+    } else {
+      item._proportion_ = item._oldAngle_ - (item._oldAngle_ - item._endAngle_) * process;
+    }
+    if (item._proportion_ >= 2) {
+      item._proportion_ = item._proportion_ % 2;
+    }
+  }
+  return series;
+}
+
+function getPieTextMaxLength(series) {
+  series = getPieDataPoints(series);
+  let maxLength = 0;
+  for (let i = 0; i < series.length; i++) {
+    let item = series[i];
+    let text = item.format ? item.format(+item._proportion_.toFixed(2)) : util.toFixed(item._proportion_ * 100) + '%';
+    maxLength = Math.max(maxLength, measureText(text));
+  }
+
+  return maxLength;
+}
+
+function fixColumeData(points, eachSpacing, columnLen, index, config, opts) {
+  return points.map(function(item) {
+    if (item === null) {
+      return null;
+    }
+    item.width = Math.ceil((eachSpacing - 2 * config.columePadding) / columnLen);
+
+    if (opts.extra.column && opts.extra.column.width && +opts.extra.column.width > 0) {
+      item.width = Math.min(item.width, +opts.extra.column.width);
+    }
+    if (item.width <= 0) {
+      item.width = 1;
+    }
+    item.x += (index + 0.5 - columnLen / 2) * item.width;
+    return item;
+  });
+}
+
+function fixColumeMeterData(points, eachSpacing, columnLen, index, config, opts, border) {
+  return points.map(function(item) {
+    if (item === null) {
+      return null;
+    }
+    item.width = Math.ceil((eachSpacing - 2 * config.columePadding) / 2);
+
+    if (opts.extra.column && opts.extra.column.width && +opts.extra.column.width > 0) {
+      item.width = Math.min(item.width, +opts.extra.column.width);
+    }
+
+    if (index > 0) {
+      item.width -= 2 * border;
+    }
+    return item;
+  });
+}
+
+function fixColumeStackData(points, eachSpacing, columnLen, index, config, opts, series) {
+
+  return points.map(function(item, indexn) {
+
+    if (item === null) {
+      return null;
+    }
+    item.width = Math.ceil((eachSpacing - 2 * config.columePadding) / 2);
+
+    if (opts.extra.column && opts.extra.column.width && +opts.extra.column.width > 0) {
+      item.width = Math.min(item.width, +opts.extra.column.width);
+    }
+    return item;
+  });
+}
+
+function getXAxisPoints(categories, opts, config) {
+  var spacingValid = opts.width - opts.area[1] - opts.area[3];
+  var dataCount = opts.enableScroll ? Math.min(opts.xAxis.itemCount, categories.length) : categories.length;
+  if((opts.type=='line' || opts.type=='area') && dataCount>1 && opts.xAxis.boundaryGap=='justify'){
+    dataCount -=1;
+  }
+  var eachSpacing = spacingValid / dataCount;
+
+  var xAxisPoints = [];
+  var startX = opts.area[3];
+  var endX = opts.width - opts.area[1];
+  categories.forEach(function(item, index) {
+    xAxisPoints.push(startX + index * eachSpacing);
+  });
+  if(opts.xAxis.boundaryGap !=='justify'){
+    if (opts.enableScroll === true) {
+      xAxisPoints.push(startX + categories.length * eachSpacing);
+    } else {
+      xAxisPoints.push(endX);
+    }
+  }
+  return {
+    xAxisPoints: xAxisPoints,
+    startX: startX,
+    endX: endX,
+    eachSpacing: eachSpacing
+  };
+}
+
+function getCandleDataPoints(data, minRange, maxRange, xAxisPoints, eachSpacing, opts, config) {
+  var process = arguments.length > 7 && arguments[7] !== undefined ? arguments[7] : 1;
+  var points = [];
+  var validHeight = opts.height - opts.area[0] - opts.area[2];
+  data.forEach(function(item, index) {
+    if (item === null) {
+      points.push(null);
+    } else {
+      var cPoints = [];
+      item.forEach(function(items, indexs) {
+        var point = {};
+        point.x = xAxisPoints[index] + Math.round(eachSpacing / 2);
+        var value = items.value || items;
+        var height = validHeight * (value - minRange) / (maxRange - minRange);
+        height *= process;
+        point.y = opts.height - Math.round(height) - opts.area[2];
+        cPoints.push(point);
+      });
+      points.push(cPoints);
+    }
+  });
+
+  return points;
+}
+
+function getDataPoints(data, minRange, maxRange, xAxisPoints, eachSpacing, opts, config) {
+  var process = arguments.length > 7 && arguments[7] !== undefined ? arguments[7] : 1;
+  var boundaryGap='center';
+  if (opts.type == 'line'||opts.type == 'area'){
+    boundaryGap=opts.xAxis.boundaryGap;
+  }
+  var points = [];
+  var validHeight = opts.height - opts.area[0] - opts.area[2];
+	var validWidth = opts.width - opts.area[1] - opts.area[3];
+  data.forEach(function(item, index) {
+    if (item === null) {
+      points.push(null);
+    } else {
+      var point = {};
+      point.color = item.color;
+      point.x = xAxisPoints[index];
+      var value = item;
+      if (typeof item === 'object' && item !== null) {
+				if (item.constructor.toString().indexOf('Array')>-1) {
+					let xranges,xminRange,xmaxRange;
+					xranges = [].concat(opts.chartData.xAxisData.ranges);
+					xminRange = xranges.shift();
+					xmaxRange = xranges.pop();
+				  value = item[1];
+					point.x = opts.area[3]+ validWidth * (item[0] - xminRange) / (xmaxRange - xminRange);
+				} else {
+				  value = item.value;
+				}
+      }
+			if(boundaryGap=='center'){
+			  point.x += Math.round(eachSpacing / 2);
+			}
+      var height = validHeight * (value - minRange) / (maxRange - minRange);
+      height *= process;
+      point.y = opts.height - Math.round(height) - opts.area[2];
+      points.push(point);
+    }
+  });
+
+  return points;
+}
+
+function getStackDataPoints(data, minRange, maxRange, xAxisPoints, eachSpacing, opts, config, seriesIndex, stackSeries) {
+  var process = arguments.length > 9 && arguments[9] !== undefined ? arguments[9] : 1;
+  var points = [];
+  var validHeight = opts.height - opts.area[0] - opts.area[2];
+
+  data.forEach(function(item, index) {
+    if (item === null) {
+      points.push(null);
+    } else {
+      var point = {};
+      point.color = item.color;
+      point.x = xAxisPoints[index] + Math.round(eachSpacing / 2);
+
+      if (seriesIndex > 0) {
+        var value = 0;
+        for (let i = 0; i <= seriesIndex; i++) {
+          value += stackSeries[i].data[index];
+        }
+        var value0 = value - item;
+        var height = validHeight * (value - minRange) / (maxRange - minRange);
+        var height0 = validHeight * (value0 - minRange) / (maxRange - minRange);
+      } else {
+        var value = item;
+        var height = validHeight * (value - minRange) / (maxRange - minRange);
+        var height0 = 0;
+      }
+      var heightc = height0;
+      height *= process;
+      heightc *= process;
+      point.y = opts.height - Math.round(height) - opts.area[2];
+      point.y0 = opts.height - Math.round(heightc) - opts.area[2];
+      points.push(point);
+    }
+  });
+
+  return points;
+}
+
+function getYAxisTextList(series, opts, config, stack) {
+  var index = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : -1;
+  var data;
+  if (stack == 'stack') {
+    data = dataCombineStack(series, opts.categories.length);
+  } else {
+    data = dataCombine(series);
+  }
+  var sorted = [];
+  // remove null from data
+  data = data.filter(function(item) {
+    //return item !== null;
+    if (typeof item === 'object' && item !== null) {
+      if (item.constructor.toString().indexOf('Array')>-1) {
+        return item !== null;
+      } else {
+        return item.value !== null;
+      }
+    } else {
+      return item !== null;
+    }
+  });
+  data.map(function(item) {
+    if (typeof item === 'object') {
+      if (item.constructor.toString().indexOf('Array')>-1) {
+				if(opts.type=='candle'){
+					item.map(function(subitem) {
+					  sorted.push(subitem);
+					})
+				}else{
+					sorted.push(item[1]);
+				}
+      } else {
+        sorted.push(item.value);
+      }
+    } else {
+      sorted.push(item);
+    }
+  })
+	
+  var minData = 0;
+  var maxData = 0;
+  if (sorted.length > 0) {
+    minData = Math.min.apply(this, sorted);
+    maxData = Math.max.apply(this, sorted);
+  }
+  //为了兼容v1.9.0之前的项目
+  if(index>-1){
+    if (typeof opts.yAxis.data[index].min === 'number') {
+      minData = Math.min(opts.yAxis.data[index].min, minData);
+    }
+    if (typeof opts.yAxis.data[index].max === 'number') {
+      maxData = Math.max(opts.yAxis.data[index].max, maxData);
+    }
+  }else{
+    if (typeof opts.yAxis.min === 'number') {
+      minData = Math.min(opts.yAxis.min, minData);
+    }
+    if (typeof opts.yAxis.max === 'number') {
+      maxData = Math.max(opts.yAxis.max, maxData);
+    }
+  }
+  
+
+  if (minData === maxData) {
+    var rangeSpan = maxData || 10;
+    maxData += rangeSpan;
+  }
+
+  var dataRange = getDataRange(minData, maxData);
+  var minRange = dataRange.minRange;
+  var maxRange = dataRange.maxRange;
+
+  var range = [];
+  var eachRange = (maxRange - minRange) / opts.yAxis.splitNumber;
+
+  for (var i = 0; i <= opts.yAxis.splitNumber; i++) {
+    range.push(minRange + eachRange * i);
+  }
+  return range.reverse();
+}
+
+function calYAxisData(series, opts, config) {
+  //堆叠图重算Y轴
+  var columnstyle = assign({}, {
+    type: ""
+  }, opts.extra.column);
+  //如果是多Y轴,重新计算
+  var YLength = opts.yAxis.data.length;
+  var newSeries=new Array(YLength);
+  if(YLength>0){
+    for(let i=0;i<YLength;i++){
+      newSeries[i]=[];
+      for(let j=0;j<series.length;j++){
+        if(series[j].index == i){
+          newSeries[i].push(series[j]);
+        }
+      }
+    }
+    var rangesArr =new Array(YLength);
+    var rangesFormatArr = new Array(YLength);
+    var yAxisWidthArr =new Array(YLength);
+		
+    for(let i=0;i<YLength;i++){
+      let yData = opts.yAxis.data[i];
+			//如果总开关不显示,强制每个Y轴为不显示
+			if(opts.yAxis.disabled == true){
+				yData.disabled = true;
+			}
+			rangesArr[i]=getYAxisTextList(newSeries[i], opts, config, columnstyle.type,i);
+			let yAxisFontSizes = yData.fontSize || config.fontSize;
+			yAxisWidthArr[i] = {position:yData.position?yData.position:'left',width:0};
+			rangesFormatArr[i]= rangesArr[i].map(function(items) {
+				items = util.toFixed(items, 6);
+				items = yData.format ? yData.format(Number(items)) : items;
+				yAxisWidthArr[i].width = Math.max(yAxisWidthArr[i].width, measureText(items, yAxisFontSizes) + 5);
+				return items;
+			});
+			let calibration= yData.calibration? 4*opts.pixelRatio : 0 ;
+			yAxisWidthArr[i].width += calibration +3*opts.pixelRatio;
+      if (yData.disabled === true) {
+        yAxisWidthArr[i].width=0;
+      }
+    }
+    
+  }else{
+    var rangesArr =new Array(1);
+    var rangesFormatArr = new Array(1);
+    var yAxisWidthArr =new Array(1);
+		rangesArr[0] = getYAxisTextList(series, opts, config, columnstyle.type);
+		yAxisWidthArr[0] = {position:'left',width:0};
+		var yAxisFontSize = opts.yAxis.fontSize || config.fontSize;
+		rangesFormatArr[0] = rangesArr[0].map(function(item) {
+			item = util.toFixed(item, 6);
+			item = opts.yAxis.format ? opts.yAxis.format(Number(item)) : item;
+			yAxisWidthArr[0].width = Math.max(yAxisWidthArr[0].width, measureText(item, yAxisFontSize) + 5);
+			return item;
+		});
+		yAxisWidthArr[0].width += 3*opts.pixelRatio;
+		if (opts.yAxis.disabled === true) {
+		  yAxisWidthArr[0] = {position:'left',width:0};
+		  opts.yAxis.data[0]={disabled:true};
+		}else{
+			opts.yAxis.data[0]={disabled:false,position:'left',max:opts.yAxis.max,min:opts.yAxis.min,format:opts.yAxis.format};
+		}
+    
+  }
+
+  return {
+    rangesFormat: rangesFormatArr,
+    ranges: rangesArr,
+    yAxisWidth: yAxisWidthArr
+  };
+  
+}
+
+function calTooltipYAxisData(point, series, opts, config, eachSpacing) {
+  let ranges = [].concat(opts.chartData.yAxisData.ranges);
+  let spacingValid = opts.height - opts.area[0] - opts.area[2];
+  let minAxis = opts.area[0];
+  let items=[];
+  for(let i=0;i<ranges.length;i++){
+    let maxVal = ranges[i].shift();
+    let minVal = ranges[i].pop();
+    let item = maxVal - (maxVal - minVal) * (point - minAxis) / spacingValid;
+    item = opts.yAxis.data[i].format ? opts.yAxis.data[i].format(Number(item)) : item.toFixed(0);
+    items.push(String(item))
+  }
+  return items;
+}
+
+function calMarkLineData(points, opts) {
+  let minRange, maxRange;
+  let spacingValid = opts.height - opts.area[0] - opts.area[2];
+  for (let i = 0; i < points.length; i++) {
+    points[i].yAxisIndex = points[i].yAxisIndex ? points[i].yAxisIndex:0;
+    let range = [].concat(opts.chartData.yAxisData.ranges[points[i].yAxisIndex]);
+    minRange = range.pop();
+    maxRange = range.shift();
+    let height = spacingValid * (points[i].value - minRange) / (maxRange - minRange);
+    points[i].y = opts.height - Math.round(height) - opts.area[2];
+  }
+  return points;
+}
+
+function contextRotate(context, opts) {
+  if (opts.rotateLock !== true) {
+    context.translate(opts.height, 0);
+    context.rotate(90 * Math.PI / 180);
+  } else if (opts._rotate_ !== true) {
+    context.translate(opts.height, 0);
+    context.rotate(90 * Math.PI / 180);
+    opts._rotate_ = true;
+  }
+}
+
+function drawPointShape(points, color, shape, context, opts) {
+  context.beginPath();
+	if(opts.dataPointShapeType == 'hollow'){
+		context.setStrokeStyle(color);
+		context.setFillStyle(opts.background);
+		context.setLineWidth(2 * opts.pixelRatio);
+	}else{
+		context.setStrokeStyle("#ffffff");
+		context.setFillStyle(color);
+		context.setLineWidth(1 * opts.pixelRatio);
+	}
+  if (shape === 'diamond') {
+    points.forEach(function(item, index) {
+      if (item !== null) {
+        context.moveTo(item.x, item.y - 4.5);
+        context.lineTo(item.x - 4.5, item.y);
+        context.lineTo(item.x, item.y + 4.5);
+        context.lineTo(item.x + 4.5, item.y);
+        context.lineTo(item.x, item.y - 4.5);
+      }
+    });
+  } else if (shape === 'circle') {
+    points.forEach(function(item, index) {
+      if (item !== null) {
+        context.moveTo(item.x + 2.5 * opts.pixelRatio, item.y);
+        context.arc(item.x, item.y, 3 * opts.pixelRatio, 0, 2 * Math.PI, false);
+      }
+    });
+  } else if (shape === 'rect') {
+    points.forEach(function(item, index) {
+      if (item !== null) {
+        context.moveTo(item.x - 3.5, item.y - 3.5);
+        context.rect(item.x - 3.5, item.y - 3.5, 7, 7);
+      }
+    });
+  } else if (shape === 'triangle') {
+    points.forEach(function(item, index) {
+      if (item !== null) {
+        context.moveTo(item.x, item.y - 4.5);
+        context.lineTo(item.x - 4.5, item.y + 4.5);
+        context.lineTo(item.x + 4.5, item.y + 4.5);
+        context.lineTo(item.x, item.y - 4.5);
+      }
+    });
+  }
+  context.closePath();
+  context.fill();
+  context.stroke();
+}
+
+function drawRingTitle(opts, config, context, center) {
+  var titlefontSize = opts.title.fontSize || config.titleFontSize;
+  var subtitlefontSize = opts.subtitle.fontSize || config.subtitleFontSize;
+  var title = opts.title.name || '';
+  var subtitle = opts.subtitle.name || '';
+  var titleFontColor = opts.title.color || config.titleColor;
+  var subtitleFontColor = opts.subtitle.color || config.subtitleColor;
+  var titleHeight = title ? titlefontSize : 0;
+  var subtitleHeight = subtitle ? subtitlefontSize : 0;
+  var margin = 5;
+
+  if (subtitle) {
+    var textWidth = measureText(subtitle, subtitlefontSize);
+    var startX = center.x - textWidth / 2 + (opts.subtitle.offsetX || 0);
+    var startY = center.y + subtitlefontSize / 2 + (opts.subtitle.offsetY || 0);
+    if (title) {
+      startY += (titleHeight + margin) / 2;
+    }
+    context.beginPath();
+    context.setFontSize(subtitlefontSize);
+    context.setFillStyle(subtitleFontColor);
+    context.fillText(subtitle, startX, startY);
+    context.closePath();
+    context.stroke();
+  }
+  if (title) {
+    var _textWidth = measureText(title, titlefontSize);
+    var _startX = center.x - _textWidth / 2 + (opts.title.offsetX || 0);
+    var _startY = center.y + titlefontSize / 2 + (opts.title.offsetY || 0);
+    if (subtitle) {
+      _startY -= (subtitleHeight + margin) / 2;
+    }
+    context.beginPath();
+    context.setFontSize(titlefontSize);
+    context.setFillStyle(titleFontColor);
+    context.fillText(title, _startX, _startY);
+    context.closePath();
+    context.stroke();
+  }
+}
+
+function drawPointText(points, series, config, context) {
+  // 绘制数据文案
+  var data = series.data;
+  points.forEach(function(item, index) {
+    if (item !== null) {
+      //var formatVal = series.format ? series.format(data[index]) : data[index];
+      context.beginPath();
+      context.setFontSize(series.textSize || config.fontSize);
+      context.setFillStyle(series.textColor || '#666666');
+      var value = data[index]
+      if (typeof data[index] === 'object' && data[index] !== null) {
+				if (data[index].constructor == Array) {
+					value = data[index][1];
+				}else{
+					value = data[index].value
+				}
+      }
+      var formatVal = series.format ? series.format(value) : value;
+      context.fillText(String(formatVal), item.x - measureText(formatVal, series.textSize || config.fontSize) / 2, item.y -4);
+      context.closePath();
+      context.stroke();
+    }
+  });
+
+}
+
+function drawGaugeLabel(gaugeOption, radius, centerPosition, opts, config, context) {
+  radius -= gaugeOption.width / 2 + config.gaugeLabelTextMargin;
+
+  let totalAngle = gaugeOption.startAngle - gaugeOption.endAngle + 1;
+  let splitAngle = totalAngle / gaugeOption.splitLine.splitNumber;
+  let totalNumber = gaugeOption.endNumber - gaugeOption.startNumber;
+  let splitNumber = totalNumber / gaugeOption.splitLine.splitNumber;
+  let nowAngle = gaugeOption.startAngle;
+  let nowNumber = gaugeOption.startNumber;
+  for (let i = 0; i < gaugeOption.splitLine.splitNumber + 1; i++) {
+    var pos = {
+      x: radius * Math.cos(nowAngle * Math.PI),
+      y: radius * Math.sin(nowAngle * Math.PI)
+    };
+    var labelText = gaugeOption.labelFormat ? gaugeOption.labelFormat(nowNumber) : nowNumber;
+    pos.x += centerPosition.x - measureText(labelText) / 2;
+    pos.y += centerPosition.y;
+    var startX = pos.x;
+    var startY = pos.y;
+    context.beginPath();
+    context.setFontSize(config.fontSize);
+    context.setFillStyle(gaugeOption.labelColor || '#666666');
+    context.fillText(labelText, startX, startY + config.fontSize / 2);
+    context.closePath();
+    context.stroke();
+
+    nowAngle += splitAngle;
+    if (nowAngle >= 2) {
+      nowAngle = nowAngle % 2;
+    }
+    nowNumber += splitNumber;
+  }
+
+}
+
+function drawRadarLabel(angleList, radius, centerPosition, opts, config, context) {
+  var radarOption = opts.extra.radar || {};
+  radius += config.radarLabelTextMargin;
+
+  angleList.forEach(function(angle, index) {
+    var pos = {
+      x: radius * Math.cos(angle),
+      y: radius * Math.sin(angle)
+    };
+    var posRelativeCanvas = convertCoordinateOrigin(pos.x, pos.y, centerPosition);
+    var startX = posRelativeCanvas.x;
+    var startY = posRelativeCanvas.y;
+    if (util.approximatelyEqual(pos.x, 0)) {
+      startX -= measureText(opts.categories[index] || '') / 2;
+    } else if (pos.x < 0) {
+      startX -= measureText(opts.categories[index] || '');
+    }
+    context.beginPath();
+    context.setFontSize(config.fontSize);
+    context.setFillStyle(radarOption.labelColor || '#666666');
+    context.fillText(opts.categories[index] || '', startX, startY + config.fontSize / 2);
+    context.closePath();
+    context.stroke();
+  });
+
+}
+
+function drawPieText(series, opts, config, context, radius, center) {
+  var lineRadius = config.pieChartLinePadding;
+  var textObjectCollection = [];
+  var lastTextObject = null;
+
+  var seriesConvert = series.map(function(item) {
+    var text = item.format ? item.format(+item._proportion_.toFixed(2)) : util.toFixed(item._proportion_.toFixed(4) * 100) +'%';
+    if(item._rose_proportion_) item._proportion_=item._rose_proportion_;
+    var arc = 2 * Math.PI - (item._start_ + 2 * Math.PI * item._proportion_ / 2);
+    var color = item.color;
+    var radius = item._radius_;
+    return {
+      arc: arc,
+      text: text,
+      color: color,
+      radius: radius,
+      textColor: item.textColor,
+      textSize: item.textSize,
+    };
+  });
+  for (let i = 0; i < seriesConvert.length; i++) {
+    let item = seriesConvert[i];
+    // line end
+    let orginX1 = Math.cos(item.arc) * (item.radius + lineRadius);
+    let orginY1 = Math.sin(item.arc) * (item.radius + lineRadius);
+
+    // line start
+    let orginX2 = Math.cos(item.arc) * item.radius;
+    let orginY2 = Math.sin(item.arc) * item.radius;
+
+    // text start
+    let orginX3 = orginX1 >= 0 ? orginX1 + config.pieChartTextPadding : orginX1 - config.pieChartTextPadding;
+    let orginY3 = orginY1;
+    let textWidth = measureText(item.text,item.textSize||config.fontSize);
+    let startY = orginY3;
+
+    if (lastTextObject && util.isSameXCoordinateArea(lastTextObject.start, {
+        x: orginX3
+      })) {
+      if (orginX3 > 0) {
+        startY = Math.min(orginY3, lastTextObject.start.y);
+      } else if (orginX1 < 0) {
+        startY = Math.max(orginY3, lastTextObject.start.y);
+      } else {
+        if (orginY3 > 0) {
+          startY = Math.max(orginY3, lastTextObject.start.y);
+        } else {
+          startY = Math.min(orginY3, lastTextObject.start.y);
+        }
+      }
+    }
+    if (orginX3 < 0) {
+      orginX3 -= textWidth;
+    }
+
+    let textObject = {
+      lineStart: {
+        x: orginX2,
+        y: orginY2
+      },
+      lineEnd: {
+        x: orginX1,
+        y: orginY1
+      },
+      start: {
+        x: orginX3,
+        y: startY
+      },
+      width: textWidth,
+      height: config.fontSize,
+      text: item.text,
+      color: item.color,
+      textColor: item.textColor,
+      textSize: item.textSize
+    };
+    lastTextObject = avoidCollision(textObject, lastTextObject);
+    textObjectCollection.push(lastTextObject);
+  }
+
+  for (let i = 0; i < textObjectCollection.length; i++) {
+    let item = textObjectCollection[i];
+    let lineStartPoistion = convertCoordinateOrigin(item.lineStart.x, item.lineStart.y, center);
+    let lineEndPoistion = convertCoordinateOrigin(item.lineEnd.x, item.lineEnd.y, center);
+    let textPosition = convertCoordinateOrigin(item.start.x, item.start.y, center);
+    context.setLineWidth(1 * opts.pixelRatio);
+    context.setFontSize(config.fontSize);
+    context.beginPath();
+    context.setStrokeStyle(item.color);
+    context.setFillStyle(item.color);
+    context.moveTo(lineStartPoistion.x, lineStartPoistion.y);
+    let curveStartX = item.start.x < 0 ? textPosition.x + item.width : textPosition.x;
+    let textStartX = item.start.x < 0 ? textPosition.x - 5 : textPosition.x + 5;
+    context.quadraticCurveTo(lineEndPoistion.x, lineEndPoistion.y, curveStartX, textPosition.y);
+    context.moveTo(lineStartPoistion.x, lineStartPoistion.y);
+    context.stroke();
+    context.closePath();
+    context.beginPath();
+    context.moveTo(textPosition.x + item.width, textPosition.y);
+    context.arc(curveStartX, textPosition.y, 2, 0, 2 * Math.PI);
+    context.closePath();
+    context.fill();
+    context.beginPath();
+    context.setFontSize(item.textSize || config.fontSize);
+    context.setFillStyle(item.textColor || '#666666');
+    context.fillText(item.text, textStartX, textPosition.y + 3);
+    context.closePath();
+    context.stroke();
+    context.closePath();
+  }
+}
+
+function drawToolTipSplitLine(offsetX, opts, config, context) {
+  var toolTipOption = opts.extra.tooltip || {};
+  toolTipOption.gridType = toolTipOption.gridType == undefined ? 'solid' : toolTipOption.gridType;
+  toolTipOption.dashLength = toolTipOption.dashLength == undefined ? 4 : toolTipOption.dashLength;
+  var startY = opts.area[0];
+  var endY = opts.height - opts.area[2];
+
+  if (toolTipOption.gridType == 'dash') {
+    context.setLineDash([toolTipOption.dashLength, toolTipOption.dashLength]);
+  }
+  context.setStrokeStyle(toolTipOption.gridColor || '#cccccc');
+  context.setLineWidth(1 * opts.pixelRatio);
+  context.beginPath();
+  context.moveTo(offsetX, startY);
+  context.lineTo(offsetX, endY);
+  context.stroke();
+  context.setLineDash([]);
+
+  if (toolTipOption.xAxisLabel) {
+    let labelText = opts.categories[opts.tooltip.index];
+    context.setFontSize(config.fontSize);
+    let textWidth = measureText(labelText, config.fontSize);
+
+    let textX = offsetX - 0.5 * textWidth;
+    let textY = endY;
+    context.beginPath();
+    context.setFillStyle(hexToRgb(toolTipOption.labelBgColor || config.toolTipBackground, toolTipOption.labelBgOpacity || config.toolTipOpacity));
+    context.setStrokeStyle(toolTipOption.labelBgColor || config.toolTipBackground);
+    context.setLineWidth(1 * opts.pixelRatio);
+    context.rect(textX - config.toolTipPadding, textY, textWidth + 2 * config.toolTipPadding, config.fontSize + 2 * config.toolTipPadding);
+    context.closePath();
+    context.stroke();
+    context.fill();
+
+    context.beginPath();
+    context.setFontSize(config.fontSize);
+    context.setFillStyle(toolTipOption.labelFontColor || config.fontColor);
+    context.fillText(String(labelText), textX, textY + config.toolTipPadding + config.fontSize);
+    context.closePath();
+    context.stroke();
+  }
+}
+
+function drawMarkLine(opts, config, context) {
+  let markLineOption = assign({}, {
+    type: 'solid',
+    dashLength: 4,
+    data: []
+  }, opts.extra.markLine);
+  let startX = opts.area[3];
+  let endX = opts.width - opts.area[1];
+  let points = calMarkLineData(markLineOption.data, opts);
+
+  for (let i = 0; i < points.length; i++) {
+    let item = assign({}, {
+      lineColor: '#DE4A42',
+      showLabel: false,
+      labelFontColor: '#666666',
+      labelBgColor: '#DFE8FF',
+      labelBgOpacity: 0.8,
+      yAxisIndex: 0
+    }, points[i]);
+
+    if (markLineOption.type == 'dash') {
+      context.setLineDash([markLineOption.dashLength, markLineOption.dashLength]);
+    }
+    context.setStrokeStyle(item.lineColor);
+    context.setLineWidth(1 * opts.pixelRatio);
+    context.beginPath();
+    context.moveTo(startX, item.y);
+    context.lineTo(endX, item.y);
+    context.stroke();
+    context.setLineDash([]);
+    if (item.showLabel) {
+      let labelText = opts.yAxis.format ? opts.yAxis.format(Number(item.value)) : item.value;
+      context.setFontSize(config.fontSize);
+      let textWidth = measureText(labelText, config.fontSize);
+      let bgStartX = opts.padding[3] + config.yAxisTitleWidth - config.toolTipPadding;
+      let bgEndX = Math.max(opts.area[3], textWidth + config.toolTipPadding * 2);
+      let bgWidth = bgEndX - bgStartX;
+
+      let textX = bgStartX + (bgWidth - textWidth) / 2;
+      let textY = item.y;
+      context.setFillStyle(hexToRgb(item.labelBgColor, item.labelBgOpacity));
+      context.setStrokeStyle(item.labelBgColor);
+      context.setLineWidth(1 * opts.pixelRatio);
+      context.beginPath();
+      context.rect(bgStartX, textY - 0.5 * config.fontSize - config.toolTipPadding, bgWidth, config.fontSize + 2 * config.toolTipPadding);
+      context.closePath();
+      context.stroke();
+      context.fill();
+
+      context.beginPath();
+      context.setFontSize(config.fontSize);
+      context.setFillStyle(item.labelFontColor);
+      context.fillText(String(labelText), textX, textY + 0.5 * config.fontSize);
+      context.stroke();
+    }
+  }
+}
+
+function drawToolTipHorizentalLine(opts, config, context, eachSpacing, xAxisPoints) {
+  var toolTipOption = assign({}, {
+    gridType: 'solid',
+    dashLength: 4
+  }, opts.extra.tooltip);
+
+  var startX = opts.area[3];
+  var endX = opts.width - opts.area[1];
+
+  if (toolTipOption.gridType == 'dash') {
+    context.setLineDash([toolTipOption.dashLength, toolTipOption.dashLength]);
+  }
+  context.setStrokeStyle(toolTipOption.gridColor || '#cccccc');
+  context.setLineWidth(1 * opts.pixelRatio);
+  context.beginPath();
+  context.moveTo(startX, opts.tooltip.offset.y);
+  context.lineTo(endX, opts.tooltip.offset.y);
+  context.stroke();
+  context.setLineDash([]);
+
+  if (toolTipOption.yAxisLabel) {
+    let labelText = calTooltipYAxisData(opts.tooltip.offset.y, opts.series, opts, config, eachSpacing);
+    let widthArr = opts.chartData.yAxisData.yAxisWidth;
+    let tStartLeft=opts.area[3];
+    let tStartRight=opts.width-opts.area[1];
+    for(let i=0;i<labelText.length;i++){
+      context.setFontSize(config.fontSize);
+      let textWidth = measureText(labelText[i], config.fontSize);
+      let bgStartX,bgEndX,bgWidth;
+      if(widthArr[i].position == 'left'){
+        bgStartX = tStartLeft - widthArr[i].width;
+        bgEndX = Math.max(bgStartX, bgStartX + textWidth + config.toolTipPadding * 2);
+      }else{
+        bgStartX = tStartRight;
+        bgEndX = Math.max(bgStartX + widthArr[i].width, bgStartX + textWidth + config.toolTipPadding * 2);
+      }
+      bgWidth = bgEndX - bgStartX;
+      
+      let textX = bgStartX + (bgWidth - textWidth) / 2;
+      let textY = opts.tooltip.offset.y;
+      context.beginPath();
+      context.setFillStyle(hexToRgb(toolTipOption.labelBgColor || config.toolTipBackground, toolTipOption.labelBgOpacity || config.toolTipOpacity));
+      context.setStrokeStyle(toolTipOption.labelBgColor || config.toolTipBackground);
+      context.setLineWidth(1 * opts.pixelRatio);
+      context.rect(bgStartX, textY - 0.5 * config.fontSize - config.toolTipPadding, bgWidth, config.fontSize + 2 * config.toolTipPadding);
+      context.closePath();
+      context.stroke();
+      context.fill();
+      
+      context.beginPath();
+      context.setFontSize(config.fontSize);
+      context.setFillStyle(toolTipOption.labelFontColor || config.fontColor);
+      context.fillText(labelText[i], textX, textY + 0.5 * config.fontSize);
+      context.closePath();
+      context.stroke();
+      if(widthArr[i].position == 'left'){
+        tStartLeft -=(widthArr[i].width + opts.yAxis.padding);
+      }else{
+        tStartRight +=widthArr[i].width+ opts.yAxis.padding;
+      }
+    }
+  }
+}
+
+function drawToolTipSplitArea(offsetX, opts, config, context, eachSpacing) {
+  var toolTipOption = assign({}, {
+    activeBgColor: '#000000',
+    activeBgOpacity: 0.08
+  }, opts.extra.tooltip);
+  var startY = opts.area[0];
+  var endY = opts.height - opts.area[2];
+  context.beginPath();
+  context.setFillStyle(hexToRgb(toolTipOption.activeBgColor, toolTipOption.activeBgOpacity));
+  context.rect(offsetX - eachSpacing / 2, startY, eachSpacing, endY - startY);
+  context.closePath();
+  context.fill();
+}
+
+function drawToolTip(textList, offset, opts, config, context, eachSpacing, xAxisPoints) {
+  var toolTipOption = assign({}, {
+		showBox:true,
+    bgColor: '#000000',
+    bgOpacity: 0.7,
+    fontColor: '#FFFFFF'
+  }, opts.extra.tooltip);
+  var legendWidth = 4 * opts.pixelRatio;
+  var legendMarginRight = 5 * opts.pixelRatio;
+  var arrowWidth = 8 * opts.pixelRatio;
+  var isOverRightBorder = false;
+  if (opts.type == 'line' || opts.type == 'area' || opts.type == 'candle' || opts.type == 'mix') {
+    drawToolTipSplitLine(opts.tooltip.offset.x, opts, config, context);
+  }
+
+  offset = assign({
+    x: 0,
+    y: 0
+  }, offset);
+  offset.y -= 8 * opts.pixelRatio;
+  var textWidth = textList.map(function(item) {
+    return measureText(item.text, config.fontSize);
+  });
+  var toolTipWidth = legendWidth + legendMarginRight + 4 * config.toolTipPadding + Math.max.apply(null, textWidth);
+  var toolTipHeight = 2 * config.toolTipPadding + textList.length * config.toolTipLineHeight;
+
+	if(toolTipOption.showBox == false){ return }
+  // if beyond the right border
+  if (offset.x - Math.abs(opts._scrollDistance_) + arrowWidth + toolTipWidth > opts.width) {
+    isOverRightBorder = true;
+  }
+  if (toolTipHeight + offset.y > opts.height) {
+    offset.y = opts.height - toolTipHeight;
+  }
+  // draw background rect
+  context.beginPath();
+  context.setFillStyle(hexToRgb(toolTipOption.bgColor || config.toolTipBackground, toolTipOption.bgOpacity || config.toolTipOpacity));
+  if (isOverRightBorder) {
+    context.moveTo(offset.x, offset.y + 10 * opts.pixelRatio);
+    context.lineTo(offset.x - arrowWidth, offset.y + 10 * opts.pixelRatio - 5 * opts.pixelRatio);
+    context.lineTo(offset.x - arrowWidth, offset.y);
+    context.lineTo(offset.x - arrowWidth - Math.round(toolTipWidth), offset.y);
+    context.lineTo(offset.x - arrowWidth - Math.round(toolTipWidth), offset.y + toolTipHeight);
+    context.lineTo(offset.x - arrowWidth, offset.y + toolTipHeight);
+    context.lineTo(offset.x - arrowWidth, offset.y + 10 * opts.pixelRatio + 5 * opts.pixelRatio);
+    context.lineTo(offset.x, offset.y + 10 * opts.pixelRatio);
+  } else {
+    context.moveTo(offset.x, offset.y + 10 * opts.pixelRatio);
+    context.lineTo(offset.x + arrowWidth, offset.y + 10 * opts.pixelRatio - 5 * opts.pixelRatio);
+    context.lineTo(offset.x + arrowWidth, offset.y);
+    context.lineTo(offset.x + arrowWidth + Math.round(toolTipWidth), offset.y);
+    context.lineTo(offset.x + arrowWidth + Math.round(toolTipWidth), offset.y + toolTipHeight);
+    context.lineTo(offset.x + arrowWidth, offset.y + toolTipHeight);
+    context.lineTo(offset.x + arrowWidth, offset.y + 10 * opts.pixelRatio + 5 * opts.pixelRatio);
+    context.lineTo(offset.x, offset.y + 10 * opts.pixelRatio);
+  }
+
+  context.closePath();
+  context.fill();
+
+  // draw legend
+  textList.forEach(function(item, index) {
+    if (item.color !== null) {
+      context.beginPath();
+      context.setFillStyle(item.color);
+      var startX = offset.x + arrowWidth + 2 * config.toolTipPadding;
+      var startY = offset.y + (config.toolTipLineHeight - config.fontSize) / 2 + config.toolTipLineHeight * index +
+        config.toolTipPadding + 1;
+      if (isOverRightBorder) {
+        startX = offset.x - toolTipWidth - arrowWidth + 2 * config.toolTipPadding;
+      }
+      context.fillRect(startX, startY, legendWidth, config.fontSize);
+      context.closePath();
+    }
+  });
+
+  // draw text list
+
+  textList.forEach(function(item, index) {
+    var startX = offset.x + arrowWidth + 2 * config.toolTipPadding + legendWidth + legendMarginRight;
+    if (isOverRightBorder) {
+      startX = offset.x - toolTipWidth - arrowWidth + 2 * config.toolTipPadding + +legendWidth + legendMarginRight;
+    }
+    var startY = offset.y + (config.toolTipLineHeight - config.fontSize) / 2 + config.toolTipLineHeight * index +
+      config.toolTipPadding;
+    context.beginPath();
+    context.setFontSize(config.fontSize);
+    context.setFillStyle(toolTipOption.fontColor);
+    context.fillText(item.text, startX, startY + config.fontSize);
+    context.closePath();
+    context.stroke();
+  });
+}
+
+function drawYAxisTitle(title, opts, config, context) {
+  var startX = config.xAxisHeight + (opts.height - config.xAxisHeight - measureText(title)) / 2;
+  context.save();
+  context.beginPath();
+  context.setFontSize(config.fontSize);
+  context.setFillStyle(opts.yAxis.titleFontColor || '#333333');
+  context.translate(0, opts.height);
+  context.rotate(-90 * Math.PI / 180);
+  context.fillText(title, startX, opts.padding[3] + 0.5 * config.fontSize);
+  context.closePath();
+  context.stroke();
+  context.restore();
+}
+
+function drawColumnDataPoints(series, opts, config, context) {
+  let process = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : 1;
+  let xAxisData = opts.chartData.xAxisData,
+    xAxisPoints = xAxisData.xAxisPoints,
+    eachSpacing = xAxisData.eachSpacing;
+  let columnOption = assign({}, {
+    type: 'group',
+    width: eachSpacing / 2,
+    meter: {
+      border: 4,
+      fillColor: '#FFFFFF'
+    }
+  }, opts.extra.column);
+  
+  let calPoints = [];
+  context.save();
+	
+	let leftNum=-2;
+	let rightNum=xAxisPoints.length+2;
+	
+  if (opts._scrollDistance_ && opts._scrollDistance_ !== 0 && opts.enableScroll === true) {
+    context.translate(opts._scrollDistance_, 0);
+		leftNum=Math.floor(-opts._scrollDistance_/eachSpacing)-2;
+		rightNum=leftNum+opts.xAxis.itemCount+4;
+  }
+  if (opts.tooltip && opts.tooltip.textList && opts.tooltip.textList.length && process === 1) {
+    drawToolTipSplitArea(opts.tooltip.offset.x, opts, config, context, eachSpacing);
+  }
+	
+  series.forEach(function(eachSeries, seriesIndex) {
+    let ranges,minRange,maxRange;
+    ranges = [].concat(opts.chartData.yAxisData.ranges[eachSeries.index]);
+    minRange = ranges.pop();
+    maxRange = ranges.shift();
+    
+    var data = eachSeries.data;
+    switch (columnOption.type) {
+      case 'group':
+        var points = getDataPoints(data, minRange, maxRange, xAxisPoints, eachSpacing, opts, config, process);
+        var tooltipPoints = getStackDataPoints(data, minRange, maxRange, xAxisPoints, eachSpacing, opts, config, seriesIndex, series, process);
+        calPoints.push(tooltipPoints);
+        points = fixColumeData(points, eachSpacing, series.length, seriesIndex, config, opts);
+				for(let i=0;i<points.length;i++){
+					let item=points[i];
+          if (item !== null && i>leftNum && i<rightNum) {
+            context.beginPath();
+            context.setStrokeStyle(item.color || eachSeries.color);
+            context.setLineWidth(1)
+            context.setFillStyle(item.color || eachSeries.color);
+            var startX = item.x - item.width / 2;
+            var height = opts.height - item.y - opts.area[2];
+            context.moveTo(startX, item.y);
+            context.lineTo(startX+item.width-2,item.y);
+            context.lineTo(startX+item.width-2,opts.height - opts.area[2]);
+            context.lineTo(startX,opts.height - opts.area[2]);
+            context.lineTo(startX,item.y);
+            context.closePath();
+            context.stroke();
+            context.fill();
+          }
+        };
+        break;
+      case 'stack':
+        // 绘制堆叠数据图
+        var points = getStackDataPoints(data, minRange, maxRange, xAxisPoints, eachSpacing, opts, config, seriesIndex, series, process);
+        calPoints.push(points);
+        points = fixColumeStackData(points, eachSpacing, series.length, seriesIndex, config, opts, series);
+
+        for(let i=0;i<points.length;i++){
+        	let item=points[i];
+          if (item !== null && i>leftNum && i<rightNum) {
+            context.beginPath();
+            context.setFillStyle(item.color || eachSeries.color);
+            var startX = item.x - item.width / 2 + 1;
+            var height = opts.height - item.y - opts.area[2];
+            var height0 = opts.height - item.y0 - opts.area[2];
+            if (seriesIndex > 0) {
+              height -= height0;
+            }
+            context.moveTo(startX, item.y);
+            context.fillRect(startX, item.y, item.width - 2, height);
+            context.closePath();
+            context.fill();
+          }
+        };
+        break;
+      case 'meter':
+        // 绘制温度计数据图
+        var points = getDataPoints(data, minRange, maxRange, xAxisPoints, eachSpacing, opts, config, process);
+        calPoints.push(points);
+        points = fixColumeMeterData(points, eachSpacing, series.length, seriesIndex, config, opts, columnOption.meter.border);
+        if (seriesIndex == 0) {
+          for(let i=0;i<points.length;i++){
+          	let item=points[i];
+            if (item !== null && i>leftNum && i<rightNum) {
+              //画背景颜色
+              context.beginPath();
+              context.setFillStyle(columnOption.meter.fillColor);
+              var startX = item.x - item.width / 2;
+              var height = opts.height - item.y - opts.area[2];
+              context.moveTo(startX, item.y);
+              context.fillRect(startX, item.y, item.width, height);
+              context.closePath();
+              context.fill();
+              //画边框线
+              if (columnOption.meter.border > 0) {
+                context.beginPath();
+                context.setStrokeStyle(eachSeries.color);
+                context.setLineWidth(columnOption.meter.border * opts.pixelRatio);
+                context.moveTo(startX + columnOption.meter.border * 0.5, item.y + height);
+                context.lineTo(startX + columnOption.meter.border * 0.5, item.y + columnOption.meter.border * 0.5);
+                context.lineTo(startX + item.width - columnOption.meter.border * 0.5, item.y + columnOption.meter.border * 0.5);
+                context.lineTo(startX + item.width - columnOption.meter.border * 0.5, item.y + height);
+                context.stroke();
+              }
+            }
+          };
+        } else {
+          for(let i=0;i<points.length;i++){
+          	let item=points[i];
+            if (item !== null && i>leftNum && i<rightNum) {
+              context.beginPath();
+              context.setFillStyle(item.color || eachSeries.color);
+              var startX = item.x - item.width / 2;
+              var height = opts.height - item.y - opts.area[2];
+              context.moveTo(startX, item.y);
+              context.fillRect(startX, item.y, item.width, height);
+              context.closePath();
+              context.fill();
+            }
+          };
+        }
+        break;
+    }
+  });
+
+  if (opts.dataLabel !== false && process === 1) {
+    series.forEach(function(eachSeries, seriesIndex) {
+      let ranges,minRange,maxRange;
+        ranges = [].concat(opts.chartData.yAxisData.ranges[eachSeries.index]);
+        minRange = ranges.pop();
+        maxRange = ranges.shift();
+      var data = eachSeries.data;
+      switch (columnOption.type) {
+        case 'group':
+          var points = getDataPoints(data, minRange, maxRange, xAxisPoints, eachSpacing, opts, config, process);
+          points = fixColumeData(points, eachSpacing, series.length, seriesIndex, config, opts);
+          drawPointText(points, eachSeries, config, context);
+          break;
+        case 'stack':
+          var points = getStackDataPoints(data, minRange, maxRange, xAxisPoints, eachSpacing, opts, config, seriesIndex, series, process);
+          drawPointText(points, eachSeries, config, context);
+          break;
+        case 'meter':
+          var points = getDataPoints(data, minRange, maxRange, xAxisPoints, eachSpacing, opts, config, process);
+          drawPointText(points, eachSeries, config, context);
+          break;
+      }
+    });
+  }
+
+  context.restore();
+
+  return {
+    xAxisPoints: xAxisPoints,
+    calPoints: calPoints,
+    eachSpacing: eachSpacing
+  };
+}
+
+function drawCandleDataPoints(series, seriesMA, opts, config, context) {
+  var process = arguments.length > 5 && arguments[5] !== undefined ? arguments[5] : 1;
+  var candleOption = assign({}, {
+    color: {},
+    average: {}
+  }, opts.extra.candle);
+  candleOption.color = assign({}, {
+    upLine: '#f04864',
+    upFill: '#f04864',
+    downLine: '#2fc25b',
+    downFill: '#2fc25b'
+  }, candleOption.color);
+  candleOption.average = assign({}, {
+    show: false,
+    name: [],
+    day: [],
+    color: config.colors
+  }, candleOption.average);
+  opts.extra.candle = candleOption;
+
+  let xAxisData = opts.chartData.xAxisData,
+    xAxisPoints = xAxisData.xAxisPoints,
+    eachSpacing = xAxisData.eachSpacing;
+
+  let calPoints = [];
+
+  context.save();
+	
+	let leftNum=-2;
+	let rightNum=xAxisPoints.length+2;
+	let leftSpace=0;
+	let rightSpace=opts.width+eachSpacing;
+	
+  if (opts._scrollDistance_ && opts._scrollDistance_ !== 0 && opts.enableScroll === true) {
+    context.translate(opts._scrollDistance_, 0);
+		leftNum=Math.floor(-opts._scrollDistance_/eachSpacing)-2;
+		rightNum=leftNum+opts.xAxis.itemCount+4;
+		leftSpace=-opts._scrollDistance_-eachSpacing+opts.area[3];
+		rightSpace=leftSpace+(opts.xAxis.itemCount+4)*eachSpacing;
+  }
+
+  //画均线
+  if (candleOption.average.show) {
+    seriesMA.forEach(function(eachSeries, seriesIndex) {
+      let ranges,minRange,maxRange;
+      ranges = [].concat(opts.chartData.yAxisData.ranges[eachSeries.index]);
+      minRange = ranges.pop();
+      maxRange = ranges.shift();
+
+      var data = eachSeries.data;
+      var points = getDataPoints(data, minRange, maxRange, xAxisPoints, eachSpacing, opts, config, process);
+      var splitPointList = splitPoints(points);
+			
+			for(let i=0;i<splitPointList.length;i++){
+				let points=splitPointList[i];
+				context.beginPath();
+				context.setStrokeStyle(eachSeries.color);
+				context.setLineWidth(1);
+				if (points.length === 1) {
+					context.moveTo(points[0].x, points[0].y);
+					context.arc(points[0].x, points[0].y, 1, 0, 2 * Math.PI);
+				} else {
+					context.moveTo(points[0].x, points[0].y);
+					let startPoint=0;
+					for(let j=0;j<points.length;j++){
+						let item=points[j];
+						if(startPoint==0 && item.x > leftSpace){
+							context.moveTo(item.x, item.y);
+							startPoint=1;
+						}
+						if (j > 0 && item.x > leftSpace && item.x < rightSpace) {
+							var ctrlPoint = createCurveControlPoints(points, j - 1);
+							context.bezierCurveTo(ctrlPoint.ctrA.x, ctrlPoint.ctrA.y, ctrlPoint.ctrB.x, ctrlPoint.ctrB.y,item.x, item.y);
+						}
+					}
+					context.moveTo(points[0].x, points[0].y);
+				}
+				context.closePath();
+				context.stroke();
+      }
+    });
+  }
+  //画K线
+  series.forEach(function(eachSeries, seriesIndex) {
+    let ranges,minRange,maxRange;
+    ranges = [].concat(opts.chartData.yAxisData.ranges[eachSeries.index]);
+    minRange = ranges.pop();
+    maxRange = ranges.shift();
+    var data = eachSeries.data;
+    var points = getCandleDataPoints(data, minRange, maxRange, xAxisPoints, eachSpacing, opts, config, process);
+    calPoints.push(points);
+    var splitPointList = splitPoints(points);
+
+		for(let i=0;i<splitPointList[0].length;i++){
+			if(i>leftNum && i<rightNum){
+				let item=splitPointList[0][i];
+				context.beginPath();
+				//如果上涨
+				if (data[i][1] - data[i][0] > 0) {
+					context.setStrokeStyle(candleOption.color.upLine);
+					context.setFillStyle(candleOption.color.upFill);
+					context.setLineWidth(1 * opts.pixelRatio);
+					context.moveTo(item[3].x, item[3].y); //顶点
+					context.lineTo(item[1].x, item[1].y); //收盘中间点
+					context.lineTo(item[1].x - eachSpacing / 4, item[1].y); //收盘左侧点
+					context.lineTo(item[0].x - eachSpacing / 4, item[0].y); //开盘左侧点
+					context.lineTo(item[0].x, item[0].y); //开盘中间点
+					context.lineTo(item[2].x, item[2].y); //底点
+					context.lineTo(item[0].x, item[0].y); //开盘中间点
+					context.lineTo(item[0].x + eachSpacing / 4, item[0].y); //开盘右侧点
+					context.lineTo(item[1].x + eachSpacing / 4, item[1].y); //收盘右侧点
+					context.lineTo(item[1].x, item[1].y); //收盘中间点
+					context.moveTo(item[3].x, item[3].y); //顶点
+				} else {
+					context.setStrokeStyle(candleOption.color.downLine);
+					context.setFillStyle(candleOption.color.downFill);
+					context.setLineWidth(1 * opts.pixelRatio);
+					context.moveTo(item[3].x, item[3].y); //顶点
+					context.lineTo(item[0].x, item[0].y); //开盘中间点
+					context.lineTo(item[0].x - eachSpacing / 4, item[0].y); //开盘左侧点
+					context.lineTo(item[1].x - eachSpacing / 4, item[1].y); //收盘左侧点
+					context.lineTo(item[1].x, item[1].y); //收盘中间点
+					context.lineTo(item[2].x, item[2].y); //底点
+					context.lineTo(item[1].x, item[1].y); //收盘中间点
+					context.lineTo(item[1].x + eachSpacing / 4, item[1].y); //收盘右侧点
+					context.lineTo(item[0].x + eachSpacing / 4, item[0].y); //开盘右侧点
+					context.lineTo(item[0].x, item[0].y); //开盘中间点
+					context.moveTo(item[3].x, item[3].y); //顶点
+				}
+				context.closePath();
+				context.fill();
+				context.stroke();
+			}
+    }
+  });
+
+  context.restore();
+
+  return {
+    xAxisPoints: xAxisPoints,
+    calPoints: calPoints,
+    eachSpacing: eachSpacing
+  };
+}
+
+function drawAreaDataPoints(series, opts, config, context) {
+  var process = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : 1;
+  var areaOption = assign({},{
+    type: 'straight',
+    opacity: 0.2,
+    addLine: false,
+    width: 2,
+		gradient:false
+  },opts.extra.area);
+
+  let xAxisData = opts.chartData.xAxisData,
+    xAxisPoints = xAxisData.xAxisPoints,
+    eachSpacing = xAxisData.eachSpacing;
+
+  let endY = opts.height - opts.area[2];
+  let calPoints = [];
+
+  context.save();
+	let leftSpace=0;
+	let rightSpace=opts.width+eachSpacing;
+  if (opts._scrollDistance_ && opts._scrollDistance_ !== 0 && opts.enableScroll === true) {
+    context.translate(opts._scrollDistance_, 0);
+		leftSpace=-opts._scrollDistance_-eachSpacing+opts.area[3];
+		rightSpace=leftSpace+(opts.xAxis.itemCount+4)*eachSpacing;
+  }
+
+  series.forEach(function(eachSeries, seriesIndex) {
+    let ranges,minRange,maxRange;
+    ranges = [].concat(opts.chartData.yAxisData.ranges[eachSeries.index]);
+    minRange = ranges.pop();
+    maxRange = ranges.shift();
+    let data = eachSeries.data;
+    let points = getDataPoints(data, minRange, maxRange, xAxisPoints, eachSpacing, opts, config, process);
+    calPoints.push(points);
+
+    let splitPointList = splitPoints(points);
+    for (let i = 0; i < splitPointList.length; i++) {
+      let points = splitPointList[i];
+      // 绘制区域数
+      context.beginPath();
+      context.setStrokeStyle(hexToRgb(eachSeries.color, areaOption.opacity));
+			if(areaOption.gradient){
+				let gradient = context.createLinearGradient(0, opts.area[0], 0, opts.height-opts.area[2]);
+				gradient.addColorStop('0', hexToRgb(eachSeries.color, areaOption.opacity));
+				gradient.addColorStop('1.0',hexToRgb("#FFFFFF", 0.1));
+				context.setFillStyle(gradient);
+			}else{
+				context.setFillStyle(hexToRgb(eachSeries.color, areaOption.opacity));
+			}
+      context.setLineWidth(areaOption.width * opts.pixelRatio);
+      if (points.length > 1) {
+        let firstPoint = points[0];
+        let lastPoint = points[points.length - 1];
+        context.moveTo(firstPoint.x, firstPoint.y);
+				let startPoint=0;
+        if (areaOption.type === 'curve') {
+					for(let j=0;j<points.length;j++){
+						let item=points[j];
+						if(startPoint==0 && item.x > leftSpace){
+							context.moveTo(item.x, item.y);
+							startPoint=1;
+						}
+            if (j > 0 && item.x > leftSpace && item.x < rightSpace) {
+              let ctrlPoint = createCurveControlPoints(points, j - 1);
+              context.bezierCurveTo(ctrlPoint.ctrA.x, ctrlPoint.ctrA.y, ctrlPoint.ctrB.x, ctrlPoint.ctrB.y,item.x, item.y);
+            }
+          };
+        } else {
+					for(let j=0;j<points.length;j++){
+						let item=points[j];
+						if(startPoint==0 && item.x > leftSpace){
+							context.moveTo(item.x, item.y);
+							startPoint=1;
+						}
+					  if (j > 0 && item.x > leftSpace && item.x < rightSpace) {
+              context.lineTo(item.x, item.y);
+            }
+          };
+        }
+
+        context.lineTo(lastPoint.x, endY);
+        context.lineTo(firstPoint.x, endY);
+        context.lineTo(firstPoint.x, firstPoint.y);
+      } else {
+        let item = points[0];
+        context.moveTo(item.x - eachSpacing / 2, item.y);
+        context.lineTo(item.x + eachSpacing / 2, item.y);
+        context.lineTo(item.x + eachSpacing / 2, endY);
+        context.lineTo(item.x - eachSpacing / 2, endY);
+        context.moveTo(item.x - eachSpacing / 2, item.y);
+      }
+      context.closePath();
+      context.fill();
+
+      //画连线
+      if (areaOption.addLine) {
+				if (eachSeries.lineType == 'dash') {
+					let dashLength = eachSeries.dashLength?eachSeries.dashLength:8;
+					dashLength *= opts.pixelRatio;
+				  context.setLineDash([dashLength, dashLength]);
+				}
+        context.beginPath();
+        context.setStrokeStyle(eachSeries.color);
+        context.setLineWidth(areaOption.width * opts.pixelRatio);
+        if (points.length === 1) {
+          context.moveTo(points[0].x, points[0].y);
+          context.arc(points[0].x, points[0].y, 1, 0, 2 * Math.PI);
+        } else {
+          context.moveTo(points[0].x, points[0].y);
+					let startPoint=0;
+          if (areaOption.type === 'curve') {
+            for(let j=0;j<points.length;j++){
+            	let item=points[j];
+            	if(startPoint==0 && item.x > leftSpace){
+            		context.moveTo(item.x, item.y);
+            		startPoint=1;
+            	}
+              if (j > 0 && item.x > leftSpace && item.x < rightSpace) {
+                let ctrlPoint = createCurveControlPoints(points, j - 1);
+                context.bezierCurveTo(ctrlPoint.ctrA.x, ctrlPoint.ctrA.y, ctrlPoint.ctrB.x, ctrlPoint.ctrB.y,item.x,item.y);
+              }
+            };
+          } else {
+            for(let j=0;j<points.length;j++){
+            	let item=points[j];
+            	if(startPoint==0 && item.x > leftSpace){
+            		context.moveTo(item.x, item.y);
+            		startPoint=1;
+            	}
+              if (j > 0 && item.x > leftSpace && item.x < rightSpace) {
+                context.lineTo(item.x, item.y);
+              }
+            };
+          }
+          context.moveTo(points[0].x, points[0].y);
+        }
+        context.stroke();
+				context.setLineDash([]);
+      }
+    }
+
+    //画点
+    if (opts.dataPointShape !== false) {
+      drawPointShape(points, eachSeries.color, eachSeries.pointShape, context, opts);
+    }
+
+  });
+
+  if (opts.dataLabel !== false && process === 1) {
+    series.forEach(function(eachSeries, seriesIndex) {
+      let ranges,minRange,maxRange;
+      ranges = [].concat(opts.chartData.yAxisData.ranges[eachSeries.index]);
+      minRange = ranges.pop();
+      maxRange = ranges.shift();
+      var data = eachSeries.data;
+      var points = getDataPoints(data, minRange, maxRange, xAxisPoints, eachSpacing, opts, config, process);
+      drawPointText(points, eachSeries, config, context);
+    });
+  }
+
+  context.restore();
+
+  return {
+    xAxisPoints: xAxisPoints,
+    calPoints: calPoints,
+    eachSpacing: eachSpacing
+  };
+}
+
+function drawLineDataPoints(series, opts, config, context) {
+  var process = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : 1;
+  var lineOption = assign({},{
+		type: 'straight',
+		width: 2
+	},opts.extra.line);
+	lineOption.width *=opts.pixelRatio;
+	
+  let xAxisData = opts.chartData.xAxisData,
+    xAxisPoints = xAxisData.xAxisPoints,
+    eachSpacing = xAxisData.eachSpacing;
+  var calPoints = [];
+
+  context.save();
+	let leftSpace=0;
+	let rightSpace=opts.width+eachSpacing;
+  if (opts._scrollDistance_ && opts._scrollDistance_ !== 0 && opts.enableScroll === true) {
+    context.translate(opts._scrollDistance_, 0);
+		leftSpace=-opts._scrollDistance_-eachSpacing+opts.area[3];
+		rightSpace=leftSpace+(opts.xAxis.itemCount+4)*eachSpacing;
+  }
+
+  series.forEach(function(eachSeries, seriesIndex) {
+    let ranges,minRange,maxRange;
+    ranges = [].concat(opts.chartData.yAxisData.ranges[eachSeries.index]);
+    minRange = ranges.pop();
+    maxRange = ranges.shift();
+    var data = eachSeries.data;
+    var points = getDataPoints(data, minRange, maxRange, xAxisPoints, eachSpacing, opts, config, process);
+    calPoints.push(points);
+    var splitPointList = splitPoints(points);
+		
+		if (eachSeries.lineType == 'dash') {
+			let dashLength = eachSeries.dashLength?eachSeries.dashLength:8;
+			dashLength *= opts.pixelRatio;
+		  context.setLineDash([dashLength, dashLength]);
+		}
+		context.beginPath();
+		context.setStrokeStyle(eachSeries.color);
+		context.setLineWidth(lineOption.width);
+		
+    splitPointList.forEach(function(points, index) {
+			
+      if (points.length === 1) {
+        context.moveTo(points[0].x, points[0].y);
+        context.arc(points[0].x, points[0].y, 1, 0, 2 * Math.PI);
+      } else {
+        context.moveTo(points[0].x, points[0].y);
+				let startPoint=0;
+        if (lineOption.type === 'curve') {
+          for(let j=0;j<points.length;j++){
+          	let item=points[j];
+          	if(startPoint==0 && item.x > leftSpace){
+          		context.moveTo(item.x, item.y);
+          		startPoint=1;
+          	}
+            if (j > 0 && item.x > leftSpace && item.x < rightSpace) {
+              var ctrlPoint = createCurveControlPoints(points, j - 1);
+              context.bezierCurveTo(ctrlPoint.ctrA.x, ctrlPoint.ctrA.y, ctrlPoint.ctrB.x, ctrlPoint.ctrB.y,item.x, item.y);
+            }
+          };
+        } else {
+          for(let j=0;j<points.length;j++){
+          	let item=points[j];
+          	if(startPoint==0 && item.x > leftSpace){
+          		context.moveTo(item.x, item.y);
+          		startPoint=1;
+          	}
+            if (j > 0 && item.x > leftSpace && item.x < rightSpace) {
+              context.lineTo(item.x, item.y);
+            }
+          };
+        }
+        context.moveTo(points[0].x, points[0].y);
+      }
+      
+    });
+		
+		context.stroke();
+		context.setLineDash([]);
+		
+    if (opts.dataPointShape !== false) {
+      drawPointShape(points, eachSeries.color, eachSeries.pointShape, context, opts);
+    }
+  });
+
+  if (opts.dataLabel !== false && process === 1) {
+    series.forEach(function(eachSeries, seriesIndex) {
+      let ranges,minRange,maxRange;
+      ranges = [].concat(opts.chartData.yAxisData.ranges[eachSeries.index]);
+      minRange = ranges.pop();
+      maxRange = ranges.shift();
+      var data = eachSeries.data;
+      var points = getDataPoints(data, minRange, maxRange, xAxisPoints, eachSpacing, opts, config, process);
+      drawPointText(points, eachSeries, config, context);
+    });
+  }
+
+  context.restore();
+
+  return {
+    xAxisPoints: xAxisPoints,
+    calPoints: calPoints,
+    eachSpacing: eachSpacing
+  };
+}
+
+function drawMixDataPoints(series, opts, config, context) {
+  let process = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : 1;
+  
+  let xAxisData = opts.chartData.xAxisData,
+    xAxisPoints = xAxisData.xAxisPoints,
+    eachSpacing = xAxisData.eachSpacing;
+
+  let endY = opts.height - opts.area[2];
+  let calPoints = [];
+
+  var columnIndex = 0;
+  var columnLength = 0;
+  series.forEach(function(eachSeries, seriesIndex) {
+    if (eachSeries.type == 'column') {
+      columnLength += 1;
+    }
+  });
+  context.save();
+	let leftNum=-2;
+	let rightNum=xAxisPoints.length+2;
+	let leftSpace=0;
+	let rightSpace=opts.width+eachSpacing;
+  if (opts._scrollDistance_ && opts._scrollDistance_ !== 0 && opts.enableScroll === true) {
+    context.translate(opts._scrollDistance_, 0);
+		leftNum=Math.floor(-opts._scrollDistance_/eachSpacing)-2;
+		rightNum=leftNum+opts.xAxis.itemCount+4;
+		leftSpace=-opts._scrollDistance_-eachSpacing+opts.area[3];
+		rightSpace=leftSpace+(opts.xAxis.itemCount+4)*eachSpacing;
+  }
+
+  series.forEach(function(eachSeries, seriesIndex) {
+    let ranges,minRange,maxRange;
+    
+		ranges = [].concat(opts.chartData.yAxisData.ranges[eachSeries.index]);
+		minRange = ranges.pop();
+		maxRange = ranges.shift();
+
+    var data = eachSeries.data;
+    var points = getDataPoints(data, minRange, maxRange, xAxisPoints, eachSpacing, opts, config, process);
+    calPoints.push(points);
+
+    // 绘制柱状数据图
+    if (eachSeries.type == 'column') {
+      points = fixColumeData(points, eachSpacing, columnLength, columnIndex, config, opts);
+      for(let i=0;i<points.length;i++){
+      	let item=points[i];
+        if (item !== null && i>leftNum && i<rightNum) {
+          context.beginPath();
+          context.setStrokeStyle(item.color || eachSeries.color);
+          context.setLineWidth(1)
+          context.setFillStyle(item.color || eachSeries.color);
+          var startX = item.x - item.width / 2;
+          var height = opts.height - item.y - opts.area[2];
+          context.moveTo(startX, item.y);
+          context.moveTo(startX, item.y);
+          context.lineTo(startX+item.width-2,item.y);
+          context.lineTo(startX+item.width-2,opts.height - opts.area[2]);
+          context.lineTo(startX,opts.height - opts.area[2]);
+          context.lineTo(startX,item.y);
+          context.closePath();
+          context.stroke();
+          context.fill();
+          context.closePath();
+          context.fill();
+        }
+      }
+      columnIndex += 1;
+    }
+
+    //绘制区域图数据
+
+    if (eachSeries.type == 'area') {
+      let splitPointList = splitPoints(points);
+      for (let i = 0; i < splitPointList.length; i++) {
+        let points = splitPointList[i];
+        // 绘制区域数据
+        context.beginPath();
+        context.setStrokeStyle(eachSeries.color);
+        context.setFillStyle(hexToRgb(eachSeries.color, 0.2));
+        context.setLineWidth(2 * opts.pixelRatio);
+        if (points.length > 1) {
+          var firstPoint = points[0];
+          let lastPoint = points[points.length - 1];
+          context.moveTo(firstPoint.x, firstPoint.y);
+					let startPoint=0;
+          if (eachSeries.style === 'curve') {
+            for(let j=0;j<points.length;j++){
+            	let item=points[j];
+            	if(startPoint==0 && item.x > leftSpace){
+            		context.moveTo(item.x, item.y);
+            		startPoint=1;
+            	}
+              if (j > 0 && item.x > leftSpace && item.x < rightSpace) {
+                var ctrlPoint = createCurveControlPoints(points, j - 1);
+                context.bezierCurveTo(ctrlPoint.ctrA.x, ctrlPoint.ctrA.y, ctrlPoint.ctrB.x, ctrlPoint.ctrB.y, item.x, item.y);
+              }
+            };
+          } else {
+            for(let j=0;j<points.length;j++){
+            	let item=points[j];
+            	if(startPoint==0 && item.x > leftSpace){
+            		context.moveTo(item.x, item.y);
+            		startPoint=1;
+            	}
+              if (j > 0 && item.x > leftSpace && item.x < rightSpace) {
+                context.lineTo(item.x, item.y);
+              }
+            };
+          }
+          context.lineTo(lastPoint.x, endY);
+          context.lineTo(firstPoint.x, endY);
+          context.lineTo(firstPoint.x, firstPoint.y);
+        } else {
+          let item = points[0];
+          context.moveTo(item.x - eachSpacing / 2, item.y);
+          context.lineTo(item.x + eachSpacing / 2, item.y);
+          context.lineTo(item.x + eachSpacing / 2, endY);
+          context.lineTo(item.x - eachSpacing / 2, endY);
+          context.moveTo(item.x - eachSpacing / 2, item.y);
+        }
+        context.closePath();
+        context.fill();
+      }
+    }
+
+    // 绘制折线数据图
+    if (eachSeries.type == 'line') {
+      var splitPointList = splitPoints(points);
+      splitPointList.forEach(function(points, index) {
+				if (eachSeries.lineType == 'dash') {
+					let dashLength = eachSeries.dashLength?eachSeries.dashLength:8;
+					dashLength *= opts.pixelRatio;
+				  context.setLineDash([dashLength, dashLength]);
+				}
+        context.beginPath();
+        context.setStrokeStyle(eachSeries.color);
+        context.setLineWidth(2 * opts.pixelRatio);
+        if (points.length === 1) {
+          context.moveTo(points[0].x, points[0].y);
+          context.arc(points[0].x, points[0].y, 1, 0, 2 * Math.PI);
+        } else {
+          context.moveTo(points[0].x, points[0].y);
+					let startPoint=0;
+          if (eachSeries.style == 'curve') {
+            for(let j=0;j<points.length;j++){
+            	let item=points[j];
+            	if(startPoint==0 && item.x > leftSpace){
+            		context.moveTo(item.x, item.y);
+            		startPoint=1;
+            	}
+              if (j > 0 && item.x > leftSpace && item.x < rightSpace) {
+                var ctrlPoint = createCurveControlPoints(points, j - 1);
+                context.bezierCurveTo(ctrlPoint.ctrA.x, ctrlPoint.ctrA.y, ctrlPoint.ctrB.x, ctrlPoint.ctrB.y,item.x,item.y);
+              }
+            }
+          } else {
+            for(let j=0;j<points.length;j++){
+            	let item=points[j];
+            	if(startPoint==0 && item.x > leftSpace){
+            		context.moveTo(item.x, item.y);
+            		startPoint=1;
+            	}
+              if (j > 0 && item.x > leftSpace && item.x < rightSpace) {
+                context.lineTo(item.x, item.y);
+              }
+            }
+          }
+          context.moveTo(points[0].x, points[0].y);
+        }
+        context.stroke();
+				context.setLineDash([]);
+      });
+    }
+
+    // 绘制点数据图
+    if (eachSeries.type == 'point') {
+			eachSeries.addPoint = true;
+    }
+
+    if (eachSeries.addPoint == true && eachSeries.type !== 'column' ) {
+      drawPointShape(points, eachSeries.color, eachSeries.pointShape, context, opts);
+    }
+  });
+  if (opts.dataLabel !== false && process === 1) {
+    var columnIndex = 0;
+    series.forEach(function(eachSeries, seriesIndex) {
+      let ranges,minRange,maxRange;
+      
+			ranges = [].concat(opts.chartData.yAxisData.ranges[eachSeries.index]);
+			minRange = ranges.pop();
+			maxRange = ranges.shift();
+				
+      var data = eachSeries.data;
+      var points = getDataPoints(data, minRange, maxRange, xAxisPoints, eachSpacing, opts, config, process);
+      if (eachSeries.type !== 'column') {
+        drawPointText(points, eachSeries, config, context);
+      } else {
+        points = fixColumeData(points, eachSpacing, columnLength, columnIndex, config, opts);
+        drawPointText(points, eachSeries, config, context);
+        columnIndex += 1;
+      }
+
+    });
+  }
+
+  context.restore();
+
+  return {
+    xAxisPoints: xAxisPoints,
+    calPoints: calPoints,
+    eachSpacing: eachSpacing,
+  }
+}
+
+function drawToolTipBridge(opts, config, context, process, eachSpacing, xAxisPoints) {
+  var toolTipOption = opts.extra.tooltip || {};
+  if (toolTipOption.horizentalLine && opts.tooltip && process === 1 && (opts.type == 'line' || opts.type == 'area' || opts.type == 'column' || opts.type == 'candle' || opts.type == 'mix')) {
+    drawToolTipHorizentalLine(opts, config, context, eachSpacing, xAxisPoints)
+  }
+  context.save();
+  if (opts._scrollDistance_ && opts._scrollDistance_ !== 0 && opts.enableScroll === true) {
+    context.translate(opts._scrollDistance_, 0);
+  }
+  if (opts.tooltip && opts.tooltip.textList && opts.tooltip.textList.length && process === 1) {
+    drawToolTip(opts.tooltip.textList, opts.tooltip.offset, opts, config, context, eachSpacing, xAxisPoints);
+  }
+  context.restore();
+
+}
+
+function drawXAxis(categories, opts, config, context) {
+
+  let xAxisData = opts.chartData.xAxisData,
+    xAxisPoints = xAxisData.xAxisPoints,
+    startX = xAxisData.startX,
+    endX = xAxisData.endX,
+    eachSpacing = xAxisData.eachSpacing;
+  var boundaryGap='center';
+  if (opts.type == 'line'||opts.type == 'area'){
+    boundaryGap=opts.xAxis.boundaryGap;
+  }
+  var startY = opts.height - opts.area[2];
+  var endY = opts.area[0];
+
+  //绘制滚动条
+  if (opts.enableScroll && opts.xAxis.scrollShow) {
+    var scrollY = opts.height - opts.area[2] + config.xAxisHeight;
+    var scrollScreenWidth = endX - startX;
+    var scrollTotalWidth = eachSpacing * (xAxisPoints.length - 1);
+    var scrollWidth = scrollScreenWidth * scrollScreenWidth / scrollTotalWidth;
+    var scrollLeft = 0;
+    if (opts._scrollDistance_) {
+      scrollLeft = -opts._scrollDistance_ * (scrollScreenWidth) / scrollTotalWidth;
+    }
+    context.beginPath();
+    context.setLineCap('round');
+    context.setLineWidth(6 * opts.pixelRatio);
+    context.setStrokeStyle(opts.xAxis.scrollBackgroundColor || "#EFEBEF");
+    context.moveTo(startX, scrollY);
+    context.lineTo(endX, scrollY);
+    context.stroke();
+    context.closePath();
+    context.beginPath();
+    context.setLineCap('round');
+    context.setLineWidth(6 * opts.pixelRatio);
+    context.setStrokeStyle(opts.xAxis.scrollColor || "#A6A6A6");
+    context.moveTo(startX + scrollLeft, scrollY);
+    context.lineTo(startX + scrollLeft + scrollWidth, scrollY);
+    context.stroke();
+    context.closePath();
+    context.setLineCap('butt');
+  }
+
+  context.save();
+
+  if (opts._scrollDistance_ && opts._scrollDistance_ !== 0) {
+    context.translate(opts._scrollDistance_, 0);
+  }
+	
+	//绘制X轴刻度线
+	if (opts.xAxis.calibration === true) {
+		context.setStrokeStyle(opts.xAxis.gridColor || "#cccccc");
+		context.setLineCap('butt');
+		context.setLineWidth(1 * opts.pixelRatio);
+	  xAxisPoints.forEach(function(item, index) {
+	    if (index > 0) {
+	      context.beginPath();
+	      context.moveTo(item - eachSpacing / 2, startY);
+	      context.lineTo(item - eachSpacing / 2, startY + 3 * opts.pixelRatio);
+	      context.closePath();
+	      context.stroke();
+	    }
+	  });
+	}
+	//绘制X轴网格
+  if (opts.xAxis.disableGrid !== true) {
+    context.setStrokeStyle(opts.xAxis.gridColor || "#cccccc");
+    context.setLineCap('butt');
+    context.setLineWidth(1 * opts.pixelRatio);
+    if (opts.xAxis.gridType == 'dash') {
+      context.setLineDash([opts.xAxis.dashLength, opts.xAxis.dashLength]);
+    }
+		opts.xAxis.gridEval = opts.xAxis.gridEval || 1;
+		xAxisPoints.forEach(function(item, index) {
+			if (index % opts.xAxis.gridEval == 0) {
+				context.beginPath();
+				context.moveTo(item, startY);
+				context.lineTo(item, endY);
+				context.stroke();
+			}
+		});
+    context.setLineDash([]);
+  }
+  
+
+  //绘制X轴文案
+  if (opts.xAxis.disabled !== true) {
+    // 对X轴列表做抽稀处理
+    //默认全部显示X轴标签
+    let maxXAxisListLength = categories.length;
+    //如果设置了X轴单屏数量
+    if (opts.xAxis.labelCount) {
+      //如果设置X轴密度
+      if (opts.xAxis.itemCount) {
+        maxXAxisListLength = Math.ceil(categories.length / opts.xAxis.itemCount * opts.xAxis.labelCount);
+      } else {
+        maxXAxisListLength = opts.xAxis.labelCount;
+      }
+      maxXAxisListLength -= 1;
+    }
+
+    let ratio = Math.ceil(categories.length / maxXAxisListLength);
+
+    let newCategories = [];
+    let cgLength = categories.length;
+    for (let i = 0; i < cgLength; i++) {
+      if (i % ratio !== 0) {
+        newCategories.push("");
+      } else {
+        newCategories.push(categories[i]);
+      }
+    }
+    newCategories[cgLength - 1] = categories[cgLength - 1];
+
+    var xAxisFontSize = opts.xAxis.fontSize || config.fontSize;
+    if (config._xAxisTextAngle_ === 0) {
+      newCategories.forEach(function(item, index) {
+        var offset = - measureText(String(item), xAxisFontSize) / 2;
+        if(boundaryGap == 'center'){
+          offset+=eachSpacing / 2;
+        }
+        var scrollHeight=0;
+        if(opts.xAxis.scrollShow){
+          scrollHeight=6*opts.pixelRatio;
+        }
+        context.beginPath();
+        context.setFontSize(xAxisFontSize);
+        context.setFillStyle(opts.xAxis.fontColor || '#666666');
+        context.fillText(String(item), xAxisPoints[index] + offset, startY + xAxisFontSize + (config.xAxisHeight - scrollHeight - xAxisFontSize) / 2);
+        context.closePath();
+        context.stroke();
+      });
+
+    } else {
+      newCategories.forEach(function(item, index) {
+        context.save();
+        context.beginPath();
+        context.setFontSize(xAxisFontSize);
+        context.setFillStyle(opts.xAxis.fontColor || '#666666');
+        var textWidth = measureText(String(item),xAxisFontSize);
+        var offset = - textWidth;
+        if(boundaryGap == 'center'){
+          offset+=eachSpacing / 2;
+        }
+        var _calRotateTranslate = calRotateTranslate(xAxisPoints[index] + eachSpacing / 2, startY + xAxisFontSize / 2 + 5, opts.height),
+          transX = _calRotateTranslate.transX,
+          transY = _calRotateTranslate.transY;
+
+        context.rotate(-1 * config._xAxisTextAngle_);
+        context.translate(transX, transY);
+        context.fillText(String(item), xAxisPoints[index] + offset, startY + xAxisFontSize + 5);
+        context.closePath();
+        context.stroke();
+        context.restore();
+      });
+    }
+  }
+  context.restore();
+	
+	//绘制X轴轴线
+  if(opts.xAxis.axisLine){
+    context.beginPath();
+    context.setStrokeStyle(opts.xAxis.axisLineColor);
+    context.setLineWidth(1 * opts.pixelRatio);
+    context.moveTo(startX,opts.height-opts.area[2]);
+    context.lineTo(endX,opts.height-opts.area[2]);
+    context.stroke();
+  }
+}
+
+function drawYAxisGrid(categories, opts, config, context) {
+  if (opts.yAxis.disableGrid === true) {
+    return;
+  }
+  let spacingValid = opts.height - opts.area[0] - opts.area[2];
+  let eachSpacing = spacingValid / opts.yAxis.splitNumber;
+  let startX = opts.area[3];
+  let xAxisPoints = opts.chartData.xAxisData.xAxisPoints,
+    xAxiseachSpacing = opts.chartData.xAxisData.eachSpacing;
+  let TotalWidth = xAxiseachSpacing * (xAxisPoints.length - 1);
+  let endX = startX + TotalWidth;
+
+  let points = [];
+  for (let i = 0; i < opts.yAxis.splitNumber + 1; i++) {
+    points.push(opts.height - opts.area[2] - eachSpacing * i);
+  }
+
+  context.save();
+  if (opts._scrollDistance_ && opts._scrollDistance_ !== 0) {
+    context.translate(opts._scrollDistance_, 0);
+  }
+
+  if (opts.yAxis.gridType == 'dash') {
+    context.setLineDash([opts.yAxis.dashLength, opts.yAxis.dashLength]);
+  }
+  context.setStrokeStyle(opts.yAxis.gridColor);
+  context.setLineWidth(1 * opts.pixelRatio);
+  points.forEach(function(item, index) {
+    context.beginPath();
+    context.moveTo(startX, item);
+    context.lineTo(endX, item);
+    context.stroke();
+  });
+  context.setLineDash([]);
+
+  context.restore();
+}
+
+function drawYAxis(series, opts, config, context) {
+  if (opts.yAxis.disabled === true) {
+    return;
+  }
+  var spacingValid = opts.height - opts.area[0] - opts.area[2];
+  var eachSpacing = spacingValid / opts.yAxis.splitNumber;
+  var startX = opts.area[3];
+  var endX = opts.width - opts.area[1];
+  var endY = opts.height - opts.area[2];
+  var fillEndY = endY + config.xAxisHeight;
+  if (opts.xAxis.scrollShow) {
+    fillEndY -= 3 * opts.pixelRatio;
+  }
+	if (opts.xAxis.rotateLabel){
+		fillEndY = opts.height - opts.area[2]+3;
+	}
+  // set YAxis background
+  context.beginPath();
+  context.setFillStyle(opts.background || '#ffffff');
+  if (opts._scrollDistance_ < 0) {
+    context.fillRect(0, 0, startX, fillEndY);
+  }
+  if(opts.enableScroll == true){
+    context.fillRect(endX, 0, opts.width, fillEndY);
+  }
+  context.closePath();
+  context.stroke();
+
+  var points = [];
+  for (let i = 0; i <= opts.yAxis.splitNumber; i++) {
+    points.push(opts.area[0] + eachSpacing * i);
+  }
+
+  let tStartLeft=opts.area[3];
+  let tStartRight=opts.width-opts.area[1];
+
+  for (let i = 0; i < opts.yAxis.data.length; i++) {
+    let yData = opts.yAxis.data[i];
+    if(yData.disabled !== true){
+      let rangesFormat = opts.chartData.yAxisData.rangesFormat[i];
+      let yAxisFontSize = yData.fontSize || config.fontSize;
+      let yAxisWidth = opts.chartData.yAxisData.yAxisWidth[i];
+      //画Y轴刻度及文案
+      rangesFormat.forEach(function(item, index) {
+        var pos = points[index] ? points[index] : endY;
+        context.beginPath();
+        context.setFontSize(yAxisFontSize);
+        context.setLineWidth(1*opts.pixelRatio);
+        context.setStrokeStyle(yData.axisLineColor||'#cccccc');
+        context.setFillStyle(yData.fontColor|| '#666666');
+        if(yAxisWidth.position=='left'){
+          context.fillText(String(item), tStartLeft - yAxisWidth.width , pos + yAxisFontSize / 2);
+          //画刻度线
+          if(yData.calibration==true){
+            context.moveTo(tStartLeft,pos);
+            context.lineTo(tStartLeft - 3*opts.pixelRatio,pos);
+          }
+        }else{
+          context.fillText(String(item), tStartRight + 4*opts.pixelRatio, pos + yAxisFontSize / 2);
+          //画刻度线
+          if(yData.calibration==true){
+            context.moveTo(tStartRight,pos);
+            context.lineTo(tStartRight + 3*opts.pixelRatio,pos);
+          }
+        }
+        context.closePath();
+        context.stroke();
+      });
+      //画Y轴轴线
+      if (yData.axisLine!==false) {
+        context.beginPath();
+        context.setStrokeStyle(yData.axisLineColor||'#cccccc');
+        context.setLineWidth(1 * opts.pixelRatio);
+        if(yAxisWidth.position=='left'){
+          context.moveTo(tStartLeft,opts.height-opts.area[2]);
+          context.lineTo(tStartLeft,opts.area[0]);
+        }else{
+          context.moveTo(tStartRight,opts.height-opts.area[2]);
+          context.lineTo(tStartRight,opts.area[0]);
+        }
+        context.stroke();
+      }
+			
+      //画Y轴标题
+      if (opts.yAxis.showTitle) {
+				
+        let titleFontSize = yData.titleFontSize || config.fontSize;
+        let title = yData.title;
+        context.beginPath();
+        context.setFontSize(titleFontSize);
+        context.setFillStyle(yData.titleFontColor || '#666666');
+        if(yAxisWidth.position=='left'){
+          context.fillText(title, tStartLeft - measureText(title,titleFontSize)/2, opts.area[0]-10*opts.pixelRatio);
+        }else{
+          context.fillText(title,tStartRight - measureText(title,titleFontSize)/2, opts.area[0]-10*opts.pixelRatio);
+        }
+        context.closePath();
+        context.stroke();
+      }
+      if(yAxisWidth.position=='left'){
+        tStartLeft -=(yAxisWidth.width + opts.yAxis.padding);
+      }else{
+        tStartRight +=yAxisWidth.width+ opts.yAxis.padding;
+      }
+    }
+  }
+}
+
+function drawLegend(series, opts, config, context, chartData) {
+  if (opts.legend.show === false) {
+    return;
+  }
+  let legendData = chartData.legendData;
+  let legendList = legendData.points;
+  let legendArea = legendData.area;
+  let padding = opts.legend.padding;
+  let fontSize = opts.legend.fontSize;
+  let shapeWidth = 15 * opts.pixelRatio;
+  let shapeRight = 5 * opts.pixelRatio;
+  let itemGap = opts.legend.itemGap;
+  let lineHeight = Math.max(opts.legend.lineHeight * opts.pixelRatio, fontSize);
+
+  //画背景及边框
+  context.beginPath();
+  context.setLineWidth(opts.legend.borderWidth);
+  context.setStrokeStyle(opts.legend.borderColor);
+  context.setFillStyle(opts.legend.backgroundColor);
+  context.moveTo(legendArea.start.x, legendArea.start.y);
+  context.rect(legendArea.start.x, legendArea.start.y, legendArea.width, legendArea.height);
+  context.closePath();
+  context.fill();
+  context.stroke();
+
+  legendList.forEach(function(itemList, listIndex) {
+    let width = 0;
+    let height = 0;
+    width = legendData.widthArr[listIndex];
+    height = legendData.heightArr[listIndex];
+    let startX = 0;
+    let startY = 0;
+    if (opts.legend.position == 'top' || opts.legend.position == 'bottom') {
+      startX = legendArea.start.x + (legendArea.width - width) / 2;
+      startY = legendArea.start.y + padding + listIndex * lineHeight;
+    } else {
+      if (listIndex == 0) {
+        width = 0;
+      } else {
+        width = legendData.widthArr[listIndex - 1];
+      }
+      startX = legendArea.start.x + padding + width;
+      startY = legendArea.start.y + padding + (legendArea.height - height) / 2;
+    }
+
+    context.setFontSize(config.fontSize);
+    for (let i = 0; i < itemList.length; i++) {
+      let item = itemList[i];
+      item.area = [0, 0, 0, 0];
+      item.area[0] = startX;
+      item.area[1] = startY;
+      item.area[3] = startY + lineHeight;
+      context.beginPath();
+      context.setLineWidth(1 * opts.pixelRatio);
+      context.setStrokeStyle(item.show ? item.color : opts.legend.hiddenColor);
+      context.setFillStyle(item.show ? item.color : opts.legend.hiddenColor);
+      switch (item.legendShape) {
+        case 'line':
+          context.moveTo(startX, startY + 0.5 * lineHeight - 2 * opts.pixelRatio);
+          context.fillRect(startX, startY + 0.5 * lineHeight - 2 * opts.pixelRatio, 15 * opts.pixelRatio, 4 * opts.pixelRatio);
+          break;
+        case 'triangle':
+          context.moveTo(startX + 7.5 * opts.pixelRatio, startY + 0.5 * lineHeight - 5 * opts.pixelRatio);
+          context.lineTo(startX + 2.5 * opts.pixelRatio, startY + 0.5 * lineHeight + 5 * opts.pixelRatio);
+          context.lineTo(startX + 12.5 * opts.pixelRatio, startY + 0.5 * lineHeight + 5 * opts.pixelRatio);
+          context.lineTo(startX + 7.5 * opts.pixelRatio, startY + 0.5 * lineHeight - 5 * opts.pixelRatio);
+          break;
+        case 'diamond':
+          context.moveTo(startX + 7.5 * opts.pixelRatio, startY + 0.5 * lineHeight - 5 * opts.pixelRatio);
+          context.lineTo(startX + 2.5 * opts.pixelRatio, startY + 0.5 * lineHeight);
+          context.lineTo(startX + 7.5 * opts.pixelRatio, startY + 0.5 * lineHeight + 5 * opts.pixelRatio);
+          context.lineTo(startX + 12.5 * opts.pixelRatio, startY + 0.5 * lineHeight);
+          context.lineTo(startX + 7.5 * opts.pixelRatio, startY + 0.5 * lineHeight - 5 * opts.pixelRatio);
+          break;
+        case 'circle':
+          context.moveTo(startX + 7.5 * opts.pixelRatio, startY + 0.5 * lineHeight);
+          context.arc(startX + 7.5 * opts.pixelRatio, startY + 0.5 * lineHeight, 5 * opts.pixelRatio, 0, 2 * Math.PI);
+          break;
+        case 'rect':
+          context.moveTo(startX, startY + 0.5 * lineHeight - 5 * opts.pixelRatio);
+          context.fillRect(startX, startY + 0.5 * lineHeight - 5 * opts.pixelRatio, 15 * opts.pixelRatio, 10 * opts.pixelRatio);
+          break;
+        default:
+          context.moveTo(startX, startY + 0.5 * lineHeight - 5 * opts.pixelRatio);
+          context.fillRect(startX, startY + 0.5 * lineHeight - 5 * opts.pixelRatio, 15 * opts.pixelRatio, 10 * opts.pixelRatio);
+      }
+      context.closePath();
+      context.fill();
+      context.stroke();
+
+      startX += shapeWidth + shapeRight;
+      let fontTrans = 0.5 * lineHeight + 0.5 * fontSize - 2;
+      context.beginPath();
+      context.setFontSize(fontSize);
+      context.setFillStyle(item.show ? opts.legend.fontColor : opts.legend.hiddenColor);
+      context.fillText(item.name, startX, startY + fontTrans);
+      context.closePath();
+      context.stroke();
+      if (opts.legend.position == 'top' || opts.legend.position == 'bottom') {
+        startX += measureText(item.name, fontSize) + itemGap;
+        item.area[2] = startX;
+      } else {
+        item.area[2] = startX + measureText(item.name, fontSize) + itemGap;;
+        startX -= shapeWidth + shapeRight;
+        startY += lineHeight;
+      }
+    }
+  });
+}
+
+function drawPieDataPoints(series, opts, config, context) {
+  var process = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : 1;
+  var pieOption = assign({}, {
+    activeOpacity: 0.5,
+    activeRadius: 10 * opts.pixelRatio,
+    offsetAngle: 0,
+    labelWidth: 15 * opts.pixelRatio,
+    ringWidth: 0,
+    border:false,
+    borderWidth:2,
+    borderColor:'#FFFFFF'
+  }, opts.extra.pie);
+  var centerPosition = {
+    x: opts.area[3] + (opts.width - opts.area[1] - opts.area[3]) / 2,
+    y: opts.area[0] + (opts.height - opts.area[0] - opts.area[2]) / 2
+  };
+  if (config.pieChartLinePadding == 0) {
+    config.pieChartLinePadding = pieOption.activeRadius;
+  }
+
+  var radius = Math.min((opts.width - opts.area[1] - opts.area[3]) / 2 - config.pieChartLinePadding - config.pieChartTextPadding - config._pieTextMaxLength_, (opts.height - opts.area[0] - opts.area[2]) / 2 - config.pieChartLinePadding - config.pieChartTextPadding);
+
+  series = getPieDataPoints(series, radius, process);
+
+  var activeRadius = pieOption.activeRadius;
+
+  series = series.map(function(eachSeries) {
+    eachSeries._start_ += (pieOption.offsetAngle) * Math.PI / 180;
+    return eachSeries;
+  });
+  series.forEach(function(eachSeries, seriesIndex) {
+    if (opts.tooltip) {
+      if (opts.tooltip.index == seriesIndex) {
+        context.beginPath();
+        context.setFillStyle(hexToRgb(eachSeries.color, opts.extra.pie.activeOpacity || 0.5));
+        context.moveTo(centerPosition.x, centerPosition.y);
+        context.arc(centerPosition.x, centerPosition.y, eachSeries._radius_ + activeRadius, eachSeries._start_,
+          eachSeries._start_ + 2 *
+          eachSeries._proportion_ * Math.PI);
+        context.closePath();
+        context.fill();
+      }
+    }
+    context.beginPath();
+    context.setLineWidth(pieOption.borderWidth * opts.pixelRatio);
+    context.lineJoin = "round";
+    context.setStrokeStyle(pieOption.borderColor);
+    context.setFillStyle(eachSeries.color);
+    context.moveTo(centerPosition.x, centerPosition.y);
+    context.arc(centerPosition.x, centerPosition.y, eachSeries._radius_, eachSeries._start_, eachSeries._start_ + 2 * eachSeries._proportion_ * Math.PI);
+    context.closePath();
+    context.fill();
+    if (pieOption.border == true) {
+      context.stroke();
+    }
+  });
+
+  if (opts.type === 'ring') {
+    var innerPieWidth = radius * 0.6;
+    if (typeof opts.extra.pie.ringWidth === 'number' && opts.extra.pie.ringWidth > 0) {
+      innerPieWidth = Math.max(0, radius - opts.extra.pie.ringWidth);
+    }
+    context.beginPath();
+    context.setFillStyle(opts.background || '#ffffff');
+    context.moveTo(centerPosition.x, centerPosition.y);
+    context.arc(centerPosition.x, centerPosition.y, innerPieWidth, 0, 2 * Math.PI);
+    context.closePath();
+    context.fill();
+  }
+
+  if (opts.dataLabel !== false && process === 1) {
+    var valid = false;
+    for (var i = 0, len = series.length; i < len; i++) {
+      if (series[i].data > 0) {
+        valid = true;
+        break;
+      }
+    }
+
+    if (valid) {
+      drawPieText(series, opts, config, context, radius, centerPosition);
+    }
+  }
+
+  if (process === 1 && opts.type === 'ring') {
+    drawRingTitle(opts, config, context, centerPosition);
+  }
+
+  return {
+    center: centerPosition,
+    radius: radius,
+    series: series
+  };
+}
+
+function drawRoseDataPoints(series, opts, config, context) {
+  var process = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : 1;
+  var roseOption = assign({}, {
+    type: 'area',
+    activeOpacity: 0.5,
+    activeRadius: 10 * opts.pixelRatio,
+    offsetAngle: 0,
+    labelWidth: 15 * opts.pixelRatio,
+    border:false,
+    borderWidth:2,
+    borderColor:'#FFFFFF'
+  }, opts.extra.rose);
+  if (config.pieChartLinePadding == 0) {
+    config.pieChartLinePadding = roseOption.activeRadius;
+  }
+  var centerPosition = {
+    x: opts.area[3] + (opts.width - opts.area[1] - opts.area[3]) / 2,
+    y: opts.area[0] + (opts.height - opts.area[0] - opts.area[2]) / 2
+  };
+   var radius = Math.min((opts.width - opts.area[1] - opts.area[3]) / 2 - config.pieChartLinePadding - config.pieChartTextPadding - config._pieTextMaxLength_, (opts.height - opts.area[0] - opts.area[2]) / 2 - config.pieChartLinePadding - config.pieChartTextPadding);
+  var minRadius = roseOption.minRadius || radius * 0.5;
+
+  series = getRoseDataPoints(series, roseOption.type, minRadius, radius, process);
+
+  var activeRadius = roseOption.activeRadius;
+
+  series = series.map(function(eachSeries) {
+    eachSeries._start_ += (roseOption.offsetAngle || 0) * Math.PI / 180;
+    return eachSeries;
+  });
+
+  series.forEach(function(eachSeries, seriesIndex) {
+    if (opts.tooltip) {
+      if (opts.tooltip.index == seriesIndex) {
+        context.beginPath();
+        context.setFillStyle(hexToRgb(eachSeries.color, roseOption.activeOpacity || 0.5));
+        context.moveTo(centerPosition.x, centerPosition.y);
+        context.arc(centerPosition.x, centerPosition.y, activeRadius + eachSeries._radius_, eachSeries._start_,
+          eachSeries._start_ + 2 * eachSeries._rose_proportion_ * Math.PI);
+        context.closePath();
+        context.fill();
+      }
+    }
+    context.beginPath();
+    context.setLineWidth(roseOption.borderWidth * opts.pixelRatio);
+    context.lineJoin = "round";
+    context.setStrokeStyle(roseOption.borderColor);
+    context.setFillStyle(eachSeries.color);
+    context.moveTo(centerPosition.x, centerPosition.y);
+    context.arc(centerPosition.x, centerPosition.y, eachSeries._radius_, eachSeries._start_, eachSeries._start_ + 2 *
+      eachSeries._rose_proportion_ * Math.PI);
+    context.closePath();
+    context.fill();
+    if (roseOption.border == true) {
+      context.stroke();
+    }
+  });
+
+  if (opts.dataLabel !== false && process === 1) {
+    var valid = false;
+    for (var i = 0, len = series.length; i < len; i++) {
+      if (series[i].data > 0) {
+        valid = true;
+        break;
+      }
+    }
+
+    if (valid) {
+      drawPieText(series, opts, config, context, radius, centerPosition);
+    }
+  }
+
+  return {
+    center: centerPosition,
+    radius: radius,
+    series: series
+  };
+}
+
+function drawArcbarDataPoints(series, opts, config, context) {
+  var process = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : 1;
+  var arcbarOption = assign({}, {
+    startAngle: 0.75,
+    endAngle: 0.25,
+    type: 'default',
+    width: 12 * opts.pixelRatio,
+		gap:2 * opts.pixelRatio
+  }, opts.extra.arcbar);
+
+  series = getArcbarDataPoints(series, arcbarOption, process);
+	
+  var centerPosition;
+	if(arcbarOption.center){
+		centerPosition=arcbarOption.center;
+	}else{
+		centerPosition= {
+		  x: opts.width / 2,
+		  y: opts.height / 2
+		};
+	}
+	
+  var radius;
+	if(arcbarOption.radius){
+		radius=arcbarOption.radius;
+	}else{
+		radius = Math.min(centerPosition.x, centerPosition.y);
+		radius -= 5 * opts.pixelRatio;
+		radius -= arcbarOption.width / 2;
+	}
+	
+  for (let i = 0; i < series.length; i++) {
+    let eachSeries = series[i];
+		//背景颜色
+		context.setLineWidth(arcbarOption.width);
+		context.setStrokeStyle(arcbarOption.backgroundColor || '#E9E9E9');
+		context.setLineCap('round');
+		context.beginPath();
+		if (arcbarOption.type == 'default') {
+		  context.arc(centerPosition.x, centerPosition.y, radius-(arcbarOption.width+arcbarOption.gap)*i, arcbarOption.startAngle * Math.PI, arcbarOption.endAngle * Math.PI, false);
+		} else {
+		  context.arc(centerPosition.x, centerPosition.y, radius-(arcbarOption.width+arcbarOption.gap)*i, 0, 2 * Math.PI, false);
+		}
+		context.stroke();
+		//进度条
+    context.setLineWidth(arcbarOption.width);
+    context.setStrokeStyle(eachSeries.color);
+    context.setLineCap('round');
+    context.beginPath();
+    context.arc(centerPosition.x, centerPosition.y, radius-(arcbarOption.width+arcbarOption.gap)*i, arcbarOption.startAngle * Math.PI, eachSeries._proportion_ * Math.PI, false);
+    context.stroke();
+  }
+
+  drawRingTitle(opts, config, context, centerPosition);
+
+  return {
+    center: centerPosition,
+    radius: radius,
+    series: series
+  };
+}
+
+function drawGaugeDataPoints(categories, series, opts, config, context) {
+  var process = arguments.length > 5 && arguments[5] !== undefined ? arguments[5] : 1;
+  var gaugeOption = assign({}, {
+		type:'default',
+    startAngle: 0.75,
+    endAngle: 0.25,
+    width: 15,
+    splitLine: {
+      fixRadius: 0,
+      splitNumber: 10,
+      width: 15,
+      color: '#FFFFFF',
+      childNumber: 5,
+      childWidth: 5
+    },
+    pointer: {
+      width: 15,
+      color: 'auto'
+    }
+  }, opts.extra.gauge);
+
+  if (gaugeOption.oldAngle == undefined) {
+    gaugeOption.oldAngle = gaugeOption.startAngle;
+  }
+  if (gaugeOption.oldData == undefined) {
+    gaugeOption.oldData = 0;
+  }
+  categories = getGaugeAxisPoints(categories, gaugeOption.startAngle, gaugeOption.endAngle);
+
+  var centerPosition = {
+    x: opts.width / 2,
+    y: opts.height / 2
+  };
+  var radius = Math.min(centerPosition.x, centerPosition.y);
+  radius -= 5 * opts.pixelRatio;
+  radius -= gaugeOption.width / 2;
+  var innerRadius = radius - gaugeOption.width;
+	var totalAngle=0;
+	
+	//判断仪表盘的样式:default百度样式,progress新样式
+	if(gaugeOption.type == 'progress'){
+		
+		//## 第一步画中心圆形背景和进度条背景
+		//中心圆形背景
+		var pieRadius = radius - gaugeOption.width*3;
+		context.beginPath();
+		let gradient = context.createLinearGradient(centerPosition.x, centerPosition.y-pieRadius, centerPosition.x , centerPosition.y+pieRadius);
+		//配置渐变填充(起点:中心点向上减半径;结束点中心点向下加半径)
+		gradient.addColorStop('0', hexToRgb(series[0].color, 0.3));
+		gradient.addColorStop('1.0',hexToRgb("#FFFFFF", 0.1));
+		context.setFillStyle(gradient);
+		context.arc(centerPosition.x, centerPosition.y, pieRadius, 0, 2*Math.PI, false);
+		context.fill();
+		//画进度条背景
+		context.setLineWidth(gaugeOption.width);
+		context.setStrokeStyle(hexToRgb(series[0].color, 0.3));
+		context.setLineCap('round');
+		context.beginPath();
+		context.arc(centerPosition.x, centerPosition.y, innerRadius , gaugeOption.startAngle * Math.PI, gaugeOption.endAngle *Math.PI, false);
+		context.stroke();
+		
+		//## 第二步画刻度线
+		totalAngle = gaugeOption.startAngle - gaugeOption.endAngle + 1;
+		let splitAngle = totalAngle / gaugeOption.splitLine.splitNumber;
+		let childAngle = totalAngle / gaugeOption.splitLine.splitNumber / gaugeOption.splitLine.childNumber;
+		let startX = -radius - gaugeOption.width * 0.5 - gaugeOption.splitLine.fixRadius;
+		let endX = -radius - gaugeOption.width - gaugeOption.splitLine.fixRadius + gaugeOption.splitLine.width;
+		context.save();
+		context.translate(centerPosition.x, centerPosition.y);
+		context.rotate((gaugeOption.startAngle - 1) * Math.PI);
+		let len = gaugeOption.splitLine.splitNumber * gaugeOption.splitLine.childNumber + 1;
+		let proc = series[0].data * process;
+		for (let i = 0; i < len; i++) {
+		  context.beginPath();
+			//刻度线随进度变色
+			if(proc>(i/len)){
+				context.setStrokeStyle(hexToRgb(series[0].color, 1));
+			}else{
+				context.setStrokeStyle(hexToRgb(series[0].color, 0.3));
+			}
+		  context.setLineWidth(3 * opts.pixelRatio);
+		  context.moveTo(startX, 0);
+		  context.lineTo(endX, 0);
+		  context.stroke();
+		  context.rotate(childAngle * Math.PI);
+		}
+		context.restore();
+		
+		//## 第三步画进度条
+		series = getArcbarDataPoints(series, gaugeOption, process);
+		context.setLineWidth(gaugeOption.width);
+		context.setStrokeStyle(series[0].color);
+		context.setLineCap('round');
+		context.beginPath();
+		context.arc(centerPosition.x, centerPosition.y, innerRadius , gaugeOption.startAngle * Math.PI, series[0]._proportion_ *Math.PI, false);
+		context.stroke();
+		
+		//## 第四步画指针
+		let pointerRadius = radius - gaugeOption.width*2.5;
+		context.save();
+		context.translate(centerPosition.x, centerPosition.y);
+		context.rotate((series[0]._proportion_ - 1) * Math.PI);
+		context.beginPath();
+		context.setLineWidth(gaugeOption.width/3);
+		let gradient3 = context.createLinearGradient(0, -pointerRadius*0.6, 0 , pointerRadius*0.6);
+		gradient3.addColorStop('0', hexToRgb('#FFFFFF', 0));
+		gradient3.addColorStop('0.5', hexToRgb(series[0].color, 1));
+		gradient3.addColorStop('1.0', hexToRgb('#FFFFFF', 0));
+		context.setStrokeStyle(gradient3);
+		context.arc(0, 0, pointerRadius , 0.85* Math.PI, 1.15 * Math.PI, false);
+		context.stroke();
+		context.beginPath();
+		context.setLineWidth(1);
+		context.setStrokeStyle(series[0].color);
+		context.setFillStyle(series[0].color);
+		context.moveTo(-pointerRadius-gaugeOption.width/3/2,-4);
+		context.lineTo(-pointerRadius-gaugeOption.width/3/2-4,0);
+		context.lineTo(-pointerRadius-gaugeOption.width/3/2,4);
+		context.lineTo(-pointerRadius-gaugeOption.width/3/2,-4);
+		context.stroke();
+		context.fill();
+		context.restore();
+		
+	//default百度样式
+	}else{
+		//画背景
+		context.setLineWidth(gaugeOption.width);
+		context.setLineCap('butt');
+		for (let i = 0; i < categories.length; i++) {
+		  let eachCategories = categories[i];
+		  context.beginPath();
+		  context.setStrokeStyle(eachCategories.color);
+		  context.arc(centerPosition.x, centerPosition.y, radius, eachCategories._startAngle_ * Math.PI, eachCategories._endAngle_ *Math.PI, false);
+		  context.stroke();
+		}
+		context.save();
+		
+		//画刻度线
+		totalAngle = gaugeOption.startAngle - gaugeOption.endAngle + 1;
+		let splitAngle = totalAngle / gaugeOption.splitLine.splitNumber;
+		let childAngle = totalAngle / gaugeOption.splitLine.splitNumber / gaugeOption.splitLine.childNumber;
+		let startX = -radius - gaugeOption.width * 0.5 - gaugeOption.splitLine.fixRadius;
+		let endX = -radius - gaugeOption.width * 0.5 - gaugeOption.splitLine.fixRadius + gaugeOption.splitLine.width;
+		let childendX = -radius - gaugeOption.width * 0.5 - gaugeOption.splitLine.fixRadius + gaugeOption.splitLine.childWidth;
+		
+		context.translate(centerPosition.x, centerPosition.y);
+		context.rotate((gaugeOption.startAngle - 1) * Math.PI);
+		
+		for (let i = 0; i < gaugeOption.splitLine.splitNumber + 1; i++) {
+		  context.beginPath();
+		  context.setStrokeStyle(gaugeOption.splitLine.color);
+		  context.setLineWidth(2 * opts.pixelRatio);
+		  context.moveTo(startX, 0);
+		  context.lineTo(endX, 0);
+		  context.stroke();
+		  context.rotate(splitAngle * Math.PI);
+		}
+		context.restore();
+		
+		context.save();
+		context.translate(centerPosition.x, centerPosition.y);
+		context.rotate((gaugeOption.startAngle - 1) * Math.PI);
+		
+		for (let i = 0; i < gaugeOption.splitLine.splitNumber * gaugeOption.splitLine.childNumber + 1; i++) {
+		  context.beginPath();
+		  context.setStrokeStyle(gaugeOption.splitLine.color);
+		  context.setLineWidth(1 * opts.pixelRatio);
+		  context.moveTo(startX, 0);
+		  context.lineTo(childendX, 0);
+		  context.stroke();
+		  context.rotate(childAngle * Math.PI);
+		}
+		context.restore();
+		
+		//画指针
+		series = getGaugeDataPoints(series, categories, gaugeOption, process);
+		
+		for (let i = 0; i < series.length; i++) {
+		  let eachSeries = series[i];
+		  context.save();
+		  context.translate(centerPosition.x, centerPosition.y);
+		  context.rotate((eachSeries._proportion_ - 1) * Math.PI);
+		  context.beginPath();
+		  context.setFillStyle(eachSeries.color);
+		  context.moveTo(gaugeOption.pointer.width, 0);
+		  context.lineTo(0, -gaugeOption.pointer.width / 2);
+		  context.lineTo(-innerRadius, 0);
+		  context.lineTo(0, gaugeOption.pointer.width / 2);
+		  context.lineTo(gaugeOption.pointer.width, 0);
+		  context.closePath();
+		  context.fill();
+		  context.beginPath();
+		  context.setFillStyle('#FFFFFF');
+		  context.arc(0, 0, gaugeOption.pointer.width / 6, 0, 2 * Math.PI, false);
+		  context.fill();
+		  context.restore();
+		}
+		
+		if (opts.dataLabel !== false) {
+		  drawGaugeLabel(gaugeOption, radius, centerPosition, opts, config, context);
+		}
+	}
+	
+	//画仪表盘标题,副标题
+  drawRingTitle(opts, config, context, centerPosition);
+
+  if (process === 1 && opts.type === 'gauge') {
+    opts.extra.gauge.oldAngle = series[0]._proportion_;
+    opts.extra.gauge.oldData = series[0].data;
+  }
+  return {
+    center: centerPosition,
+    radius: radius,
+    innerRadius: innerRadius,
+    categories: categories,
+    totalAngle: totalAngle
+  };
+}
+
+function drawRadarDataPoints(series, opts, config, context) {
+  var process = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : 1;
+  var radarOption = assign({},{
+    gridColor: '#cccccc',
+    labelColor: '#666666',
+    opacity: 0.2,
+		gridCount:3
+  },opts.extra.radar);
+  
+  var coordinateAngle = getRadarCoordinateSeries(opts.categories.length);
+  
+  var centerPosition = {
+    x: opts.area[3] + (opts.width - opts.area[1] - opts.area[3]) / 2,
+    y: opts.area[0] + (opts.height - opts.area[0] - opts.area[2]) / 2
+  };
+
+  var radius = Math.min(centerPosition.x - (getMaxTextListLength(opts.categories) + config.radarLabelTextMargin),
+    centerPosition.y - config.radarLabelTextMargin);
+  //TODO逻辑不对
+  radius -= opts.padding[1];
+
+  // draw grid
+  context.beginPath();
+  context.setLineWidth(1 * opts.pixelRatio);
+  context.setStrokeStyle(radarOption.gridColor);
+  coordinateAngle.forEach(function(angle) {
+    var pos = convertCoordinateOrigin(radius * Math.cos(angle), radius * Math.sin(angle), centerPosition);
+    context.moveTo(centerPosition.x, centerPosition.y);
+    context.lineTo(pos.x, pos.y);
+  });
+  context.stroke();
+  context.closePath();
+  // draw split line grid
+
+  var _loop = function _loop(i) {
+    var startPos = {};
+    context.beginPath();
+    context.setLineWidth(1 * opts.pixelRatio);
+    context.setStrokeStyle(radarOption.gridColor);
+    coordinateAngle.forEach(function(angle, index) {
+      var pos = convertCoordinateOrigin(radius / radarOption.gridCount * i * Math.cos(angle), radius / radarOption.gridCount * i * Math.sin(angle), centerPosition);
+      if (index === 0) {
+        startPos = pos;
+        context.moveTo(pos.x, pos.y);
+      } else {
+        context.lineTo(pos.x, pos.y);
+      }
+    });
+    context.lineTo(startPos.x, startPos.y);
+    context.stroke();
+    context.closePath();
+  };
+
+  for (var i = 1; i <= radarOption.gridCount; i++) {
+    _loop(i);
+  }
+
+  var radarDataPoints = getRadarDataPoints(coordinateAngle, centerPosition, radius, series, opts, process);
+
+  radarDataPoints.forEach(function(eachSeries, seriesIndex) {
+    // 绘制区域数据
+    context.beginPath();
+    context.setFillStyle(hexToRgb(eachSeries.color, radarOption.opacity));
+    eachSeries.data.forEach(function(item, index) {
+      if (index === 0) {
+        context.moveTo(item.position.x, item.position.y);
+      } else {
+        context.lineTo(item.position.x, item.position.y);
+      }
+    });
+    context.closePath();
+    context.fill();
+
+    if (opts.dataPointShape !== false) {
+      var points = eachSeries.data.map(function(item) {
+        return item.position;
+      });
+      drawPointShape(points, eachSeries.color, eachSeries.pointShape, context, opts);
+    }
+  });
+  // draw label text
+  drawRadarLabel(coordinateAngle, radius, centerPosition, opts, config, context);
+
+  return {
+    center: centerPosition,
+    radius: radius,
+    angleList: coordinateAngle
+  };
+}
+
+function normalInt(min, max, iter) {
+    iter = iter==0?1:iter;
+    var arr = [];
+    for (var i = 0; i < iter; i++) {
+        arr[i] = Math.random();
+    };
+    return  Math.floor(arr.reduce(function(i,j){return i+j})/iter*(max-min))+min;  
+};
+
+function collisionNew(area,points,width,height){
+    var isIn=false;
+    for(let i=0;i<points.length;i++){
+      if(points[i].area){
+        if(area[3]<points[i].area[1]||area[0]>points[i].area[2]||area[1]>points[i].area[3]||area[2]<points[i].area[0]){
+          if(area[0]<0 || area[1]<0 || area[2]>width || area[3]>height){
+            isIn=true;
+            break;
+          }else{
+            isIn=false;
+          }
+        }else{
+          isIn=true;
+          break;
+        }
+      }
+    }
+    return isIn;
+};
+
+function getBoundingBox(data) {
+  var bounds = {}, coords;
+  bounds.xMin = 180;
+  bounds.xMax = 0;
+  bounds.yMin = 90;
+  bounds.yMax = 0
+  for (var i = 0; i < data.length; i++) {
+      var coorda = data[i].geometry.coordinates
+      for (var k = 0; k < coorda.length; k++) {
+          coords = coorda[k];
+          if (coords.length == 1) {
+              coords = coords[0]
+          }
+          for (var j = 0; j < coords.length; j++) {
+              var longitude = coords[j][0];
+              var latitude = coords[j][1];
+              var point = {
+                  x: longitude, 
+                  y: latitude 
+              }
+              bounds.xMin = bounds.xMin < point.x ? bounds.xMin : point.x;
+              bounds.xMax = bounds.xMax > point.x ? bounds.xMax : point.x;
+              bounds.yMin = bounds.yMin < point.y ? bounds.yMin : point.y;
+              bounds.yMax = bounds.yMax > point.y ? bounds.yMax : point.y;
+          }
+      }
+  }
+  return bounds;
+}
+
+function coordinateToPoint(latitude, longitude,bounds,scale,xoffset,yoffset) {
+  return {
+      x: (longitude - bounds.xMin) * scale+xoffset,
+      y: (bounds.yMax - latitude) * scale+yoffset
+  };
+}
+
+function pointToCoordinate(pointY, pointX,bounds,scale,xoffset,yoffset) {
+  return {
+      x: (pointX-xoffset)/scale+bounds.xMin,
+      y: bounds.yMax - (pointY-yoffset)/scale
+  };
+}
+
+function isRayIntersectsSegment(poi,s_poi,e_poi){
+      if (s_poi[1]==e_poi[1]){return false;} 
+      if (s_poi[1]>poi[1] && e_poi[1]>poi[1]){return false;}
+      if (s_poi[1]<poi[1] && e_poi[1]<poi[1]){return false;}
+      if (s_poi[1]==poi[1] && e_poi[1]>poi[1]){return false;}
+      if (e_poi[1]==poi[1] && s_poi[1]>poi[1]){return false;}
+      if (s_poi[0]<poi[0] && e_poi[1]<poi[1]){return false;}
+      let xseg=e_poi[0]-(e_poi[0]-s_poi[0])*(e_poi[1]-poi[1])/(e_poi[1]-s_poi[1]); 
+      if (xseg<poi[0]){
+        return false;
+      }else{
+        return true;
+      }
+} 
+
+function isPoiWithinPoly(poi,poly){
+  let sinsc=0;
+  for (let i=0;i<poly.length;i++){
+    let epoly=poly[i][0];
+    if (poly.length == 1) {
+      epoly = poly[i][0]
+    }
+    for(let j=0;j<epoly.length-1;j++){
+      let s_poi=epoly[j];
+      let e_poi=epoly[j+1];
+      if (isRayIntersectsSegment(poi,s_poi,e_poi)){
+        sinsc+=1;
+      }
+    }
+  }
+  
+  if(sinsc%2==1){
+    return true;
+  }else{
+    return false;
+  }
+}
+
+
+function drawMapDataPoints(series, opts, config, context) {
+  var mapOption=assign({},{
+    border:true,
+    borderWidth:1,
+    borderColor:'#666666',
+    fillOpacity:0.6,
+    activeBorderColor:'#f04864',
+    activeFillColor:'#facc14',
+    activeFillOpacity:1
+  },opts.extra.map);
+  var coords, point;
+  var data = series;
+  var bounds= getBoundingBox(data);
+  var xScale = opts.width / Math.abs(bounds.xMax - bounds.xMin);
+  var yScale = opts.height / Math.abs(bounds.yMax - bounds.yMin);
+  var scale = xScale < yScale ? xScale : yScale;
+  var xoffset=opts.width/2-Math.abs(bounds.xMax - bounds.xMin)/2*scale;
+  var yoffset=opts.height/2-Math.abs(bounds.yMax - bounds.yMin)/2*scale;
+  context.beginPath();
+  context.clearRect(0, 0, opts.width, opts.height);
+  context.setFillStyle(opts.background||'#FFFFFF');
+  context.rect(0,0,opts.width,opts.height);
+  context.fill();
+  for (var i = 0; i < data.length; i++) {
+    context.beginPath();
+    context.setLineWidth(mapOption.borderWidth * opts.pixelRatio);
+    context.setStrokeStyle(mapOption.borderColor);
+    context.setFillStyle(hexToRgb(series[i].color, mapOption.fillOpacity));
+    if (opts.tooltip) {
+      if (opts.tooltip.index == i ) {
+        context.setStrokeStyle(mapOption.activeBorderColor);
+        context.setFillStyle(hexToRgb(mapOption.activeFillColor, mapOption.activeFillOpacity));
+      }
+    }
+    var coorda = data[i].geometry.coordinates
+    for (var k = 0; k < coorda.length; k++) {
+      coords = coorda[k];
+      if (coords.length == 1) {
+        coords = coords[0]
+      }
+      for (var j = 0; j < coords.length; j++) {
+        point = coordinateToPoint(coords[j][1], coords[j][0],bounds,scale,xoffset,yoffset)
+        if (j === 0) {
+          context.beginPath();
+          context.moveTo(point.x, point.y);
+        } else {
+          context.lineTo(point.x, point.y);
+        }
+      }
+      context.fill();
+      if(mapOption.border == true){
+        context.stroke();
+      }
+    }
+    if(opts.dataLabel == true){
+      var centerPoint = data[i].properties.centroid;
+      if(centerPoint){
+        point = coordinateToPoint(centerPoint[1], centerPoint[0],bounds,scale,xoffset,yoffset);
+        let fontSize=data[i].textSize||config.fontSize;
+        let text=data[i].properties.name;
+        context.beginPath();
+        context.setFontSize(fontSize)
+        context.setFillStyle(data[i].textColor||'#666666')
+        context.fillText(text, point.x-measureText(text,fontSize)/2, point.y+fontSize/2);
+        context.closePath();
+        context.stroke();
+      }
+    }
+  }
+  opts.chartData.mapData={
+    bounds:bounds,
+    scale:scale,
+    xoffset:xoffset,
+    yoffset:yoffset
+  }
+  drawToolTipBridge(opts, config, context,1);
+  context.draw();
+}
+
+function getWordCloudPoint(opts,type){
+  let points = opts.series.sort(function(a,b){return parseInt(b.textSize)-parseInt(a.textSize);});
+  switch (type) {
+    case 'normal':
+      for (let i = 0; i < points.length; i++) {
+        let text = points[i].name;
+        let tHeight = points[i].textSize;
+        let tWidth = measureText(text,tHeight);
+        let x,y;
+        let area;
+        let breaknum=0;
+        while(true) {
+            breaknum++;
+            x = normalInt(-opts.width/2, opts.width/2,5) - tWidth/2;
+            y = normalInt(-opts.height/2, opts.height/2,5) + tHeight/2;
+            area=[x-5+opts.width/2,y-5-tHeight+opts.height/2,x+tWidth+5+opts.width/2,y+5+opts.height/2];
+            let isCollision = collisionNew(area,points,opts.width,opts.height);
+            if (!isCollision) break;
+            if (breaknum==1000){
+              area=[-100,-100,-100,-100];
+              break;
+            }
+        };
+        points[i].area=area;
+      }
+    break;
+    case 'vertical':
+      function Spin(){
+        //获取均匀随机值,是否旋转,旋转的概率为(1-0.5)
+        if (Math.random()>0.7) {
+            return true;
+        }else {return false};
+      };
+      for (let i = 0; i < points.length; i++) { 
+        let text = points[i].name;
+        let tHeight = points[i].textSize;
+        let tWidth = measureText(text,tHeight);
+        let isSpin = Spin(); 
+        let x,y,area,areav;
+        let breaknum=0;
+        while(true) {
+          breaknum++;
+          let isCollision;
+          if (isSpin) {
+              x = normalInt(-opts.width/2, opts.width/2,5) - tWidth/2;
+              y = normalInt(-opts.height/2, opts.height/2,5)+tHeight/2;
+              area=[y-5-tWidth+opts.width/2,(-x-5+opts.height/2),y+5+opts.width/2,(-x+tHeight+5+opts.height/2)];
+              areav=[opts.width-(opts.width/2-opts.height/2)-(-x+tHeight+5+opts.height/2)-5,(opts.height/2-opts.width/2)+(y-5-tWidth+opts.width/2)-5,opts.width-(opts.width/2-opts.height/2)-(-x+tHeight+5+opts.height/2)+tHeight,(opts.height/2-opts.width/2)+(y-5-tWidth+opts.width/2)+tWidth+5];
+              isCollision = collisionNew(areav,points,opts.height,opts.width);
+          }else{
+            x = normalInt(-opts.width/2, opts.width/2,5) - tWidth/2;
+            y = normalInt(-opts.height/2, opts.height/2,5)+tHeight/2;
+            area=[x-5+opts.width/2,y-5-tHeight+opts.height/2,x+tWidth+5+opts.width/2,y+5+opts.height/2];
+            isCollision = collisionNew(area,points,opts.width,opts.height);
+          } 
+          if (!isCollision) break;
+          if (breaknum==1000){
+            area=[-1000,-1000,-1000,-1000];
+            break;
+          }
+        };
+        if (isSpin) {
+          points[i].area=areav;
+          points[i].areav=area;
+        }else{
+          points[i].area=area;
+        }
+        points[i].rotate=isSpin;
+      };
+    break;
+  }
+  return points;
+}
+
+
+function drawWordCloudDataPoints(series, opts, config, context) {
+  let process = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : 1;
+  let wordOption = assign({},{
+    type: 'normal',
+    autoColors: true
+  },opts.extra.word);
+  
+  context.beginPath();
+  context.setFillStyle(opts.background||'#FFFFFF');
+  context.rect(0,0,opts.width,opts.height);
+  context.fill();
+  context.save();
+  let points = opts.chartData.wordCloudData;
+  context.translate(opts.width/2,opts.height/2);
+  
+  for(let i=0;i<points.length;i++){
+      context.save();
+      if(points[i].rotate){
+        context.rotate(90 * Math.PI / 180);
+      }
+      let text = points[i].name;
+      let tHeight = points[i].textSize;
+      let tWidth = measureText(text,tHeight);
+      context.beginPath();
+      context.setStrokeStyle(points[i].color);
+      context.setFillStyle(points[i].color);
+      context.setFontSize(tHeight);
+      if(points[i].rotate){
+        if(points[i].areav[0]>0){
+          if (opts.tooltip) {
+            if (opts.tooltip.index == i) {
+              context.strokeText(text,(points[i].areav[0]+5-opts.width/2)*process-tWidth*(1-process)/2,(points[i].areav[1]+5+tHeight-opts.height/2)*process);
+              }else{
+                context.fillText(text,(points[i].areav[0]+5-opts.width/2)*process-tWidth*(1-process)/2,(points[i].areav[1]+5+tHeight-opts.height/2)*process);
+              }
+          }else{
+            context.fillText(text,(points[i].areav[0]+5-opts.width/2)*process-tWidth*(1-process)/2,(points[i].areav[1]+5+tHeight-opts.height/2)*process);
+          } 
+        }
+      }else{
+        if(points[i].area[0]>0){
+          if (opts.tooltip) {
+            if (opts.tooltip.index == i) {
+              context.strokeText(text,(points[i].area[0]+5-opts.width/2)*process-tWidth*(1-process)/2,(points[i].area[1]+5+tHeight-opts.height/2)*process);
+            }else{
+              context.fillText(text,(points[i].area[0]+5-opts.width/2)*process-tWidth*(1-process)/2,(points[i].area[1]+5+tHeight-opts.height/2)*process);
+            }
+          }else{
+            context.fillText(text,(points[i].area[0]+5-opts.width/2)*process-tWidth*(1-process)/2,(points[i].area[1]+5+tHeight-opts.height/2)*process);
+          }
+            
+        }
+      }
+      
+      context.stroke();
+      context.restore();
+  }
+  context.restore();
+}
+
+function drawFunnelDataPoints(series, opts, config, context) {
+  let process = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : 1;
+  let funnelOption = assign({},{
+    activeWidth:10,
+    activeOpacity:0.3,
+    border:false,
+    borderWidth:2,
+    borderColor:'#FFFFFF',
+    fillOpacity:1,
+    labelAlign:'right'
+  },opts.extra.funnel);
+  let eachSpacing = (opts.height - opts.area[0] - opts.area[2])/series.length;
+  let centerPosition = {
+    x: opts.area[3] + (opts.width - opts.area[1] - opts.area[3]) / 2,
+    y: opts.height-opts.area[2]
+  };
+  let activeWidth = funnelOption.activeWidth;
+  let radius = Math.min((opts.width - opts.area[1] - opts.area[3]) / 2 - activeWidth, (opts.height - opts.area[0] - opts.area[2]) / 2 - activeWidth);
+  series = getFunnelDataPoints(series, radius, process);
+  context.save();
+  context.translate(centerPosition.x,centerPosition.y);
+  for(let i=0;i<series.length;i++){
+    if(i==0){
+      if (opts.tooltip) {
+        if (opts.tooltip.index == i) {
+          context.beginPath();
+          context.setFillStyle(hexToRgb(series[i].color, funnelOption.activeOpacity));
+          context.moveTo(-activeWidth, 0);
+          context.lineTo(-series[i].radius-activeWidth, -eachSpacing);
+          context.lineTo(series[i].radius+activeWidth, -eachSpacing);
+          context.lineTo(activeWidth, 0);
+          context.lineTo(-activeWidth, 0);
+          context.closePath();
+          context.fill();
+        }
+      }
+      series[i].funnelArea=[centerPosition.x-series[i].radius,centerPosition.y-eachSpacing,centerPosition.x+series[i].radius,centerPosition.y];
+      context.beginPath();
+      context.setLineWidth(funnelOption.borderWidth * opts.pixelRatio);
+      context.setStrokeStyle(funnelOption.borderColor);
+      context.setFillStyle(hexToRgb(series[i].color, funnelOption.fillOpacity));
+      context.moveTo(0, 0);
+      context.lineTo(-series[i].radius, -eachSpacing);
+      context.lineTo(series[i].radius, -eachSpacing);
+      context.lineTo(0, 0);
+      context.closePath();
+      context.fill();
+      if(funnelOption.border == true){
+        context.stroke();
+      }
+    }else{
+      if (opts.tooltip) {
+        if (opts.tooltip.index == i) {
+          context.beginPath();
+          context.setFillStyle(hexToRgb(series[i].color, funnelOption.activeOpacity));
+          context.moveTo(0, 0);
+          context.lineTo(-series[i-1].radius-activeWidth, 0);
+          context.lineTo(-series[i].radius-activeWidth, -eachSpacing);
+          context.lineTo(series[i].radius+activeWidth, -eachSpacing);
+          context.lineTo(series[i-1].radius+activeWidth, 0);
+          context.lineTo(0, 0);
+          context.closePath();
+          context.fill();
+        }
+      }
+      series[i].funnelArea=[centerPosition.x-series[i].radius,centerPosition.y-eachSpacing*(i+1),centerPosition.x+series[i].radius,centerPosition.y-eachSpacing*i];
+      context.beginPath();
+      context.setLineWidth(funnelOption.borderWidth * opts.pixelRatio);
+      context.setStrokeStyle(funnelOption.borderColor);
+      context.setFillStyle(hexToRgb(series[i].color, funnelOption.fillOpacity));
+      context.moveTo(0, 0);
+      context.lineTo(-series[i-1].radius, 0);
+      context.lineTo(-series[i].radius, -eachSpacing);
+      context.lineTo(series[i].radius, -eachSpacing);
+      context.lineTo(series[i-1].radius, 0);
+      context.lineTo(0, 0);
+      context.closePath();
+      context.fill();
+      if(funnelOption.border == true){
+        context.stroke();
+      }
+    }
+    context.translate(0,-eachSpacing)
+  }
+  context.restore();
+  
+  if (opts.dataLabel !== false && process === 1) {
+    drawFunnelText(series, opts, context, eachSpacing, funnelOption.labelAlign, activeWidth, centerPosition);
+  }
+  
+  return {
+    center: centerPosition,
+    radius: radius,
+    series: series
+  };
+}
+
+function drawFunnelText(series, opts, context, eachSpacing, labelAlign,activeWidth, centerPosition){
+  for(let i=0;i<series.length;i++){
+    let item = series[i];
+    let startX,endX,startY,fontSize;
+    let text = item.format ? item.format(+item._proportion_.toFixed(2)) : util.toFixed(item._proportion_ * 100) +'%';
+    if(labelAlign == 'right'){
+      if(i==0){
+        startX=(item.funnelArea[2]+centerPosition.x)/2;
+      }else{
+        startX=(item.funnelArea[2]+series[i-1].funnelArea[2])/2;
+      }
+      endX=startX+activeWidth*2;
+      startY=item.funnelArea[1]+eachSpacing/2;
+      fontSize = item.textSize || opts.fontSize;
+      context.setLineWidth(1 * opts.pixelRatio);
+      context.setStrokeStyle(item.color);
+      context.setFillStyle(item.color);
+      context.beginPath();
+      context.moveTo(startX,startY );
+      context.lineTo(endX,startY);
+      context.stroke();
+      context.closePath();
+      context.beginPath();
+      context.moveTo(endX, startY);
+      context.arc(endX, startY, 2, 0, 2 * Math.PI);
+      context.closePath();
+      context.fill();
+      context.beginPath();
+      context.setFontSize(fontSize);
+      context.setFillStyle(item.textColor || '#666666');
+      context.fillText(text, endX+5, startY + fontSize/2 -2);
+      context.closePath();
+      context.stroke();
+      context.closePath();
+    }else{
+      if(i==0){
+        startX=(item.funnelArea[0]+centerPosition.x)/2;
+      }else{
+        startX=(item.funnelArea[0]+series[i-1].funnelArea[0])/2;
+      }
+      endX=startX-activeWidth*2;
+      startY=item.funnelArea[1]+eachSpacing/2;
+      fontSize = item.textSize || opts.fontSize;
+      context.setLineWidth(1 * opts.pixelRatio);
+      context.setStrokeStyle(item.color);
+      context.setFillStyle(item.color);
+      context.beginPath();
+      context.moveTo(startX,startY );
+      context.lineTo(endX,startY);
+      context.stroke();
+      context.closePath();
+      context.beginPath();
+      context.moveTo(endX, startY);
+      context.arc(endX, startY, 2, 0, 2 * Math.PI);
+      context.closePath();
+      context.fill();
+      context.beginPath();
+      context.setFontSize(fontSize);
+      context.setFillStyle(item.textColor || '#666666');
+      context.fillText(text, endX-5-measureText(text), startY + fontSize/2 -2);
+      context.closePath();
+      context.stroke();
+      context.closePath();
+    }
+    
+  }
+}
+
+
+function drawCanvas(opts, context) {
+  context.draw();
+}
+
+var Timing = {
+  easeIn: function easeIn(pos) {
+    return Math.pow(pos, 3);
+  },
+  easeOut: function easeOut(pos) {
+    return Math.pow(pos - 1, 3) + 1;
+  },
+  easeInOut: function easeInOut(pos) {
+    if ((pos /= 0.5) < 1) {
+      return 0.5 * Math.pow(pos, 3);
+    } else {
+      return 0.5 * (Math.pow(pos - 2, 3) + 2);
+    }
+  },
+  linear: function linear(pos) {
+    return pos;
+  }
+};
+
+function Animation(opts) {
+  this.isStop = false;
+  opts.duration = typeof opts.duration === 'undefined' ? 1000 : opts.duration;
+  opts.timing = opts.timing || 'linear';
+  var delay = 17;
+
+  function createAnimationFrame() {
+    if (typeof setTimeout !== 'undefined') {
+      return function(step, delay) {
+        setTimeout(function() {
+          var timeStamp = +new Date();
+          step(timeStamp);
+        }, delay);
+      };
+    } else if (typeof requestAnimationFrame !== 'undefined') {
+      return requestAnimationFrame;
+    } else {
+      return function(step) {
+        step(null);
+      };
+    }
+  };
+  var animationFrame = createAnimationFrame();
+  var startTimeStamp = null;
+  var _step = function step(timestamp) {
+    if (timestamp === null || this.isStop === true) {
+      opts.onProcess && opts.onProcess(1);
+      opts.onAnimationFinish && opts.onAnimationFinish();
+      return;
+    }
+    if (startTimeStamp === null) {
+      startTimeStamp = timestamp;
+    }
+    if (timestamp - startTimeStamp < opts.duration) {
+      var process = (timestamp - startTimeStamp) / opts.duration;
+      var timingFunction = Timing[opts.timing];
+      process = timingFunction(process);
+
+      opts.onProcess && opts.onProcess(process);
+      animationFrame(_step, delay);
+    } else {
+      opts.onProcess && opts.onProcess(1);
+      opts.onAnimationFinish && opts.onAnimationFinish();
+    }
+  };
+  _step = _step.bind(this);
+  animationFrame(_step, delay);
+}
+
+// stop animation immediately
+// and tigger onAnimationFinish
+Animation.prototype.stop = function() {
+  this.isStop = true;
+};
+
+function drawCharts(type, opts, config, context) {
+  var _this = this;
+  var series = opts.series;
+  var categories = opts.categories;
+  series = fillSeries(series, opts, config);
+  var duration = opts.animation ? opts.duration : 0;
+  _this.animationInstance && _this.animationInstance.stop();
+  var seriesMA = null;
+  if (type == 'candle') {
+    let average = assign({}, opts.extra.candle.average);
+    if (average.show) {
+      seriesMA = calCandleMA(average.day, average.name, average.color, series[0].data);
+      seriesMA = fillSeries(seriesMA, opts, config);
+      opts.seriesMA = seriesMA;
+    } else if (opts.seriesMA) {
+      seriesMA = opts.seriesMA = fillSeries(opts.seriesMA, opts, config);
+    } else {
+      seriesMA = series;
+    }
+  } else {
+    seriesMA = series;
+  }
+
+  /* 过滤掉show=false的series */
+  opts._series_ = series = filterSeries(series);
+
+  //重新计算图表区域
+
+  opts.area = new Array(4);
+  //复位绘图区域
+  for (let j = 0; j < 4; j++) {
+    opts.area[j] = opts.padding[j];
+  }
+
+  //通过计算三大区域:图例、X轴、Y轴的大小,确定绘图区域
+  var _calLegendData = calLegendData(seriesMA, opts, config, opts.chartData),
+    legendHeight = _calLegendData.area.wholeHeight,
+    legendWidth = _calLegendData.area.wholeWidth;
+    
+  switch (opts.legend.position) {
+    case 'top':
+      opts.area[0] += legendHeight;
+      break;
+    case 'bottom':
+      opts.area[2] += legendHeight;
+      break;
+    case 'left':
+      opts.area[3] += legendWidth;
+      break;
+    case 'right':
+      opts.area[1] += legendWidth;
+      break;
+  }
+
+  let _calYAxisData = {},yAxisWidth = 0;
+  if (opts.type === 'line' || opts.type === 'column' || opts.type === 'area' || opts.type === 'mix' || opts.type === 'candle') {
+    _calYAxisData = calYAxisData(series, opts, config);
+    yAxisWidth = _calYAxisData.yAxisWidth;
+    //如果显示Y轴标题
+    if(opts.yAxis.showTitle){
+      let maxTitleHeight=0;
+      for(let i=0;i<opts.yAxis.data.length;i++){
+        maxTitleHeight = Math.max(maxTitleHeight,opts.yAxis.data[i].titleFontSize?opts.yAxis.data[i].titleFontSize:config.fontSize)
+      }
+      opts.area[0] += (maxTitleHeight+6)*opts.pixelRatio;
+    }
+    let rightIndex=0,leftIndex=0;
+    //计算主绘图区域左右位置
+    for(let i=0;i<yAxisWidth.length;i++){
+      if(yAxisWidth[i].position=='left'){
+        if(leftIndex>0){
+          opts.area[3] += yAxisWidth[i].width + opts.yAxis.padding;
+        }else{
+          opts.area[3] += yAxisWidth[i].width;
+        }
+        leftIndex +=1;
+      }else{
+        if(rightIndex>0){
+          opts.area[1] += yAxisWidth[i].width + opts.yAxis.padding;
+        }else{
+          opts.area[1] += yAxisWidth[i].width;
+        }
+        rightIndex +=1;
+      }
+    }
+  }else{
+    config.yAxisWidth = yAxisWidth;
+  }
+  opts.chartData.yAxisData = _calYAxisData;
+
+  if (opts.categories && opts.categories.length) {
+    opts.chartData.xAxisData = getXAxisPoints(opts.categories, opts, config);
+    let _calCategoriesData = calCategoriesData(opts.categories, opts, config, opts.chartData.xAxisData.eachSpacing),
+      xAxisHeight = _calCategoriesData.xAxisHeight,
+      angle = _calCategoriesData.angle;
+    config.xAxisHeight = xAxisHeight;
+    config._xAxisTextAngle_ = angle;
+    opts.area[2] += xAxisHeight;
+    opts.chartData.categoriesData = _calCategoriesData;
+  }else{
+		if (opts.type === 'line' || opts.type === 'area' || opts.type === 'points') {
+			opts.chartData.xAxisData = calXAxisData(series, opts, config);
+			categories=opts.chartData.xAxisData.rangesFormat;
+			let _calCategoriesData = calCategoriesData(categories, opts, config, opts.chartData.xAxisData.eachSpacing),
+			  xAxisHeight = _calCategoriesData.xAxisHeight,
+			  angle = _calCategoriesData.angle;
+			config.xAxisHeight = xAxisHeight;
+			config._xAxisTextAngle_ = angle;
+			opts.area[2] += xAxisHeight;
+			opts.chartData.categoriesData = _calCategoriesData;
+		}else{
+			opts.chartData.xAxisData={
+				xAxisPoints: []
+			};
+		}
+	}
+  //计算右对齐偏移距离
+  if (opts.enableScroll && opts.xAxis.scrollAlign == 'right' && opts._scrollDistance_ === undefined) {
+    let offsetLeft = 0,
+      xAxisPoints = opts.chartData.xAxisData.xAxisPoints,
+      startX = opts.chartData.xAxisData.startX,
+      endX = opts.chartData.xAxisData.endX,
+      eachSpacing = opts.chartData.xAxisData.eachSpacing;
+    let totalWidth = eachSpacing * (xAxisPoints.length - 1);
+    let screenWidth = endX - startX;
+    offsetLeft = screenWidth - totalWidth;
+    _this.scrollOption = {
+      currentOffset: offsetLeft,
+      startTouchX: offsetLeft,
+      distance: 0,
+      lastMoveTime: 0
+    };
+    opts._scrollDistance_ = offsetLeft;
+  }
+
+  if (type === 'pie' || type === 'ring' || type === 'rose') {
+    config._pieTextMaxLength_ = opts.dataLabel === false ? 0 : getPieTextMaxLength(seriesMA);
+  }
+
+  switch (type) {
+    case 'word':
+      let wordOption = assign({},{
+        type: 'normal',
+        autoColors: true
+      },opts.extra.word);
+      if(opts.updateData==true || opts.updateData==undefined){
+        opts.chartData.wordCloudData=getWordCloudPoint(opts,wordOption.type);
+      }
+      this.animationInstance = new Animation({
+        timing: 'easeInOut',
+        duration: duration,
+        onProcess: function(process) {
+          context.clearRect(0, 0, opts.width, opts.height);
+          if (opts.rotate) {
+            contextRotate(context, opts);
+          }
+          drawWordCloudDataPoints(series, opts, config, context,process);
+          drawCanvas(opts, context);
+        },
+        onAnimationFinish: function onAnimationFinish() {
+          _this.event.trigger('renderComplete');
+        }
+      });
+    break;
+    case 'map':
+      context.clearRect(0, 0, opts.width, opts.height);
+      drawMapDataPoints(series, opts, config, context);
+    break;
+    case 'funnel':
+      this.animationInstance = new Animation({
+        timing: 'easeInOut',
+        duration: duration,
+        onProcess: function(process) {
+          context.clearRect(0, 0, opts.width, opts.height);
+          if (opts.rotate) {
+            contextRotate(context, opts);
+          }
+          opts.chartData.funnelData = drawFunnelDataPoints(series, opts, config, context, process);
+          drawLegend(opts.series, opts, config, context, opts.chartData);
+          drawToolTipBridge(opts, config, context, process);
+          drawCanvas(opts, context);
+        },
+        onAnimationFinish: function onAnimationFinish() {
+          _this.event.trigger('renderComplete');
+        }
+      });
+    break;
+    case 'line':
+      this.animationInstance = new Animation({
+        timing: 'easeIn',
+        duration: duration,
+        onProcess: function onProcess(process) {
+          context.clearRect(0, 0, opts.width, opts.height);
+          if (opts.rotate) {
+            contextRotate(context, opts);
+          }
+          drawYAxisGrid(categories, opts, config, context);
+          drawXAxis(categories, opts, config, context);
+          var _drawLineDataPoints = drawLineDataPoints(series, opts, config, context, process),
+            xAxisPoints = _drawLineDataPoints.xAxisPoints,
+            calPoints = _drawLineDataPoints.calPoints,
+            eachSpacing = _drawLineDataPoints.eachSpacing;
+          opts.chartData.xAxisPoints = xAxisPoints;
+          opts.chartData.calPoints = calPoints;
+          opts.chartData.eachSpacing = eachSpacing;
+          drawYAxis(series, opts, config, context);
+          if (opts.enableMarkLine !== false && process === 1) {
+            drawMarkLine(opts, config, context);
+          }
+          drawLegend(opts.series, opts, config, context, opts.chartData);
+          drawToolTipBridge(opts, config, context, process, eachSpacing, xAxisPoints);
+          drawCanvas(opts, context);
+
+        },
+        onAnimationFinish: function onAnimationFinish() {
+          _this.event.trigger('renderComplete');
+        }
+      });
+      break;
+    case 'mix':
+      this.animationInstance = new Animation({
+        timing: 'easeIn',
+        duration: duration,
+        onProcess: function onProcess(process) {
+          context.clearRect(0, 0, opts.width, opts.height);
+          if (opts.rotate) {
+            contextRotate(context, opts);
+          }
+          drawYAxisGrid(categories, opts, config, context);
+          drawXAxis(categories, opts, config, context);
+          var _drawMixDataPoints = drawMixDataPoints(series, opts, config, context, process),
+            xAxisPoints = _drawMixDataPoints.xAxisPoints,
+            calPoints = _drawMixDataPoints.calPoints,
+            eachSpacing = _drawMixDataPoints.eachSpacing;
+          opts.chartData.xAxisPoints = xAxisPoints;
+          opts.chartData.calPoints = calPoints;
+          opts.chartData.eachSpacing = eachSpacing;
+          drawYAxis(series, opts, config, context);
+          if (opts.enableMarkLine !== false && process === 1) {
+            drawMarkLine(opts, config, context);
+          }
+          drawLegend(opts.series, opts, config, context, opts.chartData);
+          drawToolTipBridge(opts, config, context, process, eachSpacing, xAxisPoints);
+          drawCanvas(opts, context);
+        },
+        onAnimationFinish: function onAnimationFinish() {
+          _this.event.trigger('renderComplete');
+        }
+      });
+      break;
+    case 'column':
+      this.animationInstance = new Animation({
+        timing: 'easeIn',
+        duration: duration,
+        onProcess: function onProcess(process) {
+          context.clearRect(0, 0, opts.width, opts.height);
+          if (opts.rotate) {
+            contextRotate(context, opts);
+          }
+          drawYAxisGrid(categories, opts, config, context);
+          drawXAxis(categories, opts, config, context);
+          var _drawColumnDataPoints = drawColumnDataPoints(series, opts, config, context, process),
+            xAxisPoints = _drawColumnDataPoints.xAxisPoints,
+            calPoints = _drawColumnDataPoints.calPoints,
+            eachSpacing = _drawColumnDataPoints.eachSpacing;
+          opts.chartData.xAxisPoints = xAxisPoints;
+          opts.chartData.calPoints = calPoints;
+          opts.chartData.eachSpacing = eachSpacing;
+          drawYAxis(series, opts, config, context);
+          if (opts.enableMarkLine !== false && process === 1) {
+            drawMarkLine(opts, config, context);
+          }
+          drawLegend(opts.series, opts, config, context, opts.chartData);
+          drawToolTipBridge(opts, config, context, process, eachSpacing, xAxisPoints);
+          drawCanvas(opts, context);
+        },
+        onAnimationFinish: function onAnimationFinish() {
+          _this.event.trigger('renderComplete');
+        }
+      });
+      break;
+    case 'area':
+      this.animationInstance = new Animation({
+        timing: 'easeIn',
+        duration: duration,
+        onProcess: function onProcess(process) {
+          context.clearRect(0, 0, opts.width, opts.height);
+          if (opts.rotate) {
+            contextRotate(context, opts);
+          }
+          drawYAxisGrid(categories, opts, config, context);
+          drawXAxis(categories, opts, config, context);
+          var _drawAreaDataPoints = drawAreaDataPoints(series, opts, config, context, process),
+            xAxisPoints = _drawAreaDataPoints.xAxisPoints,
+            calPoints = _drawAreaDataPoints.calPoints,
+            eachSpacing = _drawAreaDataPoints.eachSpacing;
+          opts.chartData.xAxisPoints = xAxisPoints;
+          opts.chartData.calPoints = calPoints;
+          opts.chartData.eachSpacing = eachSpacing;
+          drawYAxis(series, opts, config, context);
+          if (opts.enableMarkLine !== false && process === 1) {
+            drawMarkLine(opts, config, context);
+          }
+          drawLegend(opts.series, opts, config, context, opts.chartData);
+          drawToolTipBridge(opts, config, context, process, eachSpacing, xAxisPoints);
+          drawCanvas(opts, context);
+        },
+        onAnimationFinish: function onAnimationFinish() {
+          _this.event.trigger('renderComplete');
+        }
+      });
+      break;
+    case 'ring':
+    case 'pie':
+      this.animationInstance = new Animation({
+        timing: 'easeInOut',
+        duration: duration,
+        onProcess: function onProcess(process) {
+          context.clearRect(0, 0, opts.width, opts.height);
+          if (opts.rotate) {
+            contextRotate(context, opts);
+          }
+          opts.chartData.pieData = drawPieDataPoints(series, opts, config, context, process);
+          drawLegend(opts.series, opts, config, context, opts.chartData);
+          drawToolTipBridge(opts, config, context, process);
+          drawCanvas(opts, context);
+        },
+        onAnimationFinish: function onAnimationFinish() {
+          _this.event.trigger('renderComplete');
+        }
+      });
+      break;
+    case 'rose':
+      this.animationInstance = new Animation({
+        timing: 'easeInOut',
+        duration: duration,
+        onProcess: function onProcess(process) {
+          context.clearRect(0, 0, opts.width, opts.height);
+          if (opts.rotate) {
+            contextRotate(context, opts);
+          }
+          opts.chartData.pieData = drawRoseDataPoints(series, opts, config, context, process);
+          drawLegend(opts.series, opts, config, context, opts.chartData);
+          drawToolTipBridge(opts, config, context, process);
+          drawCanvas(opts, context);
+        },
+        onAnimationFinish: function onAnimationFinish() {
+          _this.event.trigger('renderComplete');
+        }
+      });
+      break;
+    case 'radar':
+      this.animationInstance = new Animation({
+        timing: 'easeInOut',
+        duration: duration,
+        onProcess: function onProcess(process) {
+          context.clearRect(0, 0, opts.width, opts.height);
+          if (opts.rotate) {
+            contextRotate(context, opts);
+          }
+          opts.chartData.radarData = drawRadarDataPoints(series, opts, config, context, process);
+          drawLegend(opts.series, opts, config, context, opts.chartData);
+          drawToolTipBridge(opts, config, context, process);
+          drawCanvas(opts, context);
+        },
+        onAnimationFinish: function onAnimationFinish() {
+          _this.event.trigger('renderComplete');
+        }
+      });
+      break;
+    case 'arcbar':
+      this.animationInstance = new Animation({
+        timing: 'easeInOut',
+        duration: duration,
+        onProcess: function onProcess(process) {
+          context.clearRect(0, 0, opts.width, opts.height);
+          if (opts.rotate) {
+            contextRotate(context, opts);
+          }
+          opts.chartData.arcbarData = drawArcbarDataPoints(series, opts, config, context, process);
+          drawCanvas(opts, context);
+        },
+        onAnimationFinish: function onAnimationFinish() {
+          _this.event.trigger('renderComplete');
+        }
+      });
+      break;
+    case 'gauge':
+      this.animationInstance = new Animation({
+        timing: 'easeInOut',
+        duration: duration,
+        onProcess: function onProcess(process) {
+          context.clearRect(0, 0, opts.width, opts.height);
+          if (opts.rotate) {
+            contextRotate(context, opts);
+          }
+          opts.chartData.gaugeData = drawGaugeDataPoints(categories, series, opts, config, context, process);
+          drawCanvas(opts, context);
+        },
+        onAnimationFinish: function onAnimationFinish() {
+          _this.event.trigger('renderComplete');
+        }
+      });
+      break;
+    case 'candle':
+      this.animationInstance = new Animation({
+        timing: 'easeIn',
+        duration: duration,
+        onProcess: function onProcess(process) {
+          context.clearRect(0, 0, opts.width, opts.height);
+          if (opts.rotate) {
+            contextRotate(context, opts);
+          }
+          drawYAxisGrid(categories, opts, config, context);
+          drawXAxis(categories, opts, config, context);
+          var _drawCandleDataPoints = drawCandleDataPoints(series, seriesMA, opts, config, context, process),
+            xAxisPoints = _drawCandleDataPoints.xAxisPoints,
+            calPoints = _drawCandleDataPoints.calPoints,
+            eachSpacing = _drawCandleDataPoints.eachSpacing;
+          opts.chartData.xAxisPoints = xAxisPoints;
+          opts.chartData.calPoints = calPoints;
+          opts.chartData.eachSpacing = eachSpacing;
+          drawYAxis(series, opts, config, context);
+          if (opts.enableMarkLine !== false && process === 1) {
+            drawMarkLine(opts, config, context);
+          }
+          if (seriesMA) {
+            drawLegend(seriesMA, opts, config, context, opts.chartData);
+          } else {
+            drawLegend(opts.series, opts, config, context, opts.chartData);
+          }
+          drawToolTipBridge(opts, config, context, process, eachSpacing, xAxisPoints);
+          drawCanvas(opts, context);
+        },
+        onAnimationFinish: function onAnimationFinish() {
+          _this.event.trigger('renderComplete');
+        }
+      });
+      break;
+  }
+}
+
+// simple event implement
+
+function Event() {
+  this.events = {};
+}
+
+Event.prototype.addEventListener = function(type, listener) {
+  this.events[type] = this.events[type] || [];
+  this.events[type].push(listener);
+};
+
+Event.prototype.trigger = function() {
+  for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) {
+    args[_key] = arguments[_key];
+  }
+
+  var type = args[0];
+  var params = args.slice(1);
+  if (!!this.events[type]) {
+    this.events[type].forEach(function(listener) {
+      try {
+        listener.apply(null, params);
+      } catch (e) {
+        console.error(e);
+      }
+    });
+  }
+};
+
+var Charts = function Charts(opts) {
+  opts.pixelRatio = opts.pixelRatio ? opts.pixelRatio : 1;
+  opts.fontSize = opts.fontSize ? opts.fontSize * opts.pixelRatio : 13 * opts.pixelRatio;
+  opts.title = assign({}, opts.title);
+  opts.subtitle = assign({}, opts.subtitle);
+  opts.duration = opts.duration ? opts.duration : 1000;
+  opts.yAxis = assign({}, {
+    data:[],
+    showTitle:false,
+    disabled:false,
+    disableGrid:false,
+    splitNumber:5,
+    gridType: 'solid',
+    dashLength: 4 * opts.pixelRatio,
+    gridColor:'#cccccc',
+    padding:10,
+    fontColor:'#666666'
+  }, opts.yAxis);
+  opts.yAxis.dashLength *= opts.pixelRatio;
+  opts.yAxis.padding *= opts.pixelRatio;
+  opts.xAxis = assign({}, {
+    rotateLabel: false,
+    type: 'calibration',
+    gridType: 'solid',
+    dashLength: 4,
+    scrollAlign: 'left',
+    boundaryGap:'center',
+    axisLine:true,
+    axisLineColor:'#cccccc'
+  }, opts.xAxis);
+  opts.xAxis.dashLength *= opts.pixelRatio;
+  opts.legend = assign({}, {
+    show: true,
+    position: 'bottom',
+    float: 'center',
+    backgroundColor: 'rgba(0,0,0,0)',
+    borderColor: 'rgba(0,0,0,0)',
+    borderWidth: 0,
+    padding: 5,
+    margin: 5,
+    itemGap: 10,
+    fontSize: opts.fontSize,
+    lineHeight: opts.fontSize,
+    fontColor: '#333333',
+    format: {},
+    hiddenColor: '#CECECE'
+  }, opts.legend);
+  opts.legend.borderWidth = opts.legend.borderWidth * opts.pixelRatio;
+  opts.legend.itemGap = opts.legend.itemGap * opts.pixelRatio;
+  opts.legend.padding = opts.legend.padding * opts.pixelRatio;
+  opts.legend.margin = opts.legend.margin * opts.pixelRatio;
+  opts.extra = assign({}, opts.extra);
+  opts.rotate = opts.rotate ? true : false;
+  opts.animation = opts.animation ? true : false;
+	opts.rotate = opts.rotate ? true : false;
+
+  let config$$1 = JSON.parse(JSON.stringify(config));
+  config$$1.colors = opts.colors ? opts.colors : config$$1.colors;
+  config$$1.yAxisTitleWidth = opts.yAxis.disabled !== true && opts.yAxis.title ? config$$1.yAxisTitleWidth : 0;
+  if (opts.type == 'pie' || opts.type == 'ring') {
+    config$$1.pieChartLinePadding = opts.dataLabel === false ? 0 : opts.extra.pie.labelWidth * opts.pixelRatio || config$$1.pieChartLinePadding * opts.pixelRatio;
+  }
+  if (opts.type == 'rose') {
+    config$$1.pieChartLinePadding = opts.dataLabel === false ? 0 : opts.extra.rose.labelWidth * opts.pixelRatio || config$$1.pieChartLinePadding * opts.pixelRatio;
+  }
+  config$$1.pieChartTextPadding = opts.dataLabel === false ? 0 : config$$1.pieChartTextPadding * opts.pixelRatio;
+  config$$1.yAxisSplit = opts.yAxis.splitNumber ? opts.yAxis.splitNumber : config.yAxisSplit;
+
+  //屏幕旋转
+  config$$1.rotate = opts.rotate;
+  if (opts.rotate) {
+    let tempWidth = opts.width;
+    let tempHeight = opts.height;
+    opts.width = tempHeight;
+    opts.height = tempWidth;
+  }
+
+  //适配高分屏
+  opts.padding = opts.padding ? opts.padding : config$$1.padding;
+  for (let i = 0; i < 4; i++) {
+    opts.padding[i] *= opts.pixelRatio;
+  }
+  config$$1.yAxisWidth = config.yAxisWidth * opts.pixelRatio;
+  config$$1.xAxisHeight = config.xAxisHeight * opts.pixelRatio;
+  if (opts.enableScroll && opts.xAxis.scrollShow) {
+    config$$1.xAxisHeight += 6 * opts.pixelRatio;
+  }
+  config$$1.xAxisLineHeight = config.xAxisLineHeight * opts.pixelRatio;
+  config$$1.fontSize = opts.fontSize;
+  config$$1.titleFontSize = config.titleFontSize * opts.pixelRatio;
+  config$$1.subtitleFontSize = config.subtitleFontSize * opts.pixelRatio;
+  config$$1.toolTipPadding = config.toolTipPadding * opts.pixelRatio;
+  config$$1.toolTipLineHeight = config.toolTipLineHeight * opts.pixelRatio;
+  config$$1.columePadding = config.columePadding * opts.pixelRatio;
+  opts.$this = opts.$this ? opts.$this : this;
+  
+  this.context = uni.createCanvasContext(opts.canvasId, opts.$this);
+  /* 兼容原生H5
+  this.context = document.getElementById(opts.canvasId).getContext("2d");
+  this.context.setStrokeStyle = function(e){ return this.strokeStyle=e; }
+  this.context.setLineWidth = function(e){ return this.lineWidth=e; }
+  this.context.setLineCap = function(e){ return this.lineCap=e; }
+  this.context.setFontSize = function(e){ return this.font=e+"px sans-serif"; }
+  this.context.setFillStyle = function(e){ return this.fillStyle=e; }
+  this.context.draw = function(){ }
+  */
+
+  opts.chartData = {};
+  this.event = new Event();
+  this.scrollOption = {
+    currentOffset: 0,
+    startTouchX: 0,
+    distance: 0,
+    lastMoveTime: 0
+  };
+
+  this.opts = opts;
+  this.config = config$$1;
+
+  drawCharts.call(this, opts.type, opts, config$$1, this.context);
+};
+
+Charts.prototype.updateData = function() {
+  let data = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
+  this.opts = assign({}, this.opts, data);
+  this.opts.updateData = true;
+  let scrollPosition = data.scrollPosition || 'current';
+  switch (scrollPosition) {
+    case 'current':
+      this.opts._scrollDistance_ = this.scrollOption.currentOffset;
+      break;
+    case 'left':
+      this.opts._scrollDistance_ = 0;
+      this.scrollOption = {
+        currentOffset: 0,
+        startTouchX: 0,
+        distance: 0,
+        lastMoveTime: 0
+      };
+      break;
+    case 'right':
+      let _calYAxisData = calYAxisData(this.opts.series, this.opts, this.config),
+        yAxisWidth = _calYAxisData.yAxisWidth;
+      this.config.yAxisWidth = yAxisWidth;
+      let offsetLeft = 0;
+      let _getXAxisPoints0 = getXAxisPoints(this.opts.categories, this.opts, this.config),
+        xAxisPoints = _getXAxisPoints0.xAxisPoints,
+        startX = _getXAxisPoints0.startX,
+        endX = _getXAxisPoints0.endX,
+        eachSpacing = _getXAxisPoints0.eachSpacing;
+      let totalWidth = eachSpacing * (xAxisPoints.length - 1);
+      let screenWidth = endX - startX;
+      offsetLeft = screenWidth - totalWidth;
+      this.scrollOption = {
+        currentOffset: offsetLeft,
+        startTouchX: offsetLeft,
+        distance: 0,
+        lastMoveTime: 0
+      };
+      this.opts._scrollDistance_ = offsetLeft;
+      break;
+  }
+  drawCharts.call(this, this.opts.type, this.opts, this.config, this.context);
+};
+
+Charts.prototype.zoom = function() {
+  var val = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : this.opts.xAxis.itemCount;
+  if (this.opts.enableScroll !== true) {
+    console.log('请启用滚动条后使用!')
+    return;
+  }
+  //当前屏幕中间点
+  let centerPoint = Math.round(Math.abs(this.scrollOption.currentOffset) / this.opts.chartData.eachSpacing) + Math.round(
+    this.opts.xAxis.itemCount / 2);
+  this.opts.animation = false;
+  this.opts.xAxis.itemCount = val.itemCount;
+  //重新计算x轴偏移距离
+  let _calYAxisData = calYAxisData(this.opts.series, this.opts, this.config),
+    yAxisWidth = _calYAxisData.yAxisWidth;
+  this.config.yAxisWidth = yAxisWidth;
+  let offsetLeft = 0;
+  let _getXAxisPoints0 = getXAxisPoints(this.opts.categories, this.opts, this.config),
+    xAxisPoints = _getXAxisPoints0.xAxisPoints,
+    startX = _getXAxisPoints0.startX,
+    endX = _getXAxisPoints0.endX,
+    eachSpacing = _getXAxisPoints0.eachSpacing;
+  let centerLeft = eachSpacing * centerPoint;
+  let screenWidth = endX - startX;
+  let MaxLeft = screenWidth - eachSpacing * (xAxisPoints.length - 1);
+  offsetLeft = screenWidth / 2 - centerLeft;
+  if (offsetLeft > 0) {
+    offsetLeft = 0;
+  }
+  if (offsetLeft < MaxLeft) {
+    offsetLeft = MaxLeft;
+  }
+  this.scrollOption = {
+    currentOffset: offsetLeft,
+    startTouchX: offsetLeft,
+    distance: 0,
+    lastMoveTime: 0
+  };
+  this.opts._scrollDistance_ = offsetLeft;
+  drawCharts.call(this, this.opts.type, this.opts, this.config, this.context);
+};
+
+Charts.prototype.stopAnimation = function() {
+  this.animationInstance && this.animationInstance.stop();
+};
+
+Charts.prototype.addEventListener = function(type, listener) {
+  this.event.addEventListener(type, listener);
+};
+
+Charts.prototype.getCurrentDataIndex = function(e) {
+  var touches = null;
+  if (e.changedTouches) {
+    touches = e.changedTouches[0];
+  } else {
+    touches = e.mp.changedTouches[0];
+  }
+  if (touches) {
+    let _touches$ = getTouches(touches, this.opts, e);
+    if (this.opts.type === 'pie' || this.opts.type === 'ring' || this.opts.type === 'rose') {
+      return findPieChartCurrentIndex({
+        x: _touches$.x,
+        y: _touches$.y
+      }, this.opts.chartData.pieData);
+    } else if (this.opts.type === 'radar') {
+      return findRadarChartCurrentIndex({
+        x: _touches$.x,
+        y: _touches$.y
+      }, this.opts.chartData.radarData, this.opts.categories.length);
+    } else if (this.opts.type === 'funnel') {
+      return findFunnelChartCurrentIndex({
+        x: _touches$.x,
+        y: _touches$.y
+      }, this.opts.chartData.funnelData);
+    } else if (this.opts.type === 'map') {
+      return findMapChartCurrentIndex({
+        x: _touches$.x,
+        y: _touches$.y
+      }, this.opts);
+    }else if (this.opts.type === 'word') {
+      return findWordChartCurrentIndex({
+        x: _touches$.x,
+        y: _touches$.y
+      }, this.opts.chartData.wordCloudData);
+    } else {
+      return findCurrentIndex({
+        x: _touches$.x,
+        y: _touches$.y
+      }, this.opts.chartData.calPoints, this.opts, this.config, Math.abs(this.scrollOption.currentOffset));
+    }
+  }
+  return -1;
+};
+
+Charts.prototype.getLegendDataIndex = function(e) {
+  var touches = null;
+  if (e.changedTouches) {
+    touches = e.changedTouches[0];
+  } else {
+    touches = e.mp.changedTouches[0];
+  }
+  if (touches) {
+    let _touches$ = getTouches(touches, this.opts, e);
+    return findLegendIndex({
+      x: _touches$.x,
+      y: _touches$.y
+    }, this.opts.chartData.legendData);
+  }
+  return -1;
+};
+
+Charts.prototype.touchLegend = function(e) {
+  var option = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
+  var touches = null;
+  if (e.changedTouches) {
+    touches = e.changedTouches[0];
+  } else {
+    touches = e.mp.changedTouches[0];
+  }
+  if (touches) {
+    var _touches$ = getTouches(touches, this.opts, e);
+    var index = this.getLegendDataIndex(e);
+    if (index >= 0) {
+      this.opts.series[index].show = !this.opts.series[index].show;
+      this.opts.animation = option.animation ? true : false;
+			this.opts._scrollDistance_= this.scrollOption.currentOffset;
+      drawCharts.call(this, this.opts.type, this.opts, this.config, this.context);
+    }
+  }
+
+};
+
+Charts.prototype.showToolTip = function(e) {
+  var option = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
+  var touches = null;
+  if (e.changedTouches) {
+    touches = e.changedTouches[0];
+  } else {
+    touches = e.mp.changedTouches[0];
+  }
+  if (!touches) {
+    console.log("touchError");
+  }
+  var _touches$ = getTouches(touches, this.opts, e);
+  var currentOffset = this.scrollOption.currentOffset;
+  var opts = assign({}, this.opts, {
+    _scrollDistance_: currentOffset,
+    animation: false
+  });
+  if (this.opts.type === 'line' || this.opts.type === 'area' || this.opts.type === 'column') {
+    var index = option.index==undefined? this.getCurrentDataIndex(e):option.index ;
+    if (index > -1) {
+      var seriesData = getSeriesDataItem(this.opts.series, index);
+      if (seriesData.length !== 0) {
+        var _getToolTipData = getToolTipData(seriesData, this.opts.chartData.calPoints, index, this.opts.categories,option),
+          textList = _getToolTipData.textList,
+          offset = _getToolTipData.offset;
+        offset.y = _touches$.y;
+        opts.tooltip = {
+          textList: option.textList?option.textList:textList,
+          offset: offset,
+          option: option,
+          index: index
+        };
+      }
+    }
+    drawCharts.call(this, opts.type, opts, this.config, this.context);
+  }
+  if (this.opts.type === 'mix') {
+    var index = option.index==undefined? this.getCurrentDataIndex(e):option.index ;
+    if (index > -1) {
+      var currentOffset = this.scrollOption.currentOffset;
+      var opts = assign({}, this.opts, {
+        _scrollDistance_: currentOffset,
+        animation: false
+      });
+      var seriesData = getSeriesDataItem(this.opts.series, index);
+      if (seriesData.length !== 0) {
+        var _getMixToolTipData = getMixToolTipData(seriesData, this.opts.chartData.calPoints, index, this.opts.categories,option),
+          textList = _getMixToolTipData.textList,
+          offset = _getMixToolTipData.offset;
+        offset.y = _touches$.y;
+        opts.tooltip = {
+          textList: option.textList?option.textList:textList,
+          offset: offset,
+          option: option,
+          index: index
+        };
+      }
+    }
+    drawCharts.call(this, opts.type, opts, this.config, this.context);
+  }
+  if (this.opts.type === 'candle') {
+    var index = option.index==undefined? this.getCurrentDataIndex(e):option.index ;
+    if (index > -1) {
+      var currentOffset = this.scrollOption.currentOffset;
+      var opts = assign({}, this.opts, {
+        _scrollDistance_: currentOffset,
+        animation: false
+      });
+      var seriesData = getSeriesDataItem(this.opts.series, index);
+      if (seriesData.length !== 0) {
+        var _getToolTipData = getCandleToolTipData(this.opts.series[0].data, seriesData, this.opts.chartData.calPoints,
+            index, this.opts.categories, this.opts.extra.candle, option),
+          textList = _getToolTipData.textList,
+          offset = _getToolTipData.offset;
+        offset.y = _touches$.y;
+        opts.tooltip = {
+          textList: option.textList?option.textList:textList,
+          offset: offset,
+          option: option,
+          index: index
+        };
+      }
+    }
+    drawCharts.call(this, opts.type, opts, this.config, this.context);
+  }
+  if (this.opts.type === 'pie' || this.opts.type === 'ring' || this.opts.type === 'rose'||this.opts.type === 'funnel' ) {
+    var index = option.index==undefined? this.getCurrentDataIndex(e):option.index ;
+    if (index > -1) {
+      var currentOffset = this.scrollOption.currentOffset;
+      var opts = assign({}, this.opts, {
+        _scrollDistance_: currentOffset,
+        animation: false
+      });
+      var seriesData = this.opts._series_[index];
+      var textList = [{
+        text: option.format ? option.format(seriesData) : seriesData.name + ': ' + seriesData.data,
+        color: seriesData.color
+      }];
+      var offset = {
+        x: _touches$.x,
+        y: _touches$.y
+      };
+      opts.tooltip = {
+        textList: option.textList?option.textList:textList,
+        offset: offset,
+        option: option,
+        index: index
+      };
+    }
+    drawCharts.call(this, opts.type, opts, this.config, this.context);
+  }
+  if (this.opts.type === 'map'||this.opts.type === 'word') {
+    var index = option.index==undefined? this.getCurrentDataIndex(e):option.index ;
+    if (index > -1) {
+      var currentOffset = this.scrollOption.currentOffset;
+      var opts = assign({}, this.opts, {
+        _scrollDistance_: currentOffset,
+        animation: false
+      });
+      var seriesData = this.opts._series_[index];
+      var textList = [{
+        text: option.format ? option.format(seriesData) : seriesData.properties.name ,
+        color: seriesData.color
+      }];
+      var offset = {
+        x: _touches$.x,
+        y: _touches$.y
+      };
+      opts.tooltip = {
+        textList: option.textList?option.textList:textList,
+        offset: offset,
+        option: option,
+        index: index
+      };
+    }
+    opts.updateData = false;
+    drawCharts.call(this, opts.type, opts, this.config, this.context);
+  }
+  if (this.opts.type === 'radar') {
+    var index = option.index==undefined? this.getCurrentDataIndex(e):option.index ;
+    if (index > -1) {
+      var currentOffset = this.scrollOption.currentOffset;
+      var opts = assign({}, this.opts, {
+        _scrollDistance_: currentOffset,
+        animation: false
+      });
+      var seriesData = getSeriesDataItem(this.opts.series, index);
+      if (seriesData.length !== 0) {
+        var textList = seriesData.map(function(item) {
+          return {
+            text: option.format ? option.format(item) : item.name + ': ' + item.data,
+            color: item.color
+          };
+        });
+        var offset = {
+          x: _touches$.x,
+          y: _touches$.y
+        };
+        opts.tooltip = {
+          textList: option.textList?option.textList:textList,
+          offset: offset,
+          option: option,
+          index: index
+        };
+      }
+    }
+    drawCharts.call(this, opts.type, opts, this.config, this.context);
+  }
+};
+
+Charts.prototype.translate = function(distance) {
+  this.scrollOption = {
+    currentOffset: distance,
+    startTouchX: distance,
+    distance: 0,
+    lastMoveTime: 0
+  };
+  let opts = assign({}, this.opts, {
+    _scrollDistance_: distance,
+    animation: false
+  });
+  drawCharts.call(this, this.opts.type, opts, this.config, this.context);
+};
+
+Charts.prototype.scrollStart = function(e) {
+  var touches = null;
+  if (e.changedTouches) {
+    touches = e.changedTouches[0];
+  } else {
+    touches = e.mp.changedTouches[0];
+  }
+  var _touches$ = getTouches(touches, this.opts, e);
+  if (touches && this.opts.enableScroll === true) {
+    this.scrollOption.startTouchX = _touches$.x;
+  }
+};
+
+Charts.prototype.scroll = function(e) {
+  if (this.scrollOption.lastMoveTime === 0) {
+    this.scrollOption.lastMoveTime = Date.now();
+  }
+  let Limit = this.opts.extra.touchMoveLimit || 20;
+  let currMoveTime = Date.now();
+  let duration = currMoveTime - this.scrollOption.lastMoveTime;
+  if (duration < Math.floor(1000 / Limit)) return;
+  this.scrollOption.lastMoveTime = currMoveTime;
+  var touches = null;
+  if (e.changedTouches) {
+    touches = e.changedTouches[0];
+  } else {
+    touches = e.mp.changedTouches[0];
+  }
+  if (touches && this.opts.enableScroll === true) {
+    var _touches$ = getTouches(touches, this.opts, e);
+    var _distance;
+    _distance = _touches$.x - this.scrollOption.startTouchX;
+    var currentOffset = this.scrollOption.currentOffset;
+    var validDistance = calValidDistance(this,currentOffset + _distance, this.opts.chartData, this.config, this.opts);
+    this.scrollOption.distance = _distance = validDistance - currentOffset;
+    var opts = assign({}, this.opts, {
+      _scrollDistance_: currentOffset + _distance,
+      animation: false
+    });
+    drawCharts.call(this, opts.type, opts, this.config, this.context);
+    return currentOffset + _distance;
+  }
+};
+
+Charts.prototype.scrollEnd = function(e) {
+  if (this.opts.enableScroll === true) {
+    var _scrollOption = this.scrollOption,
+      currentOffset = _scrollOption.currentOffset,
+      distance = _scrollOption.distance;
+    this.scrollOption.currentOffset = currentOffset + distance;
+    this.scrollOption.distance = 0;
+  }
+};
+if (typeof module === "object" && typeof module.exports === "object") {
+  module.exports = Charts;
+  //export default Charts;//建议使用nodejs的module导出方式,如报错请使用export方式导出
+}

A diferenza do arquivo foi suprimida porque é demasiado grande
+ 0 - 0
js_sdk/u-charts/u-charts/u-charts.min.js


+ 26 - 14
libs/axios.js

@@ -3,14 +3,19 @@ const baseUrl = getApp().globalData.baseUrl
 //带Token请求
 const request = (opts, hasToken) => {
 	const authorization = getApp().globalData.token
-	// console.log(authorization,'authorization')
+	const changeOrg = getApp().globalData.changeOrg
+	const curVer = getApp().globalData.version
+	console.log(changeOrg, !hasToken,'changeOrg')
 	//  hasToken是否传入token,为true则不传token
 	const header = {
-			'content-Type': 'application/json;charset=UTF-8'
+			'Version': curVer.version?curVer.version.replace(/\./g,''):''
 		}
-	if(!hasToken&&authorization){
-		header['X-AUTH-TOKEN'] = authorization
-	}	
+	if(!hasToken || changeOrg){
+		header['access-token'] = authorization || ''
+	}
+    if(changeOrg){
+		header['access-org'] = changeOrg || ''
+	}
 	//此token是登录成功后后台返回保存在storage中的
 	let DefaultOpts = {
 		url: baseUrl+opts.url,
@@ -18,10 +23,10 @@ const request = (opts, hasToken) => {
 		method: opts.method,
 		header: opts.header ? opts.header : header
 	}
+	console.log(DefaultOpts)
 	let promise = new Promise(function(resolve, reject) {
 		uni.request(DefaultOpts).then(
 			(res) => {
-				console.log(res)
 				// 是否超时已跳转
 				let loginTimeOut = uni.getStorageSync('loginTimeOut');
 				if(res[0]&&res[0].errMsg.indexOf('request:fail')>=0){
@@ -31,6 +36,9 @@ const request = (opts, hasToken) => {
 					})
 				}
 				let ret = res[1]
+				if(!ret.status){
+					ret.status = ret.statusCode
+				}
 				if(res[1].data.status){
 					ret = res[1].data
 				}else if(res[1].status){
@@ -39,24 +47,27 @@ const request = (opts, hasToken) => {
 				if(ret.status == '200'){
 					resolve(ret)
 				}else{
-					if(ret.status == '401'){  //  未登录或登录过期
+					if(ret.status == '401' || ret.status == '1099'){  //  未登录或登录过期
 					    // 除过查询未完成订单的请求
-						if(opts.url.indexOf("order/unFinishedOrderRunStatus")<0){
+						// if(opts.url.indexOf("order/unFinishedOrderRunStatus")<0){
 							uni.showToast({
 								icon:'none',
 								title: '未登录或登录已过期,请重新登录',
 								duration: 5000 
 							})
 							setTimeout(function() {
-							  const currentRoute = getRoutePath();
-							  const url = `/pages/login/pwLogin?lanuch=${currentRoute.lanuch}&path=` + encodeURIComponent(currentRoute.url);
-							  uni.redirectTo({ url });
-							}, 1000);
-						}
+								const currentRoute = getRoutePath();
+								const url = `/pages/login/login`
+								uni.redirectTo({ url })
+							}, 1000)
+						// }
 					}
 					else{
+						console.log(opts.url,'opts.url')
 						if(ret.status == 500){
-							if(opts.url.indexOf("store/validateStoreAndDevice")<0&&opts.url.indexOf("couponReceives/findUsableCoupon")<0){
+							if(
+							opts.url.indexOf("shelfReplenish/detail/outScan")<0&&
+							opts.url.indexOf("shelfReplenish/detail/queryByProductQrCode")<0){
 								uni.showToast({
 									icon:'none',
 									title: ret.message,
@@ -68,6 +79,7 @@ const request = (opts, hasToken) => {
 					}
 					resolve(ret)
 				}
+				// ret.status = ret.statusCode  // mock数据结构改造
 				resolve(ret)
 			}
 		).catch(

+ 20 - 0
libs/helper.js

@@ -0,0 +1,20 @@
+function test (){
+	console.log('test方法');
+}
+
+function IsURL(str_url) {
+    return (/^(?:http(s)?:\/\/)?[\w.-]+(?:\.[\w\.-]+)+[\w\-\._~:/?#[\]@!\$&'\(\)\*\+,;=.]+$/gm).test(str_url);
+}
+
+function AnalysisURL(url) {
+    return /^(https?:\/\/)([0-9a-z.]+)(:[0-9]+)?([/0-9a-z.]+)?(\?[0-9a-z&=]+)?(#[0-9-a-z]+)?/i.exec(url);
+}
+
+
+const permission = {
+	test:test,
+	IsURL:IsURL,
+	AnalysisURL:AnalysisURL
+}
+
+module.exports = permission

+ 112 - 0
libs/printTools.js

@@ -0,0 +1,112 @@
+// 获取文本字节总数
+export const getBytesCount = function(str){
+	var bytesCount = 0;
+	if (str != null) {
+		for (var i = 0; i < str.length; i++) {
+			var c = str.charAt(i);
+			if (c.match(/[^\x00-\xff]/ig) != null) //全角
+			{
+				bytesCount += 2;
+			} else {
+				bytesCount += 1;
+			}
+		}
+	}
+	return bytesCount;
+}
+
+// JS 包含中文的字符串按固定长度拆分换行算法
+export const getTextRows = function(str,iPageSize){
+	var strArray = [];
+	var tempStr = "";
+	var iTotalLength = getBytesCount(str);
+	for (var i = 0; i < str.length; i++) {
+		var iCount = getBytesCount(str[i]);
+		var iCountTemp = getBytesCount(tempStr);
+		//iCountTemp + iCount >= iPageSize 这里可能出现两种情况:
+		//长度等于 iPageSize 或 等于 iPageSize + 1(最后一个为中文字符就等于 9 + 2 情况)
+		if (iCountTemp + iCount >= iPageSize) {
+			tempStr += str[i];
+			strArray.push(tempStr);
+			tempStr = "";
+		} else {
+			tempStr += str[i];
+		}
+	}
+	
+	// //最后一次尾巴
+	if (tempStr.length > 0){
+		strArray.push(tempStr)
+	}
+	return strArray
+}
+// 格式化打印文本
+export const textFormat = function(command,text,maxFontNums,left,top,lightHeight,align,fontSize){
+	let rowTop = top
+	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 = 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+rowHeight*fontSize+10
+	}
+	return rowTop
+}
+export const printText = function(tsc,text){
+	const command = tsc.jpPrinter.createNew()
+	command.init()
+	command.setSize(40, 30) // 标签纸张宽高,单位mm
+	command.setGap(3) // 标签上下间距,单位mm
+	command.setCls() // 清除缓冲区数据
+	command.setText(100, 48, "5", 4, 3, text)
+	command.setPagePrint(1,1) // 打印分数1,每个标签重发打印2次
+	return command
+}
+// 60 * 40 尺寸模板
+export const printTempl = function(tsc,data){
+	let top = 24 // 距离顶部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+1.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-1.2,rightLeft,rightTop,lightHeight,"center",2)
+	// 二维码
+	command.setQR(rightLeft, qrtop, "M", 5, "A", data.barCode)
+	command.setPagePrint(1,data.currentInven) // 打印分数1,每个标签重发打印2次
+	console.log("开始打印了",command.getData())
+	return command
+}

+ 100 - 58
libs/tools.js

@@ -1,6 +1,29 @@
-let carmera = uni.requireNativePlugin('uniplugin_camerascan')
+let carmera = uni.requireNativePlugin('ziteng-maskcamera')
 let cameraModule = uni.requireNativePlugin("SMUniPlugin-CameraModule")
 
+// 处理数字千位分隔符  num 数值,decimal要保留的小数位数
+export const toThousands = (num, decimal) => {
+  if (decimal) {
+    num = formatDecimal(num, decimal)
+  }
+  return num.toString().replace(/\d+/, function (n) { // 先提取整数部分
+    return n.replace(/(\d)(?=(\d{3})+$)/g, function ($1) {
+      return $1 + ','
+    })
+  })
+}
+// 保留decimal位小数(不四舍五入)  num 数值,decimal要保留的小数位数
+export const formatDecimal = function (num, decimal) {
+  num = num.toString()
+  const index = num.indexOf('.')
+  if (index !== -1) {
+    num = num.substring(0, decimal + index + 1)
+  } else {
+    num = num.substring(0)
+  }
+  return parseFloat(num).toFixed(decimal)
+}
+
 export function objToUrl(obj) {
   let uri = '';
   let keys = Object.keys(obj);
@@ -12,6 +35,13 @@ export function objToUrl(obj) {
 
   return uri;
 }
+// 获取地址栏参数
+export function getQueryString(url, name) {
+	var reg = new RegExp("(^|&)"+ name +"=([^&]*)(&|$)")
+	var r = url.substr(1).match(reg)
+	if(r!=null) return  unescape(r[2])
+	return null
+}
 // 节流函数
 export function throttle(fn, gaptime) {
 	if (gaptime == null || gaptime == undefined) {
@@ -58,21 +88,25 @@ export const imgToBase64 = function (path,callback){
 export const openCamera = function (type,callback){
 	let carNumberOptions = {
 		 widthRatio: 0.8,
-		 heightRatio: 0.3,
+		 heightRatio: 0.2,
 		 showText: '请将车牌号码对准框中'
 	}
 	let carVinNumberOptions = {
-		 widthRatio: 1,
-		 heightRatio: 0.15,
+		 widthRatio: 0.9,
+		 heightRatio: 0.1,
 		 showText: '请将车辆VIN码对准框中'
 	}
 	let option = (type == 'searchCar'  || type == 'carNumber') ? carNumberOptions : carVinNumberOptions
 	// 竖屏 false,横屏 true
-	let isLandscape = (type == 'searchCar'  || type == 'carNumber') ? false : true
+	let isLandscape = false
 	//安卓摄像头
 	if(uni.getSystemInfoSync().platform === 'android'){
+		option.isLandscape = isLandscape
 		carmera.show(option,function(result){
-			callback(result)
+			console.log(result)
+			if(result.msg != 'backCancel'){
+				callback(result.data)
+			}
 		})
 	}
 	// ios 摄像头
@@ -88,7 +122,7 @@ export const openCamera = function (type,callback){
 			y = (screenHeight - h)/2
 		}else{
 			// 竖屏
-			w = screenWidth*option.widthRatio*0.9
+			w = screenWidth*option.widthRatio
 			h = screenHeight*option.heightRatio
 			x = (screenWidth - w)/2
 			y = (screenHeight - h)/2 - 50
@@ -101,7 +135,7 @@ export const openCamera = function (type,callback){
 		  'isLandscape': isLandscape
 		 },
 		 (result) => {
-			  callback({path:'file://'+result})
+			  callback('file://'+result)
 		 })
 	}
 }
@@ -234,14 +268,21 @@ export const  setStorageForAppVersion = function(currTimeStamp){
  * @param {Object} server_version 服务器最新 应用版本号
  * @param {Object} curr_version 当前应用版本号
  * isQzgx 是否强制更新
- * market 打开应用市场
+ * callback 登录
  */
-export const checkVersionToLoadUpdate = function(newVersion,type,market){
-	console.log(newVersion)
-	const curVer = getApp().globalData.version
-	const server_version = newVersion.version
-	const curr_version = curVer.versionCode
-	const isQzgx = newVersion.forceUpgrade != 1
+export const checkVersionToLoadUpdate = function(newVersion,type,callback){
+	if(newVersion.version == '2001'||newVersion.version == '2002'){
+		newVersion.version = 201
+	}
+	const curVer = getApp().globalData.version  // 当前版本信息
+	console.log(newVersion,curVer,callback)
+	if(!newVersion || !curVer){
+		callback()
+		return
+	}
+	const curr_version = curVer && curVer.version ? curVer.version.replace(/\./g,'') : ''
+	const server_version = newVersion && newVersion.version ? newVersion.version : '' // 最新版本信息
+	const isQzgx = newVersion && newVersion.forceUpgrade != 1
 	let isWifi = plus.networkinfo.getCurrentType()!=3 ? '有新的版本发布,检测到您目前非Wifi连接,' : '有新的版本发布,'
 	let msg = isWifi + (!isQzgx ? '请立即更新?' : '是否立即更新版本?')
 	// 下载app并安装
@@ -274,57 +315,35 @@ export const checkVersionToLoadUpdate = function(newVersion,type,market){
 	// 打开ios 应用市场
 	let openIosAppSotre = function(downloadUrl){
 		//在App Store Connect中的App Store下的app信息,可找到appleId
-		// let appleId= 111111111
 		plus.runtime.launchApplication({
-			// action: `itms-apps://itunes.apple.com/cn/app/id${appleId}?mt=8`
 			action: downloadUrl
 		}, function(e) {
 			console.log('Open system default browser failed: ' + e.message);
 		})
 	}
-	// 打开应用市场
-	// const marketOpen = function(){
-	// 	market.open({
-	// 		ios:'',
-	// 		android:'com.zyucgj.car'
-	// 	});
-	// }
+	console.log(server_version,curr_version)
 	if(Number(server_version) > Number(curr_version)){
-		// #ifndef APP-PLUS
-			uni.showModal({
-				title: msg,
-				content: '更新内容:'+newVersion.upgradeContent,
-				showCancel: isQzgx,
-				confirmText:'立即更新',
-				cancelText:'稍后进行',
-				success: function (res) {
-					if (res.confirm) {
-						if(curVer.platform == 'android'){
-							//设置 最新版本apk的下载链接
-							downloadApp(newVersion.attachment);
-						}else{
-							openIosAppSotre(newVersion.downloadUrl)
-						}
-						// marketOpen()
-					} else if (res.cancel) {
-						console.log('稍后更新');
-					}
-				}
-			});
-		// #endif
-		// #ifdef APP-PLUS
-			plus.nativeUI.confirm('更新内容:'+newVersion.upgradeContent, function(e){
-				if(e.index == 0){  //  确认
+		uni.showModal({
+			title: msg,
+			content: '更新内容:'+newVersion.upgradeContent,
+			showCancel: isQzgx,
+			confirmText:'立即更新',
+			cancelText:'稍后进行',
+			success: function (res) {
+				if (res.confirm) {
 					if(curVer.platform == 'android'){
-						//设置最新版本apk的下载链接
+						//设置 最新版本apk的下载链接
 						downloadApp(newVersion.attachment);
 					}else{
 						openIosAppSotre(newVersion.downloadUrl)
 					}
-					// marketOpen()
+				} else if (res.cancel) {
+					console.log('稍后更新');
+					callback()
 				}
-			},{"title":msg,"buttons": !isQzgx ? ["立即更新"] : ["立即更新","稍后进行"]})
-		// #endif
+			}
+		});
+		uni.hideLoading();
 	}else{
 		if(type){
 			uni.showToast({
@@ -332,6 +351,8 @@ export const checkVersionToLoadUpdate = function(newVersion,type,market){
 				title: '已是最新版本',
 				duration: 1500  
 			}); 
+		}else{
+			callback()
 		}
 	}
 }
@@ -376,9 +397,30 @@ export const numberToFixed = function (val, num, max) {
   else if (num == 5)_value = _value.replace(/^(\-)*(\d+)\.(\d\d\d\d\d).*$/, '$1$2.$3')
   else if (num == 0)_value = _value.indexOf('.') >= 0 ? _value.split('.')[0] : _value
   else _value = _value.replace(/^(\-)*(\d+)\.(\d\d).*$/, '$1$2.$3')
-  return _value > maxNums ? maxNums : _value
+  // console.log(_value,maxNums,Number(_value)>Number(maxNums),'_value')
+  return Number(_value)>Number(maxNums) ? maxNums : _value
 }
-
-
-
-  
+// 保存图片到阿里云
+export const saveImgToAliOss = function(src,callback){
+	console.log(src,getApp().globalData.baseUrl,'getApp().globalData.baseUrl')
+	const authorization = getApp().globalData.token
+	uni.uploadFile({
+		url: getApp().globalData.baseUrl + 'upload/', //自行修改各自的对应的接口 
+		filePath: src,
+		name: 'file',
+		header: {'X-AUTH-TOKEN':authorization},
+		success: (uploadFileRes) => {
+			if (uploadFileRes) {
+				let res = JSON.parse(uploadFileRes.data);
+				callback(res)
+			}
+			uni.showToast({
+				icon: 'none',
+				title: uploadFileRes ? '保存图片成功' : '保存图片失败'
+			})
+		},
+		fail:(error) => {
+			console.log(error)
+		}
+	});
+}

+ 6 - 1
libs/validate.js

@@ -2,4 +2,9 @@
 export const isvalidPhone = function (str) {
   const reg = /^1[0-9]{10}$/
   return reg.test(str)
-}
+}
+//  正则数字或大小写字母
+export const isvalidNumLetter = function (str) {
+  const reg = /^[0-9A-Za-z]+$/
+  return reg.test(str)
+}

+ 25 - 11
main.js

@@ -1,6 +1,7 @@
 import Vue from 'vue'
 import App from './App'
 import store from '@/store'
+import getConfig from '@/config'
 Vue.config.productionTip = false
 
 App.mpType = 'app'
@@ -9,16 +10,19 @@ Vue.use(uView)
 
 let vuexStore = require("@/store/$u.mixin.js")
 Vue.mixin(vuexStore)
-/*
-* 提示信息
-*/ 
-Vue.prototype.toashMsg = function (title) {
-	title = title == undefined ? "系统繁忙" : title;
-	uni.showToast({
-		title:title,
-		icon:'none',
-		duration: 2000
-	})
+
+// 系统配置
+Vue.prototype.$config = function (key) {
+	const envText = {pro:'生产环境',dev:'开发环境',uat:'预发布环境'}
+	const theme = getApp().globalData.theme
+	const config = getConfig(theme)
+	if(key == 'init'){
+		let buildType = getApp().globalData.buildType
+		let baseUrl = config[buildType+'_URL']
+		getApp().globalData.baseUrl = baseUrl
+		getApp().globalData.envTips = envText[buildType]
+	}
+	return config[key]
 }
 /**
  * 权限检查
@@ -26,7 +30,6 @@ Vue.prototype.toashMsg = function (title) {
 Vue.prototype.$hasPermissions = function (value) {
  let isExist = false;
  let permissionsStr = store.state.vuex_userData.permCodes;
- // console.log(permissionsStr,'permissionsStr')
  if (permissionsStr == undefined || permissionsStr == null) {
   return false;
  }
@@ -38,6 +41,17 @@ Vue.prototype.$hasPermissions = function (value) {
  }
  return isExist;
 }
+/*
+* 提示信息
+*/ 
+Vue.prototype.toashMsg = function (title) {
+	title = title == undefined ? "系统繁忙" : title;
+	uni.showToast({
+		title:title,
+		icon:'none'
+	})
+}
+
 const app = new Vue({
 	store,
     ...App

+ 119 - 22
manifest.json

@@ -1,9 +1,9 @@
 {
-    "name" : "乐色助手",
-    "appid" : "__UNI__D3A9765",
-    "description" : "乐色助手合作商小程序",
-    "versionName" : "1.0.0",
-    "versionCode" : "100",
+    "name" : "iSCM智慧供应链",
+    "appid" : "__UNI__5B57B68",
+    "description" : "iSCM智慧供应链系统",
+    "versionName" : "1.1.1",
+    "versionCode" : 111,
     "transformPx" : false,
     /* 5+App特有相关 */
     "app-plus" : {
@@ -16,41 +16,138 @@
             "autoclose" : true,
             "delay" : 0
         },
+        "compatible" : {
+            "ignoreVersion" : true //true表示忽略版本检查提示框,HBuilderX1.9.0及以上版本支持  
+        },
+        /*关闭默认的沉浸式状态栏*/
+        "statusbar" : {
+            "immersed" : true
+        },
+        "privacy" : {
+            "prompt" : "template", //可取值template、custom、none  
+            "template" : {
+                //prompt取值为template时有效,用于配置模板提示框上显示的内容  
+                "title" : "服务协议和隐私政策",
+                "message" : "为了更好地保障您的个人利益,我们根据相关法规制定了<a href=\"http://static.chelingzhu.com/app/zycgjYsxy.html\">《章鱼车管家隐私保护政策》</a>,请您在点击同意之前仔细阅读并充分理解相关条款。<br/>1. 为了给您提供账号登录、 消息通知等相关基本服务, 我们会根据实际需要收集必要的用户信息; <br/>2. 基于您的授权, 我们会根据不同的功能获取您不同的权限, 涉及位置、 相机、 相册等权限。 您有权拒绝或取消授权; <br/>3. 未经您同意, 我们不会从第三方处获取或向其提供您的信息; <br/>4. 我们会采取业界先进的安全措施保护您的信息安全; <br/>5. 当您点击“ 同意” 时, 视为您已阅读和愿意接受《 章鱼车管家隐私保护政策》的所有内容。 当您点击“ 不同意” 时, 我们将无法为您提供相关产品和服务, 请停止使用并退出本应用。",
+                "buttonAccept" : "同意并接受",
+                "buttonRefuse" : "暂不同意",
+                "second" : {
+                    "title" : "确认提示",
+                    "message" : "进入应用前,你需先同意<a href=\"http://static.chelingzhu.com/app/zycgjYsxy.html\">《章鱼车管家隐私保护政策》</a>,否则将退出应用。",
+                    "buttonAccept" : "同意并继续",
+                    "buttonRefuse" : "退出应用"
+                }
+            }
+        },
+        "safearea" : {
+            "background" : "#ffffff",
+            "backgroundDark" : "#2f0508",
+            "bottom" : {
+                "offset" : "auto"
+            },
+            "left" : {
+                "offset" : "auto"
+            },
+            "right" : {
+                "offset" : "auto"
+            }
+        },
         /* 模块配置 */
-        "modules" : {},
+        "modules" : {
+            "Bluetooth" : {}
+        },
         /* 应用发布信息 */
         "distribute" : {
             /* android打包配置 */
             "android" : {
                 "permissions" : [
-                    "<uses-permission android:name=\"android.permission.CHANGE_NETWORK_STATE\"/>",
-                    "<uses-permission android:name=\"android.permission.MOUNT_UNMOUNT_FILESYSTEMS\"/>",
-                    "<uses-permission android:name=\"android.permission.READ_CONTACTS\"/>",
-                    "<uses-permission android:name=\"android.permission.VIBRATE\"/>",
-                    "<uses-permission android:name=\"android.permission.READ_LOGS\"/>",
-                    "<uses-permission android:name=\"android.permission.ACCESS_WIFI_STATE\"/>",
+                    "<uses-feature android:name=\"android.hardware.camera\"/>",
                     "<uses-feature android:name=\"android.hardware.camera.autofocus\"/>",
-                    "<uses-permission android:name=\"android.permission.WRITE_CONTACTS\"/>",
+                    "<uses-permission android:name=\"android.permission.ACCESS_COARSE_LOCATION\"/>",
+                    "<uses-permission android:name=\"android.permission.ACCESS_FINE_LOCATION\"/>",
                     "<uses-permission android:name=\"android.permission.ACCESS_NETWORK_STATE\"/>",
+                    "<uses-permission android:name=\"android.permission.ACCESS_WIFI_STATE\"/>",
+                    "<uses-permission android:name=\"android.permission.CALL_PHONE\"/>",
                     "<uses-permission android:name=\"android.permission.CAMERA\"/>",
-                    "<uses-permission android:name=\"android.permission.RECORD_AUDIO\"/>",
+                    "<uses-permission android:name=\"android.permission.CHANGE_NETWORK_STATE\"/>",
+                    "<uses-permission android:name=\"android.permission.CHANGE_WIFI_STATE\"/>",
+                    "<uses-permission android:name=\"android.permission.FLASHLIGHT\"/>",
                     "<uses-permission android:name=\"android.permission.GET_ACCOUNTS\"/>",
                     "<uses-permission android:name=\"android.permission.MODIFY_AUDIO_SETTINGS\"/>",
+                    "<uses-permission android:name=\"android.permission.MOUNT_UNMOUNT_FILESYSTEMS\"/>",
+                    "<uses-permission android:name=\"android.permission.READ_LOGS\"/>",
                     "<uses-permission android:name=\"android.permission.READ_PHONE_STATE\"/>",
-                    "<uses-permission android:name=\"android.permission.CHANGE_WIFI_STATE\"/>",
+                    "<uses-permission android:name=\"android.permission.RECORD_AUDIO\"/>",
+                    "<uses-permission android:name=\"android.permission.VIBRATE\"/>",
                     "<uses-permission android:name=\"android.permission.WAKE_LOCK\"/>",
-                    "<uses-permission android:name=\"android.permission.CALL_PHONE\"/>",
-                    "<uses-permission android:name=\"android.permission.FLASHLIGHT\"/>",
-                    "<uses-permission android:name=\"android.permission.ACCESS_COARSE_LOCATION\"/>",
-                    "<uses-feature android:name=\"android.hardware.camera\"/>",
-                    "<uses-permission android:name=\"android.permission.ACCESS_FINE_LOCATION\"/>",
+                    "<uses-permission android:name=\"android.permission.WRITE_CONTACTS\"/>",
                     "<uses-permission android:name=\"android.permission.WRITE_SETTINGS\"/>"
                 ]
             },
             /* ios打包配置 */
-            "ios" : {},
+            "ios" : {
+                "idfa" : false
+            },
             /* SDK配置 */
-            "sdkConfigs" : {}
+            "sdkConfigs" : {
+                "ad" : {}
+            },
+            "icons" : {
+                "android" : {
+                    "hdpi" : "unpackage/res/icons/72x72.png",
+                    "xhdpi" : "unpackage/res/icons/96x96.png",
+                    "xxhdpi" : "unpackage/res/icons/144x144.png",
+                    "xxxhdpi" : "unpackage/res/icons/192x192.png"
+                },
+                "ios" : {
+                    "appstore" : "证书/安卓/deskicon1.png",
+                    "ipad" : {
+                        "app" : "unpackage/res/icons/76x76.png",
+                        "app@2x" : "unpackage/res/icons/152x152.png",
+                        "notification" : "unpackage/res/icons/20x20.png",
+                        "notification@2x" : "unpackage/res/icons/40x40.png",
+                        "proapp@2x" : "unpackage/res/icons/167x167.png",
+                        "settings" : "unpackage/res/icons/29x29.png",
+                        "settings@2x" : "unpackage/res/icons/58x58.png",
+                        "spotlight" : "unpackage/res/icons/40x40.png",
+                        "spotlight@2x" : "unpackage/res/icons/80x80.png"
+                    },
+                    "iphone" : {
+                        "app@2x" : "unpackage/res/icons/120x120.png",
+                        "app@3x" : "unpackage/res/icons/180x180.png",
+                        "notification@2x" : "unpackage/res/icons/40x40.png",
+                        "notification@3x" : "unpackage/res/icons/60x60.png",
+                        "settings@2x" : "unpackage/res/icons/58x58.png",
+                        "settings@3x" : "unpackage/res/icons/87x87.png",
+                        "spotlight@2x" : "unpackage/res/icons/80x80.png",
+                        "spotlight@3x" : "unpackage/res/icons/120x120.png"
+                    }
+                }
+            },
+            "splashscreen" : {
+                "androidStyle" : "default",
+                "android" : {
+                    "hdpi" : "证书/安卓/480-762.png",
+                    "xhdpi" : "证书/安卓/720-1240.png",
+                    "xxhdpi" : "证书/安卓/1080-1882.png"
+                }
+            }
+        },
+        "nativePlugins" : {
+            "wss-scan" : {
+                "__plugin_info__" : {
+                    "name" : "华为ScanKit统一扫码插件,支持连续扫描模式,安卓-IOS双端",
+                    "description" : "基于华为HMS ScanKit的统一扫码插件,支持连续和多码扫描模式,支持component组件模式,支持横屏模式",
+                    "platforms" : "Android,iOS",
+                    "url" : "https://ext.dcloud.net.cn/plugin?id=2683",
+                    "android_package_name" : "com.iscm.arrow360",
+                    "ios_bundle_id" : "com.iscm.arrow360",
+                    "isCloud" : true,
+                    "bought" : 1,
+                    "pid" : "2683",
+                    "parameters" : {}
+                }
+            }
         }
     },
     /* 快应用特有相关 */

+ 21 - 0
nativePlugins/Mpaas-Scan/ios/meta.config

@@ -0,0 +1,21 @@
+{
+	"appId":"ALIPUB2400B57211104",
+	"appKey":"ALIPUB2400B57211104_IOS",
+	"base64Code":"/9j/4AAQSkZJRgABAQEAYABgAAD/2wBDAAMCAgMCAgMDAwMEAwMEBQgFBQQEBQoHBwYIDAoMDAsKCwsNDhIQDQ4RDgsLEBYQERMUFRUVDA8XGBYUGBIUFRT/2wBDAQMEBAUEBQkFBQkUDQsNFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBT/wAARCAADAAMDASIAAhEBAxEB/8QAHwAAAQUBAQEBAQEAAAAAAAAAAAECAwQFBgcICQoL/8QAtRAAAgEDAwIEAwUFBAQAAAF9AQIDAAQRBRIhMUEGE1FhByJxFDKBkaEII0KxwRVS0fAkM2JyggkKFhcYGRolJicoKSo0NTY3ODk6Q0RFRkdISUpTVFVWV1hZWmNkZWZnaGlqc3R1dnd4eXqDhIWGh4iJipKTlJWWl5iZmqKjpKWmp6ipqrKztLW2t7i5usLDxMXGx8jJytLT1NXW19jZ2uHi4+Tl5ufo6erx8vP09fb3+Pn6/8QAHwEAAwEBAQEBAQEBAQAAAAAAAAECAwQFBgcICQoL/8QAtREAAgECBAQDBAcFBAQAAQJ3AAECAxEEBSExBhJBUQdhcRMiMoEIFEKRobHBCSMzUvAVYnLRChYkNOEl8RcYGRomJygpKjU2Nzg5OkNERUZHSElKU1RVVldYWVpjZGVmZ2hpanN0dXZ3eHl6goOEhYaHiImKkpOUlZaXmJmaoqOkpaanqKmqsrO0tba3uLm6wsPExcbHyMnK0tPU1dbX2Nna4uPk5ebn6Onq8vP09fb3+Pn6/9oADAMBAAIRAxFobXF3wCxH620a26O9fkG50BGH62kFAwABAQAAAAQAAB4AAADAAAAAEQAAAIkAAAABAAAAAAAAAAAAAAAAAAAAAAAAABUAAAABAAAAAAAAAAAAAAAIAAAAAAAAAMECE2J3AAAAAAAAAAAAAAASGJyJ3t7I4R1TSR2OOAG9+dGj3gu8IkrSobU3FnENKImpsWeIekmlzZLCW8rDGMOUvKKfeMTpSmWegXt1cmdjbngBAwF4dWZ3AwECBgEAEQEBCAFxdHNqb3axtJ9VTteqT5d6sLzJ4VEvhLp0Q5615rYdsnVyuM62QOfpiYf20Wm3rKGnX0mZGv/5hDKiSN1rVEuO8r+BRnqbB4q4wSUWxrH8tuokvBcj4+qaBYk4iGcmDCyXE5Ld9mcQEJbgrBf6lZeIejxNWBlbUXJBXfSnfTNnFjm5FN8r1JOH8r3PnKYylgCo5kyWCVrxV0XxVOiSNW7U46iGXVZlOLMg394GUDYSP0ZHZgElcUnHqVKmsDFoy+lWPwjQ1GuCe0MWR2tpscug1P8AAMKgGAYAAAAA",
+	"bundleId":"com.iscm.arrow360",
+	"rootPath":"mpaas/ios/ALIPUB2400B57211104-default",
+	"workspaceId":"default",
+	"syncport":"443",
+	"syncserver":"msync.mpaas.cn-hangzhou.aliyuncs.com",
+	"pushPort":"443",
+	"pushGW":"push.mpaas.cn-hangzhou.aliyuncs.com",
+	"rpcGW":"https://mgw.mpaas.cn-hangzhou.aliyuncs.com/mgw.htm",
+	"logGW":"https://mdap.mpaas.cn-hangzhou.aliyuncs.com",
+	"mpaasapi":"https://mpaasapi.mpaas.cn-hangzhou.aliyuncs.com/mgw.htm",
+	"mrtcserver":"wss://mrtc.mpaas.cn-hangzhou.aliyuncs.com/ws",
+	"mdc":"https://mdc.mpaas.cn-hangzhou.aliyuncs.com",
+	"mpaasConfigVersion":"V_1.0",
+	"mpaasConfigEnv":"ONEX_CLOUD",
+	"mpaasConfigPluginExpired":"",
+	"mpaasConfigLicense":"hsa9ApQd3NEmIAkdza/VoAjcFyHdMywwuz7/Wd24HBPq+x7ONeq+kFTrz28WQ1GbMdRiu7OCvahmhutQWHnxKo+bzZl32h95Pd8grTDQjNGq91bNW5K6keKK/6uIYpXExYkef4evd+8yobsSsFQKs8eER5MLnEqzJ9hlCqNhm89RitfvsTph5xDzIf+l6bf6gLiLtnPZwFZNKrWGk9KU8HY1jUDxZn1FD6qaae6mKHBtOJy/1cGqVXioM36ZWQgemI3QeXmJlY74410LW0c2I8/4o+y495A2LOMhJkswC5ePnwGLMLiBf2XryPBIpAL0i7IphirQuK73uuGRDBiYsw=="
+}

BIN=BIN
nativePlugins/SMUniPlugin/ios/SMCameraScan.bundle/Info.plist


BIN=BIN
nativePlugins/SMUniPlugin/ios/SMCameraScan.bundle/icon_close.png


BIN=BIN
nativePlugins/SMUniPlugin/ios/SMCameraScan.bundle/icon_close@2x.png


BIN=BIN
nativePlugins/SMUniPlugin/ios/SMCameraScan.bundle/icon_close@3x.png


BIN=BIN
nativePlugins/SMUniPlugin/ios/SMCameraScan.bundle/icon_take_photo.png


BIN=BIN
nativePlugins/SMUniPlugin/ios/SMCameraScan.bundle/icon_take_photo@2x.png


BIN=BIN
nativePlugins/SMUniPlugin/ios/SMCameraScan.bundle/icon_take_photo@3x.png


BIN=BIN
nativePlugins/SMUniPlugin/ios/SMCameraScanPlugin.framework/Info.plist


BIN=BIN
nativePlugins/SMUniPlugin/ios/SMCameraScanPlugin.framework/SMCameraScanPlugin


+ 0 - 21
nativePlugins/SMUniPlugin/package.json

@@ -1,21 +0,0 @@
-{
-	"name": "CameraModule",
-	"id": "SMUniPlugin",
-	"version": "1.0.0",
-	"description": "照相机插件",
-	"_dp_type": "nativeplugin",
-	"_dp_nativeplugin": {
-		"ios": {
-			"plugins": [{
-				"type": "module",
-				"name": "SMUniPlugin-CameraModule",
-				"class": "CameraModule"
-			}],
-			"integrateType": "framework",
-			"deploymentTarget": "9.0",
-			"resources": [
-				"SMCameraScan.bundle"
-			]
-		}
-	}
-}

BIN=BIN
nativePlugins/uniplugin_camerascan/android/uniplugin_camerascan.aar


+ 0 - 28
nativePlugins/uniplugin_camerascan/package.json

@@ -1,28 +0,0 @@
-{  
-    "name": "uniplugin_camerascan",  
-    "id": "uniplugin_camerascan",  
-    "version": "1.0",  
-    "description": "通过相机,拍照固定大小的照片",  
-    "_dp_type":"nativeplugin",  
-    "_dp_nativeplugin":{  
-        "android": {  
-            "plugins": [  
-                {  
-                    "type": "module",  
-                    "name": "uniplugin_camerascan",  
-                    "class": "uni.elliot.dcloud.uniplugin_camerascan.CameraScanWXModule"  
-                }  
-            ],   
-            "integrateType": "aar",  
-            "dependencies": [],  
-            "compileOptions": {  //可选,Java编译参数配置  
-                "sourceCompatibility": "1.8",  
-                "targetCompatibility": "1.8"  
-            }, 
-            "minSdkVersion": "23",  
-            "permissions": [  
-                "android.permission.CAMERA","android.permission.WRITE_EXTERNAL_STORAGE"
-            ]
-        }
-    }  
-}

+ 6 - 1
package-lock.json

@@ -1,9 +1,14 @@
 {
-  "name": "zxyj-mini-html",
+  "name": "qpls-md-app",
   "version": "1.0.0",
   "lockfileVersion": 1,
   "requires": true,
   "dependencies": {
+    "moment": {
+      "version": "2.29.1",
+      "resolved": "https://registry.npmjs.org/moment/-/moment-2.29.1.tgz",
+      "integrity": "sha512-kHmoybcPV8Sqy59DwNDY3Jefr64lK/by/da0ViFcuA4DH0vQg5Q6Ze5VimxkfQNSC+Mls/Kx53s7TjP1RhFEDQ=="
+    },
     "uview-ui": {
       "version": "1.8.4",
       "resolved": "https://registry.npmjs.org/uview-ui/-/uview-ui-1.8.4.tgz",

+ 3 - 2
package.json

@@ -1,5 +1,5 @@
 {
-  "name": "zxyj-mini-html",
+  "name": "qpls-md-app",
   "version": "1.0.0",
   "description": "",
   "main": "main.js",
@@ -8,12 +8,13 @@
   },
   "repository": {
     "type": "git",
-    "url": "http://git.chelingzhu.com/chelingzhu-web/zxyj-mini-html.git"
+    "url": "http://git.chelingzhu.com/jianguan-web/qpls-md-app.git"
   },
   "keywords": [],
   "author": "",
   "license": "ISC",
   "dependencies": {
+    "moment": "^2.29.1",
     "uview-ui": "^1.8.4"
   }
 }

+ 292 - 36
pages.json

@@ -4,38 +4,37 @@
 	},
 	"pages": [ //pages数组中第一项表示应用启动页,参考:https://uniapp.dcloud.io/collocation/pages
 		{
-			"path": "pages/login/pwLogin",
+			"path": "pages/login/login",
 			"style": {
-				"navigationBarTitleText": "密码登录"
+				"navigationBarTitleText": ""
 			}
 		},
 		{
-			"path": "pages/cleared/index", // 扫码记录
+			"path": "pages/index/index", // 货架
 			"style": {
-				"navigationBarTitleText": "扫码记录",
+				"navigationBarTitleText": "货架",
 				"enablePullDownRefresh": false
 			}
 		},
 		{
-			"path": "pages/index/index", // 首页
+			"path": "pages/login/userAuthYs",
 			"style": {
-				"navigationBarTitleText": "首页",
-				"enablePullDownRefresh": false
+				"navigationBarTitleText": "注意事项及服务协议"
 			}
 		},
-		
 		{
-			"path": "pages/userCenter/index",
+			"path": "pages/login/forget-pass",
 			"style": {
-				"navigationBarTitleText": "个人中心",
-				"navigationBarBackgroundColor": "#ed1c24",
-				"navigationBarTextStyle": "white"
+				"navigationBarTitleText": "忘记密码"
 			}
 		},
 		{
-			"path": "pages/agreement/agreement",
+			"path": "pages/userCenter/index",
 			"style": {
-				"navigationBarTitleText": "注意事项及服务协议"
+				"enablePullDownRefresh": false,
+				"navigationStyle": "custom",
+				// 将回弹属性关掉
+				"bounce":"none"
 			}
 		},
 		{
@@ -44,10 +43,271 @@
 				"navigationBarTitleText": "修改密码"
 			}
 		}
+        ,{
+            "path" : "pages/latePlay/chooseBulk",
+            "style" :                                                                                    
+            {
+                "navigationBarTitleText": "选择货柜",
+                "enablePullDownRefresh": false
+            }
+        }
+        ,{
+            "path" : "pages/latePlay/chooseProduct",
+            "style" :                                                                                    
+            {
+                "navigationBarTitleText": "补打贴签",
+                "enablePullDownRefresh": false
+            }
+        },
+		{
+		    "path" : "pages/index/printAbc",
+		    "style" :                                                                                    
+		    {
+		        "navigationBarTitleText": "打印ABC",
+		        "enablePullDownRefresh": false
+		    }
+		},
+		{
+            "path" : "pages/shuntBackManage/shuntBackList",
+            "style" :                                                                                    
+            {
+                "navigationBarTitleText": "调回管理",
+                "enablePullDownRefresh": false
+            }
+        },
+		{
+            "path" : "pages/shuntBackManage/cancellingStocks",
+            "style" :                                                                                    
+            {
+                "navigationBarTitleText": "调回退库",
+                "enablePullDownRefresh": false,
+				"titleView":false,
+				// 将回弹属性关掉
+				"bounce":"none"
+            }
+        },
+		{
+		    "path" : "pages/shuntBackManage/detail",
+		    "style" :                                                                                    
+		    {
+		        "navigationBarTitleText": "调回详情",
+		        "enablePullDownRefresh": false
+		    }
+		},
+		{
+		    "path" : "pages/replenishmentManage/replenishmentList",
+		    "style" :
+		    {
+		        "navigationBarTitleText": "补货管理",
+		        "enablePullDownRefresh": false
+		    }
+		},
+		{
+			"path" : "pages/replenishmentManage/confirm",
+			"style" :
+			{
+				"navigationBarTitleText": "补货确认",
+				"enablePullDownRefresh": false
+			}
+		},
+		{
+			"path" : "pages/replenishmentManage/outWarehousing",
+			"style" :
+			{
+				"navigationBarTitleText": "补货出库",
+				"enablePullDownRefresh": false
+			}
+		},
+		{
+			"path" : "pages/replenishmentManage/manualPrint",
+			"style" :
+			{
+				"navigationBarTitleText": "手动打印",
+				"enablePullDownRefresh": false
+			}
+		},
+		{
+			"path" : "pages/replenishmentManage/scanCodePrint",
+			"style" :
+			{
+				"navigationBarTitleText": "扫码打印",
+				"enablePullDownRefresh": false
+			}
+		},
+		{
+			"path" : "pages/replenishmentManage/sendOutGoods",
+			"style" :
+			{
+				"navigationBarTitleText": "发货出库",
+				"enablePullDownRefresh": false
+			}
+		},
+		{
+			"path" : "pages/replenishmentManage/signWarehousing",
+			"style" :
+			{
+				"navigationBarTitleText": "补货签收",
+				"enablePullDownRefresh": false
+			}
+		},
+		{
+			"path" : "pages/replenishmentManage/detail",
+			"style" :
+			{
+				"navigationBarTitleText": "补货单详情",
+				"enablePullDownRefresh": false
+			}
+		}
+        ,{
+            "path" : "pages/common/printTag/printTag",
+            "style" :                                                                                    
+            {
+                "navigationBarTitleText": "打印标签",
+                "enablePullDownRefresh": false
+            }
+        },
+		{
+			"path": "pages/stock/index", // 库存
+			"style": {
+				"navigationBarTitleText": "库存",
+				"enablePullDownRefresh": false
+			}
+		},
+		{
+			"path": "pages/stock/stockSearch", // 库存查询
+			"style": {
+				"navigationBarTitleText": "库存查询",
+				"enablePullDownRefresh": false
+			}
+		},
+		{
+			"path": "pages/stock/detaiList", // 库存详情列表
+			"style": {
+				"navigationBarTitleText": "库存详情",
+				"enablePullDownRefresh": false
+			}
+		},
+		{
+			"path": "pages/stock/stockDetail", // 库存详情
+			"style": {
+				"navigationBarTitleText": "库存详情",
+				"enablePullDownRefresh": false
+			}
+		},
+		{
+			"path": "pages/stock/warehouseDetail", // 出入库明细详情
+			"style": {
+				"navigationBarTitleText": "出入库明细",
+				"enablePullDownRefresh": false
+			}
+		},
+		{
+			"path": "pages/sales/index", // 销售
+			"style": {
+				"navigationBarTitleText": "销售",
+				"enablePullDownRefresh": false
+			}
+		},
+		{
+			"path": "pages/sales/list", // 销售列表
+			"style": {
+				"navigationBarTitleText": "销售单",
+				"navigationStyle":"custom",
+				"app-plus":{
+					"titleNView": {
+						"titleAlign": "auto",
+						"buttons": [ //原生标题栏按钮配置,
+							{
+								"text": "\ue694 查询" ,//原生标题栏增加分享按钮,点击事件可通过页面的 onNavigationBarButtonTap 函数进行监听u
+								"fontSrc": "/static/iconfont/iconfont.ttf",
+								"fontSize": "16",
+								"width":"90px"
+							}
+						]
+					}
+				}
+			}
+		},
+		{
+			"path": "pages/sales/addSales", // 新增销售单
+			"style": {
+				"navigationBarTitleText": "新增销售单",
+				"enablePullDownRefresh": false
+			}
+		},
+		{
+			"path": "pages/sales/edit", // 新增销售单/编辑销售单/销售单详情
+			"style": {
+				"navigationBarTitleText": "销售单",
+				"enablePullDownRefresh": false
+			}
+		},
+		{
+			"path": "pages/sales/chooseProduct", // 选择产品
+			"style": {
+				"navigationBarTitleText": "选择产品",
+				"navigationStyle":"custom",
+				"app-plus":{
+					"titleNView": {
+						"titleAlign": "auto",
+						"buttons": [ //原生标题栏按钮配置,
+							{
+								"text": "\ue694 查询" ,//原生标题栏增加分享按钮,点击事件可通过页面的 onNavigationBarButtonTap 函数进行监听u
+								"fontSrc": "/static/iconfont/iconfont.ttf",
+								"fontSize": "16",
+								"width":"90px"
+							}
+						]
+					}
+				}
+			}
+		},
+		{
+			"path": "pages/sales/chooseCustomer", // 销售单  选择客户
+			"style": {
+				"navigationBarTitleText": "选择客户",
+				"enablePullDownRefresh": false
+			}
+		},
+		{
+			"path": "pages/sales/addCustomer", // 销售单  选择客户
+			"style": {
+				"navigationBarTitleText": "新增客户",
+				"enablePullDownRefresh": false
+			}
+		},
+		{
+			"path": "pages/sales/productPricing", // 产品报价
+			"style": {
+				"navigationBarTitleText": "产品报价",
+				"navigationStyle":"custom",
+				"app-plus":{
+					"titleNView": {
+						"titleAlign": "auto",
+						"buttons": [ //原生标题栏按钮配置,
+							{
+								"text": "\ue694 查询" ,//原生标题栏增加分享按钮,点击事件可通过页面的 onNavigationBarButtonTap 函数进行监听u
+								"fontSrc": "/static/iconfont/iconfont.ttf",
+								"fontSize": "16",
+								"width":"90px"
+							}
+						]
+					}
+				}
+			}
+		},
+		{
+		    "path" : "pages/webviews/openview",
+		    "style" :                                                                                    
+		    {
+		        "navigationBarTitleText": "网页",
+		        "enablePullDownRefresh": false
+		    }
+		}
     ],
 	"globalStyle": {
 		"navigationBarTextStyle": "black",
-		"navigationBarTitleText": "uni-app",
+		"navigationBarTitleText": "iscm",
 		"navigationBarBackgroundColor": "#FFFFFF",
 		"backgroundColor": "#f2f2f2",
 		"app-plus": {
@@ -57,28 +317,24 @@
 		}
 	},
 	"tabBar": {
-		"color": "#7A7E83",
-		"selectedColor": "#ed1c24",
-		"backgroundColor": "#ffffff",
 		"fontSize": "14px",
 		"list": [
-		{
-			"pagePath": "pages/index/index",
-			"iconPath": "static/tabbar/record.png",
-			"selectedIconPath": "static/tabbar/record-active.png",
-			"text": "首页"
-		},
-		{
-			"pagePath": "pages/cleared/index",
-			"iconPath": "static/tabbar/record.png",
-			"selectedIconPath": "static/tabbar/record-active.png",
-			"text": "扫码记录"
-		},
-		{
-			"pagePath": "pages/userCenter/index",
-			"iconPath": "static/tabbar/user.png",
-			"selectedIconPath": "static/tabbar/user-active.png",
-			"text": "我的"
-		}]
+			{
+				"pagePath": "pages/sales/index",
+				"text": "销售"
+			},
+			{
+				"pagePath": "pages/stock/index",
+				"text": "库存"
+			},
+			{
+				"pagePath": "pages/index/index",
+				"text": "货架"
+			},
+			{
+				"pagePath": "pages/userCenter/index",
+				"text": "我的"
+			}
+		]
 	}
 }

+ 0 - 218
pages/agreement/agreement.vue

@@ -1,218 +0,0 @@
-<template>
-	<view class="content">
-		<view class="page-content">
-			<view class="page-care agreement">
-				<view class="title">-乐色助手商户服务协议(声明)-</view>
-				<view class="xy-cons">
-					<view class="MsoNormal">
-						“乐色助手商户小程序”(以下简称“商户小程序”)由陕西智享亿家环保科技有限公司(以下简称“本公司”)提供。商户在登录商户小程序时,均被视为已经仔细阅读本条款并完全同意。凡以任何方式登录本商户小程序,包括但不限于接受商户小程序服务、直接或间接使用本商户小程序资料、第三方链接等,均被视为自愿接受本商户小程序相关声明和商户服务协议的约束。
-					</view>
-					<view class="MsoNormal">
-						一、商户小程序使用
-					</view>
-					<view class="MsoNormal">
-						本商户小程序之设计、信息内容等任何组成部分均不得被复制、抄袭或被任何未经本公司允许的任何商业目的所使用。若本公司怀疑或确定商户行为违法或有损本公司利益,则本公司保留采取相关法律措施的权利,包括但不限于拒绝提供服务、冻结或删除商户帐户等。
-					</view>
-					<view class="MsoNormal">
-						二、链接
-					</view>
-						<view class="MsoNormal">(一) 本小程序对第三方网站的链接</view>
-						<view class="MsoNormal">
-							本小程序必要时将提供第三方经营的其他网站的超级链接或指引服务,或者通过帧联及其他方式在本小程序上提供第三方网站相关内容,此“内容”包括但不限于本商户小程序上包含或可获得的任何软件、资料、音频、信息以及本小程序上提供的其他任何信息。
-						</view>
-						<view class="MsoNormal">
-							对于第三方网站的超级链接或指引服务,仅限于方便之用。本公司保留任何时段终止对第三方网站超级链接的权利。所链接的网站、网站之内容及其网站所提供的产品与服务均不受本公司的控制,因此本公司不对任何该等网站及其内容、产品或服务(包括对第三方网站的进一步链接)负责,并且不对其作出任何认可、建议、批准或介绍。若您一旦登录或使用任何所链接网站,请仔细阅读该网站免责条款,同时自行采取防护措施。由于您自行登录或使用所链接的第三方网站所产生的任何风险和损失,责任自担 ; 除非本公司另行明确规定或同意,否则,本公司将不是您和任何所链网站提供者之间达成的任何协议的当事方。
-						</view>
-					<view class="MsoNormal">
-						本商户小程序上出现对第三方网站的链接并不表示本公司或本商户小程序与其相关联,或已获得合法授权使用,包括但不限于被链接网站中显示的或可通过其链接到的任何商标、商号、标识或著作权等
-					</view>
-					<view class="MsoNormal">
-						<view class="MsoNormal">(二) 第三方网站对本商户小程序的链接</view>
-						<view class="MsoNormal">
-							第三方网站对本商户小程序的链接,并不必然表示本公司对第三方作出了某种认可、授权、赞助,或表明其属于本公司的关联企业、合资企业、合作企业或业务伙伴。多数情况下,本公司并未意识到或授权第三方提供对本商户小程序的链接。
-						</view>
-						
-					</view>
-					<view class="MsoNormal">
-						三、前瞻性陈述
-					</view>
-					<view class="MsoNormal">
-						本商户小程序可能包含某些前瞻性陈述。这类前瞻性陈述包括但不限于:关于本公司业务经营策略的陈述;关于供应链服务网络扩建计划(包括与之有关的拟作出的资本投资)的陈述;关于计划发展的供应链服务及其相关应用的陈述;关于费用变动对本公司经营业绩的预期影响的陈述;关于竞争对本公司经营业绩的影响的陈述;关于供应链行业未来发展(包括行业结构调整及政府政策的变化)的陈述;以及与本公司未来业务发展、经营及业绩有关的其他陈述。本公司在使用“预期”、“相信”、“预测”、“期望”、“打算”及其他类似词语进行陈述时,旨在表明相关陈述属于前瞻性陈述。
-					</view>
-					<view class="MsoNormal">
-						这些前瞻性陈述本质上具有相当风险和不确定性。本公司不能保证会及时或不断地更新这类前瞻性陈述。这类前瞻性陈述反映的是本公司当前状态下对未来事件的预见或规划,并不属于对未来本公司经营和业务的保证。未来本公司的实际经营和业务很有可能会因诸多客观因素而与某些前瞻性陈述有重大差异,这些因素包括但不限于:供应链行业结构的进一步调整;所需政府批准及许可条件、政策、资本投资的优先程度等监管政策的变化;行业竞争对本公司服务的需求或价格的影响;以及中国内地的政治、经济、文化、法律以及社会各方面情况的变化(包括经济增长、通货膨胀、外汇及可动用的信用额度等政策的变化)。
-					</view>
-					<view class="MsoNormal">
-						此外,本公司未来往来供应链的扩建或收缩、资金投资、发展计划和规划,均取决于诸多种因素,包括但不限于是否能以可接受的条款获得足够融资;我们的发展和获得新技术及其应用的能力;是否有合格的管理及技术人员等诸多因素。
-					</view>
-					<view class="MsoNormal">
-						四、商户隐私权的保护
-					</view>
-						<view class="MsoNormal">(一) 商户资料的收集</view>
-						<view class="MsoNormal">
-							本商户小程序商户在匿名的状态下即可访问并获取相关信息,本商户小程序请求商户提供相关商户信息之前,本商户小程序会释明商户相关信息用途。本公司承诺仅在与本公司经营活动和经营业务有关的合法目的下,并经商户同意以合法的方式收集必要的商户信息。
-						</view>
-						<view class="MsoNormal">
-							商户使用本商户小程序需注册后方提供的服务,商户需同意以下事项:依本商户小程序注册表之提示提供商户本人真实有效、正确、完整及最新的商户信息,并保证个人信息和资料的适时更新;本企业因商户所提供的不准确、不完整或未及时更新的商户信息给商户造成的任何损害,本公司不承担任何法律和赔偿责任。本公司因商户提供的不准确、不完整或未及时更新的商户信息给本公司造成损害的,本公司保留法律追责权利。
-						</view>
-						<view class="MsoNormal">(二) 商户资料的使用</view>
-						<view class="MsoNormal">
-							本公司有权为内部业务目的使用由您提供的商户信息,这类内部业务目的包括但不限于:促进本公司业务或本公司提供给客户的服务、产品的日常管理和运营;监测本商户小程序的使用及安全情况,实施内部控制、制备数据统计、进行规划和研究等;优化设计、服务和产品;市场调研和推广;记录、核对、确认及维护商户或其他相关人员的联络名单;解决争议、排除问题和执行本法律声明;服务本公司所涉及的任何经营活动或日常业务;或与上述任何一项目的直接相关的其它目的。
-						</view>
-						<view class="MsoNormal">
-							基于以上目的,对商户信息有使用权的人,除本公司外,还包括经本公司合法授权、与本公司业务和经营活动有关的本公司的任何附属公司、联营公司、业务伙伴和专业顾问,以及向本公司提供或与本公司业务和经营活动有关的行政管理、电信服务、收付款服务、计算机信息服务或其它服务的任何代理人、承包商或第三方服务提供者。
-						</view>
-						<view class="MsoNormal">(三) 用户资料的披露</view>
-						<view class="MsoNormal">本商户小程序将采取合理有效的安全手段保护用户所提供的用户信息,在未经得用户许可前,本公司承诺并保证绝不将用户的任何个人信息和资料提供给任何无关第三方,但有下列情形之一的除外:</view>
-						<view class="MsoNormal">
-							<text>(</text>1<text>)根据法律、行政法规的规定,有权机关要求提供的。</text>
-						</view>
-						<view class="MsoNormal">
-							<text>(</text>2<text>)由于用户对自身信息保密不当,导致商户非公开信息泄露的。</text>
-						</view>
-						<view class="MsoNormal">
-							<text>(</text>3<text>)由于网络线路、黑客攻击、计算机病毒等原因造成的用户信息和资料泄露、丢失、被盗用或被篡改的。</text>
-						</view>
-						<view class="MsoNormal">
-							<text>(</text>4<text>)为了保护本商户小程序用户的权利或财产。</text>
-						</view>
-						<view class="MsoNormal">
-							<text>(</text>5<text>)在紧急的情况下,为了保护本商户小程序及其用户本人或公众安全的。</text>
-						</view>
-						<view class="MsoNormal">
-							<text>(</text>6<text>)其他特殊或紧急情况。</text>
-						</view>
-					<view class="MsoNormal">
-						五、知识产权保护
-					</view>
-					<view class="MsoNormal">
-						本商户小程序所载述的域名、商标、商号、信息、文字、图形、图像、声音、链接、软件及所有其它内容或组成部分均由本公司、内容或组成部分提供商或第三方许可人提供。上述内容的知识产权依具体情况分别为本公司、内容或组成部分提供商或第三方许可人所拥有。
-					</view>
-					<view class="MsoNormal">
-						未经本公司或商标权人事先书面许可,任何单位或个人不得以任何方式或理由对本商户小程序的商标、商号或标识的任何部分进行使用、复制、修改、传播或与其它产品捆绑使用。
-					</view>
-					<view class="MsoNormal">
-						除法律另有规定或双方另有约定外,未经本公司和/或其他权利人事先书面许可,任何人不得以任何形式通过任何方式(包括但不限于电子、机械复印或录制等方式)复制、展示、修改、转让、分发、重新发布、下载、张贴或传输本商户小程序的内容。
-					</view>
-					<view class="MsoNormal">
-						六、免责声明
-					</view>
-					<view class="MsoNormal">
-						本商户小程序所提供的信息,仅供参考之用,不宜用于任何研究或商业用途。本商户小程序并不保证该等信息的准确性、有效性、及时性或完整性。本公司及其员工无需以任何方式就任何信息传递或传送的失误、不准确或错误对商户或任何其他人士负任何直接或间接责任。在法律和本商户小程序允许的范围内,本公司不承担商户或任何第三方就使用或未能使用本商户小程序所提供的信息或任何链接所引致的任何直接、间接的损害赔偿(包括但不限于收益、预期利润的损失或失去的业务、未实现预期的节减)。本公司保留自行决定及修改、更正本商户小程序中任何内容和组成部分的权利(包括任何遗漏或错误的信息和内容)。本公司可以在任何时间对本商户小程序、本商户小程序上所描述的内容、产品、项目、服务或价格作出任何修改,而无需事前通知和事后说明,有需要的情况除外。
-					</view>
-					<view class="MsoNormal">
-						本商户小程序、本商户小程序所述的内容、信息和材料以及在本商户小程序上可获得的软件等均“依原样”提供,不包含任何明示或暗示性质的陈述或保证。在法律许可或不禁止范围内,本公司承诺不作出任何明示或暗示性质的陈述和保证,包括但不限于有关安全性、准确性、完整性、适销性、无侵权、适合某项特别目的或没有计算机病毒的保证。您应为使用本商户小程序承担全部责任和风险。
-					</view>
-					<view class="MsoNormal">如发生以下情况,本商户小程序不对用户的直接或间接损失承担法律责任:</view>
-					<view class="MsoNormal">
-						<text>(</text>1<text>)营业中断。</text>
-					</view>
-					<view class="MsoNormal">
-						<text>(</text>2<text>)无法登录本商户小程序,或登录本商户小程序延迟或中断。</text>
-					</view>
-					<view class="MsoNormal">
-						<text>(</text>3<text>)数据无法传送、错误传送、毁损、灭失或其他修改。</text>
-					</view>
-					<view class="MsoNormal">
-						<text>(</text>4<text>)因处理本商户小程序上对其它用户小程序的链接或本商户小程序上存在对其它用户小程序的链接所遭受的任何种类的损失或损害。</text>
-					</view>
-					<view class="MsoNormal">
-						<text>(</text>5<text>)就客户使用本商户小程序(包括链接到第三方小程序或自第三方小程序链接)而可能产生的计算机病毒、系统失灵或功能紊乱。</text>
-					</view>
-					<view class="MsoNormal">
-						<text>(</text>6<text>)本法律声明第四条第三项中规定的六种情形所引起的商户个人资料的披露或泄露。</text>
-					</view>
-					<view class="MsoNormal">
-						<text>(</text>7<text>)因不可抗力或本公司无法合理控制的其他原因所导致的用户损失。</text>
-					</view>
-					<view class="MsoNormal">
-						七、服务变更、暂停、中断或终止
-					</view>
-					<view class="MsoNormal">
-						如因系统升级或维护需要而暂停本商户小程序网络服务时,本商户小程序将尽可能事先通告。
-					</view>
-					<view class="MsoNormal">
-						如发生下列情形之一,本商户小程序有权随时暂停、中断或终止向用户提供本商户小程序商户服务而无需通知,并有权拒绝商户于当前、未来某时段或永久使用本商户小程序所提供服务之全部或任何部分:(1)用户提供任何错误、不实、过时、不完整或具有误导性的信息和资料,或本商户小程序有理由或有依据怀疑前述信息和资料为错误、不实、过时、不完整或具误导性的;(2)用户违反本法律声明或相关使用协议中规定的任何使用规则。
-					</view>
-					<view class="MsoNormal">
-						除上述情形外,本商户小程序同时保留在不事先通知商户的情况下随时暂停、中断或终止部分或全部网络服务的权利,对于所有服务的暂停、中断或终止而造成的任何损失,除法律另有规定或双方另有约定外,本公司不对用户或任何第三方承担任何法律责任。
-					</view>
-					<view class="MsoNormal">
-						八、条款修改
-					</view>
-					<view class="MsoNormal">
-						本公司保留在任何时间自行修改、增删本法律声明中的任何内容和条款的权利。您每次登录或使用本商户小程序时,均视为同意接受当时已生效的商户声明条款的制约。因此,建议您每次登录或使用本商户小程序时查看本法律声明是否修订或增删及修订或增删的情况。
-					</view>
-					<view class="MsoNormal">
-						九、法律适用与司法管辖
-					</view>
-					<view class="MsoNormal">
-						本法律声明的制定、执行、解释及争议问题的解决和处理均适用中华人民共和国法律、法规。双方因使用本商户小程序所产生的争议,若协商不成,任何一方可向本公司所在地人民法院提起诉讼。
-					</view>
-				</view>
-			</view>
-		</view>
-	</view>
-</template>
-
-<script>
-	export default {
-		components: {
-		},
-		data() {
-			return {
-			}
-		},
-		onLoad(option) {
-			uni.setNavigationBarTitle({
-				title: "服务协议"
-			})
-		},
-		methods: {
-		}
-	}
-</script>
-
-<style lang="scss">
-	page{
-		width: 100%;
-		height: 100%;
-	}
-	.content{
-		padding: 0;
-		width: 100%;
-		height: 100%;
-		display: flex;
-		flex-direction: column;
-		.page-content{
-			flex: 1;
-			overflow-y: scroll;
-		}
-		.title{
-			font-size: 30rpx;
-			font-weight: 600;
-		}
-		.xy-cons{
-			padding: 30rpx;
-			line-height: 42rpx;
-			.MsoNormal{
-				text-indent: 52rpx;
-				margin-bottom: 14rpx;
-			}
-		}
-		.page-care{
-			width: 100%;
-			display: flex;
-			flex-direction: column;
-			align-items: center;
-			padding-top: 20rpx;
-		}
-		.footer{
-			width: 100%;
-			text-align: center;
-			line-height: 100rpx;
-			background-color: rgb(255,0,0);
-			color: #fff;
-		}
-	}
-</style>

+ 0 - 186
pages/cleared/index.vue

@@ -1,186 +0,0 @@
-<template>
-	<view class="cleared-container">
-		<scroll-view class="scroll-con" scroll-y :scroll-top="scrollTop" @scrolltolower="onreachBottom">
-			<!-- 列表数据 -->
-			<view class="cell-item-con">
-				<view class="cell-item" v-for="(item, index) in listdata" :key="index">
-					<view class="cell-item-c">
-						<view class="cell-item-date">{{item.createDate}}</view>
-						<view class="cell-item-orderNum">
-							{{item.createDate}}
-							<u-icon name="arrow-right" :size="28" color="#999"></u-icon>
-						</view>
-					</view>
-					<u-grid :col="3" :hover-class="none">
-						<u-grid-item>
-							<view class="cell-item-main">
-								<text class="cell-item-number blue">26</text>
-								<text class="cell-item-unit">个</text>
-							</view>
-							<view class="cell-item-exp">清运网点数</view>
-						</u-grid-item>
-						<u-grid-item>
-							<view class="cell-item-main">
-								<text class="cell-item-number green">26</text>
-								<text class="cell-item-unit">个</text>
-							</view>
-							<view class="cell-item-exp">清运箱体数</view>
-						</u-grid-item>
-						<u-grid-item>
-							<view class="cell-item-main">
-								<text class="cell-item-number red">26</text>
-								<text class="cell-item-unit">kg</text>
-							</view>
-							<view class="cell-item-exp">清运总重量</view>
-						</u-grid-item>
-					</u-grid>
-				</view>
-			</view>
-			<u-empty class="nodata" :text="noDataText" v-if="listdata.length==0 && status!='loading'" mode="list"></u-empty>
-			<view class="loadmore">
-				<u-loadmore v-if="total>pageSize || status=='loading'" :status="status" />
-			</view>
-		</scroll-view>
-	</view>
-</template>
-<script>
-	// import { getGoldLogList, GoldLogCancel } from '@/api/officialPartnerGoldLog.js'
-	export default {
-		data() {
-			return {
-				listdata: [],
-				pageNo: 1,  //  当前页码
-				pageSize: 10,  //  每页条数
-				total: 0,  //  数据总条数
-				noDataText: '暂无数据',  //  列表请求状态提示语
-				status: 'loadmore',  //  加载中状态
-				customBtnStyle: {  //  撤销单据  自定义按钮样式
-					borderColor: '#ed1c24',
-					backgroundColor: '#ed1c24',
-					color: '#fff'
-				},
-				scrollTop: 0,  //  滚动条位置
-			}
-		},
-		onLoad() {
-			this.refresh({})
-		},
-		methods:{
-			// 获取查询参数 刷新列表
-			refresh(){
-				this.listdata = []
-				this.total = 0
-				this.searchHandle(1)
-			},
-			//  撤销单据
-			revokeFun(row){
-				const _this = this
-				uni.showModal({
-				  title: '提示',
-				  content: '撤销单据后乐豆将全部退回给原支付账号,确认撤销吗?',
-				  success(res) {
-				    if (res.confirm) {
-				   //    GoldLogCancel({ id: row.id }).then(ret => {
-						 //  if(ret.status == 200){
-							//   uni.showToast({ title: ret.message, icon: 'none' })
-							//   _this.searchHandle(1)
-						 //  }
-					  // })
-				    }
-				  }
-				})
-			},
-			// 搜索查询
-			searchHandle (pageNo) {
-				// this.status = "loading"
-				pageNo ? this.pageNo = pageNo : null
-				// getGoldLogList({
-				// 	pageNo: this.pageNo,
-				// 	pageSize: this.pageSize,
-				// 	customerMobile: ''
-				// }).then(res => {
-				// 	if (res.status == 200) {
-				// 		if(this.pageNo>1){
-				// 			this.listdata = this.listdata.concat(res.data.list || [])
-				// 		}else{
-				// 			this.listdata = res.data.list || []
-				// 			this.scrollTop = 0
-				// 		}
-				// 		this.total = res.data.count || 0
-				// 		this.noDataText = '暂无数据'
-				// 	} else {
-				// 		this.noDataText = res.message
-				// 		this.listdata = []
-				// 		this.total = 0
-				// 	}
-				// 	this.status = "loadmore"
-				// })
-			},
-			// scroll-view到底部加载更多
-			onreachBottom() {
-				if(this.listdata.length < this.total){
-					this.pageNo += 1
-					this.searchHandle()
-				}else{
-					uni.showToast({ title: '已经到底了', icon: 'none' })
-					this.status = "nomore"
-				}
-			}
-		}
-	}
-</script>
-
-<style lang="scss">
-	page{
-		height: 100%;
-	}
-	.cleared-container {
-		width: 100%;
-		height: 100%;
-		display: flex;
-		flex-direction: column;
-		//  列表
-		.scroll-con{
-			flex: 1;
-			overflow: auto;
-		}
-		//  列表样式
-		.cell-item-con{
-			.cell-item{
-				margin: $uni-spacing-col-base $uni-spacing-row-base;
-				background-color: #fff;
-				border-radius: $uni-border-radius-base;
-				color: $uni-text-color;
-				font-size: $uni-font-size-base;
-				box-shadow: 3rpx 3rpx 5rpx #eee;
-				.cell-item-c{
-					display: flex;
-					justify-content: space-between;
-					padding: $uni-spacing-col-base $uni-spacing-row-base;
-					.cell-item-date{
-						color: $uni-text-color-grey;
-					}
-				}
-				.cell-item-main{
-					display: inline-block;
-					margin-bottom: 10rpx;
-					.cell-item-number{
-						margin-right: 5rpx;
-					}
-					.cell-item-unit{
-						font-size: 26rpx;
-					}
-					.blue {
-						color: #1890FF;
-					}
-					.green {
-						color: #16b50e;
-					}
-					.red {
-						color: red;
-					}
-				}
-			}
-		}
-	}
-</style>

+ 130 - 0
pages/common/commonModal.vue

@@ -0,0 +1,130 @@
+<template>
+	<u-mask class="commonModal" :show="isShow" :mask-click-able="false" z-index="999998">
+		<view class="modal-con">
+			<u-icon v-if="isClose" @click="isShow=false" class="close-icon" name="close-circle" size="40" color="#999"></u-icon>
+			<view class="modal-title">{{title}}</view>
+			<view class="modal-main">{{content}}</view>
+			<view class="modal-footer">
+				<view class="button-cancel" v-if="isCancel" @click="handleCancel">{{cancelText}}</view>
+				<view class="button-confirm" @click="handleConfirm">{{confirmText}}</view>
+			</view>
+		</view>
+	</u-mask>
+</template>
+
+<script>
+	export default {
+		props: {
+			openModal: { //  弹框显示状态
+				type: Boolean,
+				default: false
+			},
+			title: { //  标题
+				type: String,
+				default: '提示'
+			},
+			content: { //  内容
+				type: String,
+				default: ''
+			},
+			isCancel: { //  是否有取消按钮
+				type: Boolean,
+				default: true
+			},
+			isClose: { //  是否有关闭按钮
+				type: Boolean,
+				default: false
+			},
+			confirmText: { //  确认按钮内容
+				type: String,
+				default: '确认'
+			},
+			cancelText: { //  取消按钮内容
+				type: String,
+				default: '取消'
+			}
+		},
+		data() {
+			return {
+				isShow: this.openModal, //  是否打开弹框
+			}
+		},
+		methods: {
+			// 确认
+			handleConfirm(){
+				this.$emit('confirm')
+			},
+			// 取消
+			handleCancel(){
+				this.isShow = false
+				this.$emit('cancel')
+			}
+		},
+		watch: {
+			//  父页面传过来的弹框状态
+			openModal (newValue, oldValue) {
+				this.isShow = newValue
+			},
+			//  重定义的弹框状态
+			isShow (newValue, oldValue) {
+			  if (!newValue) {
+			    this.$emit('close')
+			  }
+			}
+		}
+	}
+</script>
+
+<style lang="scss">
+	.commonModal{
+		width: 100%;
+		height: 100vh;
+		z-index: 10000;
+		.modal-con{
+			width: 70%;
+			margin: 40vh auto 0;
+			background-color: #fff;
+			border-radius: 24upx;
+			position: relative;
+			.close-icon{
+				position: absolute;
+				right: 6upx;
+				top: 6upx;
+			}
+			.modal-title{
+				text-align: center;
+				font-size: 30upx;
+				color: #000;
+				padding: 30upx 30upx 0;
+			}
+			.modal-main{
+				text-align: center;
+				font-size: 28upx;
+				color: #222;
+				line-height: 1.5em;
+				padding: 30upx 30upx 40upx;
+			}
+			.modal-footer{
+				font-size: 30upx;
+				display: flex;
+				justify-content: space-between;
+				align-items: center;
+				text-align: center;
+				border-top: 1upx solid #E5E5E5;
+				.button-cancel{
+					color: #999;
+					border-right: 1upx solid #E5E5E5;
+					flex-grow: 1;
+					padding: 20upx 0;
+					width: 50%;
+				}
+				.button-confirm{
+					color: #2A86F4;
+					flex-grow: 1;
+					padding: 20upx 0;
+					width: 50%;
+				}
+			}
+		}
+	}
+</style>

+ 42 - 0
pages/common/copyText.vue

@@ -0,0 +1,42 @@
+<template>
+	<text class="copyText" @click.stop="copyText">复制</text>
+</template>
+
+<script>
+	import clipboard from "@/js_sdk/dc-clipboard/clipboard.js"
+	export default{
+		props:{
+			text: {
+				type: String,
+				default: ''
+			},
+			label: {
+				type: String,
+				default: ''
+			},
+		},
+		methods:{
+			// 复制
+			copyText(){
+				clipboard.setText(this.text);
+				uni.showToast({
+					icon: 'none',
+					title: this.label + '已复制成功'
+				})
+			},
+		}
+	}
+</script>
+
+<style>
+	.copyText{
+		font-size: 20upx;
+		color:#333;
+		margin-left: 20upx;
+		background: #c1c1bf;
+		font-weight: normal;
+		padding: 0 5upx;
+		border-radius: 5upx;
+		color: #fff;
+	}
+</style>

+ 107 - 0
pages/common/customerSearch.vue

@@ -0,0 +1,107 @@
+<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 v-if="isShow">
+			<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/customer.js'
+	export default{
+		data(){
+			return{
+				listData:[],
+				queryWord:'',
+				pageSize:20,
+				pageNo:1,
+				isShow:true
+			}
+		},
+		onLoad() {
+			this.queryWord=''
+			this.listData=[]
+		},
+		onShow() {
+			this.queryWord=''
+			this.listData=[]
+		},
+		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){
+				console.log(val)
+				this.queryWord=this.listData[val].customerName
+				// uni.navigateTo({
+				// 	url:'/pages/sales/addSales'
+				// })
+				uni.navigateTo({
+					url:'/pages/sales/addSales?pageType=edit&nowId='+this.listData[val].id
+				})
+				
+			}
+		}
+	}
+</script>
+
+<style lang="scss">
+	.search-box{
+		width: 100%;
+		display: flex;
+		flex-direction: column;
+		// flex: 1;
+		.picker-content{
+			padding: 6upx 0 20upx;
+			flex: 1;
+			.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>

+ 292 - 0
pages/common/partList.vue

@@ -0,0 +1,292 @@
+<template>
+	<view class="partList-box">
+		<view class="partList-title flex align_center justify_between">
+			<text>{{title}}</text>
+			<view>{{list.length}}款,{{pageType=='shuntBackDetail'?'实退':'共'}}<text>{{totalNums}}</text>件</view>
+		</view>
+		<view class="partList-list">
+			<view class="partList-list-box" v-for="item in partList" :key="item.id">
+				<view class="product flex align_center">
+					<view class="checkbox" v-if="model == 'checkbox'"><u-checkbox v-model="item.checked" :name="item.id" @change="checkChange" size="40" shape="circle"></u-checkbox></view>
+					<view class="flex align_center flex_1">
+						<view class="pimgs">
+							<u-image :src="item.product&&item.product.productMsg?item.product.productMsg:`../../static/${theme}/def_img@2x.png`" width="128" height="128" border-radius="10"></u-image>
+						</view>
+						<view class="pinfo">
+							<view class="pname">
+								<text v-if="item.shelfPlaceCode">
+									{{item.shelfPlaceCode}}
+								</text>
+							{{item.product&&item.product.name?item.product.name:'--'}}
+							</view>
+							<view class="ptxt flex align_center justify_between">
+								<view>
+									<text class="pcode">{{item.product&&item.product.code?item.product.code:'--'}}</text>
+								</view>
+								<view v-if="pageType=='replenishmentSign'||pageType=='manualPrint'||pageType=='scanCodePrint'">
+									实发数量:<text class="pnums">{{item.confirmQty||item.confirmQty==0?item.confirmQty:'--'}}{{item.product&&item.product.unit?item.product.unit:'--'}}</text>
+								</view>
+								<view v-if="pageType=='replenishmentOut'">
+									x<text class="pnums">{{item.confirmQty||item.confirmQty==0?item.confirmQty:'--'}}</text>
+								</view>
+								<view v-if="pageType=='replenishmentDetail'">
+									应发<text class="pnums">{{item.qty||item.qty==0?item.qty:'--'}}</text>
+									实发<text class="pnums">{{item.confirmQty||item.confirmQty==0?item.confirmQty:'--'}}</text>
+									签收<text class="pnums">{{item.putQty||item.putQty==0?item.putQty:'--'}}</text>
+								</view>
+								<view v-if="pageType=='sendOutGoods'">
+									实发:<text class="pnums">{{item.confirmQty||item.confirmQty==0?item.confirmQty:'--'}}{{item.product&&item.product.unit?item.product.unit:'--'}}</text>
+									/已扫:<text class="pnums">{{item.scanQty||item.scanQty==0?item.scanQty:'--'}}</text>
+								</view>
+								<view v-if="pageType=='replenishmentDetailc'">
+									<text class="pnums">{{item.qty||item.qty==0?item.qty:'--'}}</text>
+									{{item.product&&item.product.unit?item.product.unit:'--'}}
+								</view>
+								<view v-if="pageType=='recall'">
+								  调回数量:<text class="pnums">{{item.qty||item.qty==0?item.qty:'--'}}</text>
+									{{item.product&&item.product.unit?item.product.unit:'--'}}
+								</view>
+								<view v-if="pageType=='shuntBackDetail'">
+									调回:<text class="pnums">{{item.qty||item.qty==0?item.qty:'--'}}{{item.product&&item.product.unit?item.product.unit:'--'}}</text>
+									/实退:<text class="pnums">{{item.confirmQty||item.confirmQty==0?item.confirmQty:'--'}}</text>
+								</view>
+								<view v-if="pageType=='shuntBackDetailc'">
+									<text class="pnums">{{item.qty||item.qty==0?item.qty:'--'}}</text>
+									{{item.product&&item.product.unit?item.product.unit:'--'}}
+								</view>
+							</view>
+						</view>
+					</view>
+				</view>
+				<!-- 有复选框 -->
+				<view v-if="model == 'checkbox'" class="ptools flex align_center justify_between">
+					<view></view>
+					<view class="pcurnums flex align_center" v-if="pageType=='recall'">
+						<text>实退数量</text>
+						<view class="u-ninput">
+							<u-number-box color="#000" bg-color="#fff" v-model="item.confirmQty" :min="1" :max="item.qty"></u-number-box>
+						</view>
+					</view>
+					<view class="pcurnums flex align_center" v-if="pageType=='manualPrint'">
+						<text>打印数量</text>
+						<view class="u-ninput">
+							<u-number-box color="#000" bg-color="#fff" v-model="item.printQty" :min="1" :max="item.confirmQty"></u-number-box>
+						</view>
+					</view>
+				</view>
+				<!-- 无复选框 -->
+				<view v-if="model == 'view'" class="ptools flex align_center justify_between">
+					<view></view>
+					<view class="pcurnums flex align_center" v-if="pageType=='replenishmentSign'">
+						<text>入库数量</text>
+						<view class="u-ninput">
+							<u-number-box color="#000" bg-color="#fff" v-model="item.putQty" @change="numberChange" :min="0" :max="item.confirmQty"></u-number-box>
+						</view>
+					</view>
+				</view>
+			</view>
+			<view class="nodata" v-if="list.length==0">
+				<u-empty :src="`/static/${$config('themePath')}/def_no_data@3x.png`" icon-size="120" :text="noDataText" img-width="120" mode="list"></u-empty>
+			</view>
+		</view>
+	</view>
+</template>
+
+<script>
+	export default {
+		props: {
+			list: {
+				type: Array,
+				default: function(){
+					return []
+				}
+			},
+			noDataText: {
+				type: String,
+				default: '暂无配件'
+			},
+			title: {
+				type: String,
+				default: '列表'
+			},
+			// model: checkbox 可选择模式,view 只显示
+			model: {
+				type: String,
+				default: 'checkbox'
+			},
+			// 那个功能页面调用,展示不同的字段,recall: 调回退库,调回详情-已完成:shuntBackDetail,调回详情-已取消:shuntBackDetailc,replenishmentSign:补货签收,replenishmentOut:补货出库,manualPrint:手动打印,sendOutGoods:发货出库,replenishmentDetail:补货详情-已完成,replenishmentDetailc:补货详情-已取消,scanCodePrint:扫码打印
+			fromPage: {
+				type: String,
+				default: ''
+			}
+		},
+		watch: {
+			list(newValue, oldValue) {
+				const _this = this
+				this.totalNums = 0
+				newValue.map(item => {
+					if(_this.pageType=='replenishmentSign'){  // 补货签收
+						this.totalNums = this.totalNums + item.confirmQty
+					}else if(_this.pageType=='replenishmentOut'){  // 补货出库
+						this.totalNums = this.totalNums + item.confirmQty
+					}else if(_this.pageType=='manualPrint'){  // 补货-手动打印
+						this.totalNums = this.totalNums + item.confirmQty
+						item.printQty = item.printQty ? item.printQty : 1
+					}else if(_this.pageType=='scanCodePrint'){  // 补货-扫码打印
+						this.totalNums = this.totalNums + item.confirmQty
+						item.printQty = item.printQty ? item.printQty : 1
+					}else if(_this.pageType=='replenishmentDetail'){  // 补货详情-已完成
+						this.totalNums = this.totalNums + item.putQty
+					}else if(_this.pageType=='replenishmentDetailc'){  // 补货详情-已取消
+						this.totalNums = this.totalNums + item.qty
+					}else if(_this.pageType=='shuntBackDetail'){  // 调回详情-已完成
+						this.totalNums = this.totalNums + item.confirmQty
+					}else{
+						this.totalNums = this.totalNums + item.qty
+					}
+					item.checked = false
+				})
+				this.partList = JSON.parse(JSON.stringify(newValue))
+				this.pageType = this.fromPage
+			}
+		},
+		onLoad() {
+			this.theme = getApp().globalData.theme
+		},
+		data() {
+			return {
+				partList: this.list,
+				totalNums: 0,
+				pageType: this.fromPage,
+				theme: ''
+			}
+		},
+		methods: {
+			// 全选
+			allSelect(val){
+				this.partList.map(item => {
+					item.checked = val
+				})
+				this.partList.splice()
+			},
+			checkChange(e){
+				const row = this.partList.find(item => item.id == e.name)
+				console.log(row.checked)
+				if(row){
+					row.checked = !row.checked
+					this.partList.splice()
+				}
+				// 判断是否全选
+				const isAllNoChecked = this.partList.filter(item => !item.checked)
+				this.$emit('allChecked',isAllNoChecked.length == 0)
+			},
+			// 获取所有选择的
+			getAllChecked(){
+				return this.partList.filter(item => item.checked)
+			},
+			// 获取所有数据
+			getAllData(){
+				return this.partList
+			},
+			// 数量 change
+			numberChange(value, index){
+				this.$emit('numberChange', value, index)
+			}
+		}
+	}
+</script>
+
+<style lang="less" scoped>
+.partList-box{
+	.nodata{
+		padding: 10vh 0;
+	}
+	.partList-title{
+		padding: 20rpx 0;
+		> text{
+			font-size: 32rpx;
+			color: #222222;
+		}
+		> view{
+			font-size: 32rpx;
+			text{
+				color: red;
+				margin: 0 5rpx;
+			}
+		}
+	}
+	.partList-list-box{
+		padding: 10px 0;
+		border-bottom: 2rpx solid #f5f5f5;
+		&:last-child{
+			border:0;
+		}
+		.product{
+			flex-grow: 1;
+			.checkbox{
+				width: 60rpx;
+			}
+			.pinfo{
+				flex-grow: 1;
+				padding-left: 20rpx;
+				.pname{
+					font-size: 32rpx;
+					color: #191919;
+					font-weight: bold;
+					margin-bottom: 10rpx;
+					text{
+						font-weight: normal;
+						margin-right: 6rpx;
+						padding: 0 10rpx;
+						background: rgba(3, 54, 146, 0.15);
+						border-radius: 100rpx;
+						color: #033692;
+						font-size: 28rpx;
+					}
+				}
+				.pno{
+					background-color: rgba(3, 54, 146, 0.15);
+					border-radius: 50rpx;
+					padding: 0 20rpx;
+					color: #033692;
+					font-size: 24rpx;
+					margin-right: 10rpx;
+				}
+				.ptxt{
+					font-size: 28rpx;
+					color: #999;
+					.pnums{
+						color: #222;
+						padding: 0 4upx;
+					}
+				}
+			}
+		}
+		.ptools{
+			margin-top: 20rpx;
+			.pcurnums{
+				> text{
+					margin-right: 20rpx;
+				}
+			}
+			.u-ninput{
+				border: 2rpx solid #eee;
+				border-radius: 50rpx;
+				padding: 0 6rpx;
+			}
+			/deep/ .u-icon-disabled{
+				background: #fff!important;
+			}
+			/deep/ .u-number-input{
+				margin: 0 0;
+				border: 2rpx solid #eee;
+				border-top: 0;
+				border-bottom: 0;
+			}
+			/deep/ .u-icon-plus, /deep/ .u-icon-minus{
+				border-radius: 50rpx;
+			}
+		}
+	}
+}
+</style>

+ 197 - 0
pages/common/printTag/printTag.vue

@@ -0,0 +1,197 @@
+<template>
+	<view class="printTag">
+		<view class="print-nums flex flex_column align_center justify_center">
+			<view>打印数量</view>
+			<view class="u-ninput">
+				<u-number-box :min="1" v-model="printNum" color="#000" bg-color="#fff" size="30" :input-height="70" :input-width="100"></u-number-box>
+			</view>
+		</view>
+		<view class="shelf-info">
+			<view class="shelf-info-title">
+				<view>{{infoData&&infoData.shelfName || '--'}}</view>
+				<view class="pno">{{infoData&&infoData.shelfPlaceCode}}</view>
+			</view>
+			<view>产品编码:{{fromPage == 'smdy'?infoData.productCode : infoData.productEntity&&infoData.productEntity.code}}</view>
+			<view>产品名称:{{fromPage == 'smdy'?infoData.productName : infoData.productEntity&&infoData.productEntity.productName}}</view>
+			<view>{{fromPage == 'smdy'?'实发':'库存'}}数量:{{fromPage == 'smdy'?infoData.confirmQty : infoData.qty}}</view>
+		</view>
+		<view class="buttons flex align_center justify_center">
+			<view v-if="fromPage == 'bdtq'"><u-button @click="cancel" shape="circle" plain>返回列表</u-button></view>
+			<view v-if="fromPage == 'smdy'"><u-button @click="cancel" shape="circle" plain>重新扫描</u-button></view>
+			<view>
+				<kk-printer ref="kkprinter" @startPrint="startPrint"></kk-printer>
+			</view>
+		</view>
+	</view>
+</template>
+
+<script>
+	import { shelfDetail } from '@/api/shelf'
+	import kkPrinter from '@/components/kk-printer/index.vue';
+	import {printTempl} from '@/libs/printTools.js'
+	import moment from 'moment'
+	export default {
+		components:{
+			kkPrinter
+		},
+		data() {
+			return {
+				infoData: null,
+				fromPage: '',
+				printInfo: null,
+				printNum: 0,
+				isParinting: false
+			}
+		},
+		onLoad(options) {
+			const _this = this
+			_this.fromPage = options.page
+			_this.infoData = options.data ? JSON.parse(options.data) : {},
+			_this.printNum = _this.fromPage == 'smdy' ? _this.infoData.confirmQty : _this.infoData.qty
+			_this.printNum = _this.printNum||1
+			console.log(_this.infoData)
+		},
+		onUnload() {
+			// this.$refs.kkprinter.closeConnect()
+			this.printNum = 1
+			this.infoData = null
+			this.printInfo = null
+			this.fromPage = ''
+		},
+		// 监听页面返回,返回 event = {from:backbutton、 navigateBack} ,backbutton 表示来源是左上角返回按钮或 android 返回键;navigateBack表示来源是 uni.navigateBack
+		onBackPress(event){
+			if(event.from == 'backbutton'){
+				this.cancel()
+				return true  // 阻止默认返回行为(会导致无限循环)
+			}
+		},
+		methods: {
+			cancel(){
+				if(this.fromPage == 'bdtq'){  // 补打贴签
+					uni.navigateBack({delta: 1})
+				}else if(this.fromPage == 'smdy'){  // 扫码打印
+					uni.$emit('refreshBL')
+					uni.navigateBack({delta: 1})
+				}
+			},
+			// 获取打印内容
+			getPrintContent(){
+				const _this = this
+				const nowDate = moment().format('YYYY-MM-DD HH:mm')
+				if(_this.fromPage == 'bdtq'){
+					_this.printInfo = {
+						dealerName: _this.$store.state.vuex_userData.orgName,
+						shelfName: _this.infoData.shelfName || '',
+						productCode: _this.infoData.productEntity&&_this.infoData.productEntity.code || '',
+						productName: _this.infoData.productEntity&&_this.infoData.productEntity.productName || '',
+						shelfPlaceCode: _this.infoData.shelfPlaceCode || '',
+						currentInven: _this.printNum,
+						printDate: nowDate,
+						printUser: _this.$store.state.vuex_userData.userNameCN,
+						barCode: `${_this.infoData.shelfSn}&${_this.infoData.productEntity&&_this.infoData.productEntity.code}&${_this.infoData.productEntity&&_this.infoData.productEntity.productSn}&${_this.infoData.shelfPlaceSn}`
+						// barCode: `dealerSn=${_this.$store.state.vuex_userData.orgSn}&shelfSn=${_this.infoData.shelfSn}&productSn=${_this.infoData.productEntity&&_this.infoData.productEntity.productSn}&productCode=${_this.infoData.productEntity&&_this.infoData.productEntity.code}&shelfPlaceCode=${_this.infoData.shelfPlaceCode}&shelfPlaceSn=${_this.infoData.shelfPlaceSn}`
+					}
+				}else if(_this.fromPage == 'smdy'){
+					_this.printInfo = {
+						dealerName: _this.$store.state.vuex_userData.orgName,
+						shelfName: _this.infoData.shelfName || '',
+						productCode: _this.infoData.productCode || '',
+						productName: _this.infoData.productName || '',
+						shelfPlaceCode: _this.infoData.shelfPlaceCode || '',
+						currentInven: _this.printNum,
+						printDate: nowDate,
+						printUser: _this.$store.state.vuex_userData.userNameCN,
+						barCode: `${_this.infoData.shelfSn}&${_this.infoData.productCode}&${_this.infoData.productSn}&${_this.infoData.shelfPlaceSn}`
+						// barCode: `dealerSn=${_this.$store.state.vuex_userData.orgSn}&shelfSn=${_this.infoData.shelfSn}&productSn=${_this.infoData.productSn}&productCode=${_this.infoData.productCode}&shelfPlaceCode=${_this.infoData.shelfPlaceCode}&shelfPlaceSn=${_this.infoData.shelfPlaceSn}`
+					}
+				}
+				console.log('printInfo-----------',_this.printInfo)
+			},
+			// 打印
+			startPrint(opt,tsc,blesdk){
+				console.log(opt,'opt')
+				this.getPrintContent()
+				if(this.printInfo.currentInven<=0){
+					uni.showToast({
+						icon:"none",
+						title: "请选择打印数量"
+					})
+					this.$refs.kkprinter.onPrintFail()
+					return
+				}
+				if(this.isParinting){
+					return
+				}
+				this.isParinting = true
+				const command = printTempl(tsc,this.printInfo)
+				blesdk.senBlData(opt.deviceId, opt.serviceId, opt.writeId, command.getData(), this.onPrintSuccess);
+			},
+			// 打印成功
+			onPrintSuccess(){
+				// uni.navigateBack()
+				this.$refs.kkprinter.onPrintSuccess()
+				this.isParinting = false
+			}
+		}
+	}
+</script>
+
+<style lang="less">
+.printTag{
+	background-color: #fff;
+	width: 100vh;
+	padding: 50rpx 30rpx;
+	.print-nums{
+		padding: 50rpx 30rpx;
+		color: #999;
+		font-size: 32rpx;
+		> view{
+			padding: 20rpx 0;
+		}
+		.u-ninput{
+			border: 2rpx solid #eee;
+			border-radius: 50rpx;
+			padding: 0 12rpx;
+		}
+		/deep/ .u-icon-disabled{
+			background: #fff!important;
+		}
+		/deep/ .u-number-input{
+			margin: 0 2rpx;
+			border: 2rpx solid #eee;
+			border-top: 0;
+			border-bottom: 0;
+		}
+		/deep/ .u-icon-plus, /deep/ .u-icon-minus{
+			border-radius: 50rpx;
+		}
+	}
+	.shelf-info{
+		background-color: #f8f8f8;
+		padding: 30rpx;
+		border-radius: 12rpx;
+		color: #707070;
+		.shelf-info-title{
+			font-size: 32rpx;
+			color: #222222;
+			display: flex;
+			justify-content: space-between;
+			margin-bottom: 10rpx;
+			.pno{
+				background: rgba(3, 54, 146, 0.15);
+				border-radius: 100rpx;
+				padding: 4rpx 20rpx;
+				color: #033692;
+				font-size: 26rpx;
+			}
+		}
+	}
+	.buttons{
+		padding: 50rpx 0;
+		> view{
+			width: 36%;
+			margin: 0 2%;
+		}
+	}
+}
+</style>

+ 174 - 0
pages/common/productBrand.vue

@@ -0,0 +1,174 @@
+<template>
+	<u-popup v-model="isShow" class="brand-picker" @close="isShow=false" mode="bottom">
+		<view class="brand-header flex justify_between align_center">
+			<text class="brand-picker-btn" @click="onClean">清空</text>
+			<text>产品品牌</text>
+			<text class="brand-picker-btn color-blue" @click="isShow=false">
+				<u-icon name="close"></u-icon>
+			</text>
+		</view>
+		<view class="search-box">
+			<u-search
+				placeholder="请输入品牌名称搜索" 
+				v-model="queryWord" 
+				:show-action="isGobleSearch||queryWord!=''"
+				@focus="isGobleSearch=true"
+				@blur="isGobleSearch=false"
+				@custom="searchBrand"
+				@search="searchBrand"
+				@clear="clearSearch"
+				:action-style="{'color': '#fff', 'font-size': '24upx', 'background-color': $config('primaryColor'), 'border-radius': '6upx', 'padding': '12upx 0'}">
+			</u-search>
+		</view>
+		<scroll-view class="picker-content" scroll-y>
+			<view class="picker-main">
+				<view class="picker-main-item" v-for="(item, index) in listData" :key="item.brandSn" @click="chooseItem(index)">
+					<view class="item-name">{{item.brandName}}</view>
+					<u-icon v-show="item.brandSn==brandSn" class="item-icon" name="checkbox-mark" :color="$config('primaryColor')" size="28"></u-icon>
+				</view>
+				<view v-if="listData && listData.length == 0 && status!='loading'">
+					<u-empty text="没有找到品牌" mode="list" :img-width="150" :margin-top="-60"></u-empty>
+				</view>
+				<view style="padding-bottom: 20upx;">
+					<u-loadmore v-if="totalNum>listData.length || status=='loading'" :status="status" />
+				</view>
+			</view>
+		</scroll-view>
+	</u-popup>
+</template>
+
+<script>
+	import { dealerProductBrandQuery } from '@/api/dealerProductBrand'
+	export default {
+		props: {
+			openModal: { //  弹框显示状态
+				type: Boolean,
+				default: false
+			},
+			itemSn: {
+				type: String,
+				default: ''
+			}
+		},
+		data() {
+			return {
+				isShow: this.openModal, //  是否打开弹框
+				listData: [],
+				queryWord: '',
+				isGobleSearch: false,
+				brandSn: this.itemSn || null,
+				status: 'loadmore',
+				totalNum: 0
+			}
+		},
+		mounted() {
+			this.clearSearch()
+		},
+		methods: {
+			// 搜索品牌
+			searchBrand(){
+				this.brandSn = null
+				this.getBrandList()
+			},
+			clearSearch(){
+				this.queryWord = ''
+				this.listData = []
+				this.getBrandList()
+			},
+			getBrandList(){
+				this.status = "loading"
+				dealerProductBrandQuery({ brandName: this.queryWord }).then(res => {
+					if(res.status == 200 && res.data){
+						this.listData = res.data
+						this.totalNum = res.data.count || 0
+					}else{
+						this.listData = []
+						this.totalNum = 0
+					}
+					this.status = "loadmore"
+				})
+			},
+			//  选择
+			chooseItem(ind){
+				this.brandSn = this.listData[ind].brandSn
+				this.$emit('choose', this.listData[ind])
+				this.isShow = false
+			},
+			// 清空
+			onClean(){
+				this.queryWord = ''
+				this.brandSn = null
+				this.$emit('clean')
+				this.isShow = false
+				this.getBrandList()
+			}
+		},
+		watch: {
+			//  父页面传过来的弹框状态
+			openModal (newValue, oldValue) {
+				this.isShow = newValue
+			},
+			//  重定义的弹框状态
+			isShow (newValue, oldValue) {
+			  if (!newValue) {
+			    this.$emit('close')
+			  }
+			}
+		}
+	}
+</script>
+
+<style lang="scss" scoped>
+	.brand-picker{
+		.brand-header{
+			padding: 0 30upx;
+			position: relative;
+			.brand-picker-btn{
+				color: rgb(96, 98, 102);
+				margin: 10upx;
+			}
+			.color-blue{
+				display: inline-block;
+				padding: 10upx 20upx;
+				margin: 10upx 0;
+			}
+		}
+		.brand-header:after{
+			content: "";
+			position: absolute;
+			border-bottom: 1px solid #eaeef1;
+			-webkit-transform: scaleY(.5);
+			transform: scaleY(.5);
+			bottom: 0;
+			right: 0;
+			left: 0;
+		}
+		.search-box{
+			padding: 10upx 20upx;
+		}
+		.picker-content{
+			height: 50vh;
+			padding: 6upx 0 20upx;
+			position: relative;
+			.picker-main{
+				width: 100%;
+				.picker-main-item{
+					position: relative;
+					padding: 0 30upx;
+					.item-name{
+						padding: 14upx 0;
+						text-align: center;
+					}
+					.item-icon{
+						position: absolute;
+						right: 100upx;
+						top: 19upx;
+					}
+					&:active{
+						background: #f8f8f8;
+					}
+				}
+			}
+		}
+	}
+</style>

+ 207 - 0
pages/common/productType.vue

@@ -0,0 +1,207 @@
+<template>
+	<u-popup v-model="isShow" class="type-picker" @close="isShow=false" mode="bottom">
+		<view class="type-header flex justify_between align_center">
+			<text class="type-picker-btn" @click="onClean">清空</text>
+			<text>产品分类</text>
+			<text class="type-picker-btn color-blue" @click="isShow=false">
+				<u-icon name="close"></u-icon>
+			</text>
+		</view>
+		<u-row class="choose-info">
+			<u-col :span="3">当前已选:</u-col>
+			<u-col :span="7" :style="{color: $config('primaryColor')}">
+				<view v-for="(item, index) in infoDataS" :key="index" style="display: inline-block;">{{item.productTypeName}}<text v-if="index+1 != infoData.length"> > </text></view>
+			</u-col>
+			<u-col :span="2"><u-button v-if="infoDataS.length>0" @click="handlerConfirm" type="success" size="mini" :custom-style="customStyle" hover-class="none" shape="circle">确定</u-button></u-col>
+		</u-row>
+		<scroll-view class="picker-content" scroll-y>
+			<view class="picker-main">
+				<view class="picker-main-item" v-for="(item, index) in typeList" :key="item.productTypeSn" @click="chooseItem(index)">
+					<view class="item-name">{{item.productTypeName}}</view>
+					<u-icon v-show="item.productTypeSn==(infoDataS[nowInd]&&infoDataS[nowInd].productTypeSn)" class="item-icon" name="checkbox-mark" :color="$config('primaryColor')" size="28"></u-icon>
+				</view>
+				<view v-if="typeList && typeList.length == 0">
+					<u-empty text="数据为空" mode="list" :img-width="200" :margin-top="-60"></u-empty>
+				</view>
+			</view>
+		</scroll-view>
+	</u-popup>
+</template>
+
+<script>
+	import { dealerProductTypeList } from '@/api/dealerProductType'
+	export default {
+		props: {
+			openModal: { //  弹框显示状态
+				type: Boolean,
+				default: false
+			},
+			nowData: {
+				type: Object,
+				default: ()=>{
+					return {
+						data: [],
+						indArr: [],
+						nowInd: 0
+					}
+				}
+			}
+		},
+		data() {
+			return {
+				isShow: this.openModal, //  是否打开弹框
+				listData: [],
+				typeList: [],
+				nowInd: 0,
+				indArr: [],
+				infoData: [],
+				infoDataS: [],
+				customStyle: {
+					background: this.$config('primaryColor')
+				}
+			}
+		},
+		mounted() {
+			this.getTypeList()
+		},
+		methods: {
+			getTypeList(){
+				dealerProductTypeList({}).then(res => {
+					if(res.status == 200 && res.data){
+						this.listData = res.data
+						this.typeList = res.data
+					}else{
+						this.listData = []
+						this.typeList = []
+					}
+				})
+			},
+			//  选择
+			chooseItem(ind){
+				if(this.nowInd == 0){
+					this.infoData[this.nowInd] = { productTypeName: this.typeList[ind].productTypeName, productTypeSn: this.typeList[ind].productTypeSn }
+					this.infoData[1] ? delete this.infoData[1] : null
+					this.infoData[2] ? delete this.infoData[2] : null
+					this.indArr[this.nowInd] = ind
+					this.indArr[1] ? delete this.indArr[1] : null
+					this.indArr[2] ? delete this.indArr[2] : null
+					this.nowInd++
+				}else if(this.nowInd == 1){
+					this.infoData[this.nowInd] = { productTypeName: this.typeList[ind].productTypeName, productTypeSn: this.typeList[ind].productTypeSn }
+					this.infoData[2] ? delete this.infoData[2] : null
+					this.indArr[this.nowInd] = ind
+					this.indArr[2] ? delete this.indArr[2] : null
+					this.nowInd++
+				}else if(this.nowInd == 2){
+					this.infoData[this.nowInd] = { productTypeName: this.typeList[ind].productTypeName, productTypeSn: this.typeList[ind].productTypeSn }
+					this.indArr[this.nowInd] = ind
+				}
+				this.infoDataS = JSON.parse(JSON.stringify(this.infoData))
+			},
+			handlerConfirm(){
+				const params = {
+					data: this.infoDataS,
+					indArr: this.indArr,
+					nowInd: this.nowInd
+				}
+				this.$emit('choose', params)
+				this.isShow = false
+			},
+			// 清空
+			onClean(){
+				this.infoData = []
+				this.infoDataS = []
+				this.indArr = []
+				this.nowInd = 0
+				this.$emit('clean')
+				this.isShow = false
+			}
+		},
+		watch: {
+			//  父页面传过来的弹框状态
+			openModal (newValue, oldValue) {
+				this.isShow = newValue
+			},
+			//  重定义的弹框状态
+			isShow (newValue, oldValue) {
+				if (!newValue) {
+					this.$emit('close')
+				}else{
+					this.infoData = JSON.parse(JSON.stringify(this.nowData.data))
+					this.infoDataS = JSON.parse(JSON.stringify(this.nowData.data))
+					this.indArr = this.nowData.indArr
+					this.nowInd = this.nowData.nowInd
+				}
+			},
+			nowInd (newValue, oldValue) {
+				if (newValue || newValue == 0) {
+					if (newValue == 0) {
+						this.typeList = this.listData || []
+					}else if (newValue == 1) {
+						this.typeList = (this.indArr[0] || this.indArr[0]==0) && this.listData[this.indArr[0]] && this.listData[this.indArr[0]].children ? this.listData[this.indArr[0]].children : []
+					}else if (newValue == 2) {
+						let oList = (this.indArr[0] || this.indArr[0]==0) && this.listData[this.indArr[0]] && this.listData[this.indArr[0]].children ? this.listData[this.indArr[0]].children : []
+						let tList = (this.indArr[1] || this.indArr[1]==0) && oList[this.indArr[1]] && oList[this.indArr[1]].children ? oList[this.indArr[1]].children : []
+						this.typeList = tList
+					}
+				}
+			}
+		}
+	}
+</script>
+
+<style lang="scss" scoped>
+	.type-picker{
+		.type-header{
+			padding: 0 30upx;
+			position: relative;
+			.brand-picker-btn{
+				color: rgb(96, 98, 102);
+				margin: 10upx;
+			}
+			.color-blue{
+				display: inline-block;
+				padding: 10upx 20upx;
+				margin: 10upx 0;
+			}
+		}
+		.type-header:after{
+			content: "";
+			position: absolute;
+			border-bottom: 1px solid #eaeef1;
+			-webkit-transform: scaleY(.5);
+			transform: scaleY(.5);
+			bottom: 0;
+			right: 0;
+			left: 0;
+		}
+		.choose-info{
+			padding: 14upx 30upx 14upx;
+			color: rgb(96, 98, 102);
+		}
+		.picker-content{
+			height: 50vh;
+			padding: 6upx 0 20upx;
+			position: relative;
+			.picker-main{
+				width: 100%;
+				.picker-main-item{
+					position: relative;
+					padding: 0 30upx;
+					.item-name{
+						padding: 14upx 0;
+						text-align: center;
+					}
+					.item-icon{
+						position: absolute;
+						right: 100upx;
+						top: 19upx;
+					}
+					&:active{
+						background: #f8f8f8;
+					}
+				}
+			}
+		}
+	}
+</style>

+ 142 - 25
pages/index/index.vue

@@ -1,49 +1,166 @@
 <template>
 	<view class="homePage-container">
-		<view class="scan-con">
-			<u-icon name="scan" class="scan-icon" size="70"></u-icon>
-			<text class="scan-txt">扫描识别</text>
-		</view>
+		 <!-- 数字货架 -->
+		 <div class="panel-box">
+		 	<div class="panel-title"><div class="texts">数字货架</div></div>
+		 	<div class="panel-body"><iconItemsList :list="storageRacksNavList"></iconItemsList></div>
+		 </div>
+		 <!-- 调回管理 -->
+		 <div class="graid-box">
+			 <div class="graid-box-1" @click="toPage('/pages/shuntBackManage/shuntBackList')">
+				 <div class="title">调回管理</div>
+				 <div>商品调回记录查询</div>
+			 </div>
+			 <div class="graid-box-1" @click="toPage('/pages/latePlay/chooseBulk')">
+				 <div class="title">补打贴签</div>
+				 <div>遗漏标签快捷处理</div>
+			 </div>
+			 <!-- <div class="graid-box-1" @click="toPage('/pages/index/printAbc')">
+				 <div class="title">打印ABC</div>
+				 <div>遗漏标签快捷处理</div>
+			 </div> -->
+		 </div>
 	</view>
 </template>
 <script>
+	import iconItemsList from '@/components/icon-items-list/icon-items-list.vue';
+	import { shelfReplenishStateCount } from '@/api/shelfReplenish'
 	export default {
+		components: {
+			iconItemsList,
+		},
 		data() {
 			return {
-				
+				// 数字货架
+				storageRacksNavList: [],
+				theme: ''
 			}
 		},
+		onLoad() {
+			// 设置底部tabbar 样式
+			const theme = getApp().globalData.theme
+			this.theme = theme
+			// 数字货架导航按钮
+			this.storageRacksNavList = [
+				{
+					id: 'scanVin',
+					icon: `/static/${this.theme}/navIcon/home_icon_confirm@3x.png`,
+					name: '待确认',
+					url: '/pages/replenishmentManage/replenishmentList?billState=WAIT_CONFIRM',
+					target: 'page',
+					count: 0,
+					auth: true
+				},
+				{
+					id: 'scanGoods',
+					icon: `/static/${this.theme}/navIcon/home_icon_out@3x.png`,
+					name: '待出库',
+					url: '/pages/replenishmentManage/replenishmentList?billState=WAIT_OUT_STOCK',
+					target: 'page',
+					count: 0,
+					auth: true
+				},
+				{
+					id: 'bhrk',
+					icon: `/static/${this.theme}/navIcon/home_icon_warehousing@3x.png`,
+					name: '待签收',
+					url: '/pages/replenishmentManage/replenishmentList?billState=WAIT_CHECK',
+					target: 'page',
+					count: 0,
+					auth: true
+				},
+				{
+					id: 'jsgl',
+					icon: `/static/${this.theme}/navIcon/home_icon_entire@3x.png`,
+					name: '全部',
+					url: '/pages/replenishmentManage/replenishmentList?billState=ALL',
+					target: 'page',
+					count: 0,
+					auth: true
+				}
+			]
+		},
 		onShow() {
-			
+			this.queryByTypeSum()
 		},
 		methods:{
-			
+			toPage(url){
+				uni.navigateTo({ url:url })
+			},
+			// 查询补货单每个状态的数据条数
+			queryByTypeSum () {
+				shelfReplenishStateCount({}).then(res => {
+					if (res.data && res.status == 200) {
+						this.storageRacksNavList[0].count = res.data.WAIT_CONFIRM || 0
+						this.storageRacksNavList[1].count = res.data.WAIT_OUT_STOCK || 0
+						this.storageRacksNavList[2].count = res.data.WAIT_CHECK || 0
+					}
+				})
+			},
 		}
 	}
 </script>
 
 <style lang="scss">
-	page{
-		height: 100%;
-	}
 	.homePage-container {
 		width: 100%;
-		height: 100%;
-		background-color: rgba(0,0,0,.6);
-		.scan-con{
-			background-color: #ed1c24;
-			width: 260upx;
-			height: 260upx;
-			border-radius: 50%;
-			color: #fff;
-			margin: 300upx auto 0;
-			text-align: center;
-			.scan-icon{
-				margin: 70upx 0 14upx;
+		padding: 30rpx;
+		.graid-box{
+			display: flex;
+			align-items: center;
+			.graid-box-1{
+				background-color: #ffffff;
+				border-radius: 30upx;
+				box-shadow: 3upx 2upx 6upx #eee;
+				padding: 30rpx;
+				width: 50%;
+				font-size: 28rpx;
+				color: #424D5E;
+				.title{
+					font-size: 45rpx;
+					color: #191919;
+					font-weight: bold;
+				}
+			}
+			> div{
+				&:first-child{
+					margin-right: 15rpx;
+				}
+				&:last-child{
+					margin-left: 15rpx;
+				}
+			}
+		}
+		.panel-box {
+			background-color: #ffffff;
+			border-radius: 30upx;
+			padding: 10upx 20upx;
+			box-shadow: 3upx 2upx 6upx #eee;
+			margin-bottom: 30upx;
+			.panel-title {
+				display: flex;
+				align-items: center;
+				padding: 20upx 12upx;
+				.texts {
+					font-size: 32upx;
+					flex-grow: 1;
+				}
+				.btns {
+					font-size: 28upx;
+					color: #999;
+					display: flex;
+					align-items: center;
+				}
 			}
-			.scan-txt{
-				display: block;
-				font-size: 30upx;
+			.panel-body {
+				padding: 0 10upx;
+				.nodata {
+					text-align: center;
+					font-size: 24upx;
+					width: 100%;
+					color: #999999;
+					padding: 30upx 0;
+				}
 			}
 		}
 	}

+ 97 - 0
pages/index/printAbc.vue

@@ -0,0 +1,97 @@
+<template>
+	<view class="replenishment-manualPrint-wrap">
+		<view class="replenishment-manualPrint-footer">
+			<view>
+				<kk-printer ref="kkprinter" defaultText="开始打印" @startPrint="startPrint"></kk-printer>
+			</view>
+		</view>
+	</view>
+</template>
+
+<script>
+	import kkPrinter from '@/components/kk-printer/index.vue';
+	import {printText} from '@/libs/printTools.js'
+	export default {
+		components: { kkPrinter },
+		data() {
+			return {
+				printIndex: 0,
+			}
+		},
+		onReady() {
+			uni.setNavigationBarColor({
+				frontColor: '#ffffff',
+				backgroundColor: this.$config('primaryColor')
+			})
+		},
+		methods: {
+			printOnce(opt,tsc,blesdk,data){
+				const _this = this
+				// 60*40 打印模板
+				const command = printText(tsc,data)
+				// 开始批量打印 
+				blesdk.senBlData(
+				opt.deviceId, 
+				opt.serviceId, 
+				opt.writeId, 
+				command.getData(), 
+				function(){
+					const result ='A、B、C、D、E、F、G、H、I、J'.split('、')
+					_this.printIndex = _this.printIndex + 1
+					if(_this.printIndex < result.length){
+						_this.printOnce(opt,tsc,blesdk,result[_this.printIndex])
+					}else{
+						_this.printIndex = 0
+						_this.$refs.kkprinter.onPrintSuccess()
+						_this.isParinting = false
+					}
+				});
+			},
+			// 批量打印 
+			startPrint(opt,tsc,blesdk){
+				const result = 'A、B、C、D、E、F、G、H、I、J'.split('、')
+				if(result.length){
+					 if(this.isParinting){
+					 	return
+					 }
+					 this.isParinting = true
+					 this.printOnce(opt,tsc,blesdk,result[this.printIndex])
+				}else{
+					this.toashMsg("请选择产品!")
+					this.$refs.kkprinter.onPrintFail()
+				}
+			},
+		}
+	}
+</script>
+
+<style lang="less">
+.replenishment-manualPrint-wrap{
+	position: relative;
+	width: 100%;
+	height: 100%;
+	overflow: hidden;
+	padding-bottom: 102upx;
+	.replenishment-manualPrint-body{
+		> view{
+			padding: 10rpx 25rpx;
+			background-color: #fff;
+			margin-bottom: 20rpx;
+			border-radius: 25rpx;
+			box-shadow: 2rpx 3rpx 5rpx #eee;
+		}
+	}
+	.replenishment-manualPrint-footer{
+		padding: 10upx 32upx 12upx;
+		background-color: #fff;
+		position: fixed;
+		left: 0;
+		bottom: 0;
+		width: 100%;
+		box-shadow: 3px 1px 7px #eee;
+		display: flex;
+		align-items: center;
+		justify-content: space-between;
+	}
+}
+</style>

+ 170 - 0
pages/latePlay/chooseBulk.vue

@@ -0,0 +1,170 @@
+<template>
+	<view class="moreShelfPart flex flex_column">
+		<view class="moreShelfPart-search">
+			<u-search
+			placeholder="请输入货柜名称搜索" 
+			v-model="shelfName" 
+			:show-action="isGobleSearch" 
+			@focus="isGobleSearch=true"
+			@blur="isGobleSearch=false"
+			@custom="getShelfList" 
+			@search="getShelfList" 
+			@clear="clearSearch"
+			:action-style="{'color': '#fff', 'font-size': '24upx', 'background-color': '#57a3f3', 'border-radius': '6upx', 'padding': '12upx 0'}">
+			</u-search>
+		</view>
+		<view class="moreShelfPart-body">
+			<scroll-view
+			class="nav-right" 
+			scroll-y 
+			@scrolltolower="onreachBottom">
+				<view class="nav-right-item" v-for="(item, index) in shelfList" :key="item.id" @click="viewDetail(item)">
+					<view class="item-info uni-col-10">
+						<view class="item-name">
+							<text>{{item.shelfName}}</text>
+						</view>
+						<view class="item-detail">
+							<text class="item-detail-text">
+								{{item.customerEntity&&item.customerEntity.provinceName}}{{item.customerEntity&&item.customerEntity.cityName}}{{item.customerEntity&&item.customerEntity.countyName}}{{item.customerEntity&&item.customerEntity.customerAddr}}
+							</text>
+						</view>
+					</view>
+				</view>
+				<view v-if="shelfList&&shelfList.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="total>pageSize || status=='loading'">
+					<u-loadmore :status="status" />
+				</view>
+			</scroll-view>
+		</view>
+	</view>
+</template>
+
+<script>
+	import { getShelfList } from '@/api/shelf'
+	export default {
+		data() {
+			return {
+				shelfName: '',
+				isGobleSearch: false,
+				shelfList: [],
+				pageNo:1,
+				pageSize: 10,
+				total: 0, // 列表总数
+				noDataText: '暂无货架',
+				status: 'loading',
+				vinstatus: 'loading'
+			}
+		},
+		onLoad(opts) {
+			this.getShelfList()
+		},
+		methods: {
+			clearSearch(){
+				this.shelfName = ''
+				this.pageNo = 1
+				this.shelfList = []
+				this.getShelfList()
+			},
+			// 获取数字货架列表
+			getShelfList(){
+				const _this = this
+				let params = {
+				    pageNo: this.pageNo,
+				    pageSize: this.pageSize,
+					shelfName: this.shelfName
+				}
+				_this.status = 'loading'
+				getShelfList(params).then(res => {
+					uni.hideLoading()
+					if(res.status == 200){
+						let list = res.data.list
+						if (list && list.length){
+							// 分页 拼接数据
+							if (_this.pageNo != 1) {
+								_this.shelfList = _this.shelfList ? _this.shelfList.concat(list) : list
+							} else {
+								_this.shelfList = list
+							}
+							this.total = res.data.count
+							if (_this.shelfList.length == res.data.count) {
+								_this.status = 'nomore'
+							} else {
+								_this.status = 'loadmore'
+							}
+						} else {
+							_this.shelfList = list || []
+							this.total = 0
+							_this.status = 'nomore'
+						}
+						_this.noDataText = '暂无配件'
+					}else{
+						_this.status = 'loadmore'
+						_this.shelfList = []
+						_this.total = 0
+						_this.noDataText = res.message ? res.message : '网络似乎出错了,请稍后再试'
+					}
+				})
+			},
+			// 加载更多
+			onreachBottom () {
+				if(this.shelfList.length < this.total ){
+					if(this.isGobleSearch&&this.shelfName==''){
+						return
+					}
+					this.pageNo++
+					this.getShelfList()
+				}else{
+					this.status = "nomore"
+				}
+			},
+			viewDetail(item){
+				uni.navigateTo({
+					url: "/pages/latePlay/chooseProduct?shelfSn="+item.shelfSn+'&shelfName='+item.shelfName
+				})
+			}
+		}
+	}
+</script>
+
+<style lang="less">
+	.moreShelfPart{
+		width: 100%;
+		height: 100vh;
+		.moreShelfPart-search{
+			padding: 20rpx;
+			background-color: #FFFFFF;
+		}
+		.moreShelfPart-body{
+			flex-grow: 1;
+			background-color: #fff;
+		}
+		.nav-right{
+			padding: 0 30upx;
+			height: calc(100vh - 110rpx);
+			box-sizing: border-box;
+			 
+			.nav-right-item{
+				padding:20upx 10upx;
+				border-bottom: 2rpx solid #f5f5f5;
+				display: flex;
+				.item-info{
+					.item-name{
+						font-size: 32upx;
+						display: flex;
+						align-items: center;
+					}
+					.item-detail{
+						margin-top: 10rpx;
+						.item-detail-text{
+							font-size: 30upx;
+							color: #9DA8B5;
+							word-break: break-all;
+						}
+					}
+				}
+			}
+		}
+	}
+</style>

+ 249 - 0
pages/latePlay/chooseProduct.vue

@@ -0,0 +1,249 @@
+<template>
+	<view class="moreShelfPart flex flex_column">
+		<view class="moreShelfPart-search">
+			<u-search
+			placeholder="请输入货位号/产品编码/产品名称搜索" 
+			v-model="queryWord" 
+			:show-action="isGobleSearch" 
+			@focus="isGobleSearch=true" 
+			@blur="isGobleSearch=false"
+			@custom="searchPart" 
+			@search="searchPart" 
+			@clear="clearSearch"
+			:action-style="{'color': '#fff', 'font-size': '24upx', 'background-color': '#57a3f3', 'border-radius': '6upx', 'padding': '12upx 0'}">
+			</u-search>
+			<view class="p-title">
+				<text></text>
+				{{shelfInfo.shelfName}}
+			</view>
+		</view>
+		<view class="moreShelfPart-body">
+			<scroll-view class="nav-right" scroll-y @scrolltolower="onreachBottom">
+				<view class="partList-list-box" v-for="item in partList" :key="item.id">
+					<view class="product flex align_center">
+						<view class="flex align_center flex_1">
+							<view class="pimgs">
+								<u-image :src="item.productEntity&&item.productEntity.images?item.productEntity.images:`../../static/${theme}/def_img@2x.png`" width="128" height="128" border-radius="10"></u-image>
+							</view>
+							<view class="pinfo">
+								<view class="pname">
+									<text>{{item.shelfPlaceCode}}</text>{{item.productEntity&&item.productEntity.productName}}
+								</view>
+								<view class="ptxt flex align_center justify_between">
+									<view>
+										<text class="pcode">{{item.productEntity&&item.productEntity.code}}</text>
+									</view>
+									<view>
+									  库存数量:<text class="pnums">{{item.qty}}{{item.productEntity&&item.productEntity.unit}}</text>
+									</view>
+								</view>
+							</view>
+						</view>
+					</view>
+					<view class="ptools flex align_center justify_between">
+						<view></view>
+						<view class="print" @click="print(item)">
+							<u-image :src="`/static/${$config('themePath')}/icon_printer@3x.png`" width="48" height="48"></u-image>
+						</view>
+					</view>
+				</view>
+				<view v-if="partList&&partList.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="total>pageSize || status=='loading'">
+					<u-loadmore :status="status" />
+				</view>
+			</scroll-view>
+		</view>
+	</view>
+</template>
+
+<script>
+	import { getShelfProductList } from '@/api/shelf'
+	export default {
+		data() {
+			return {
+				queryWord: '',
+				isGobleSearch: false,
+				partList: [],
+				pageNo:1,
+				pageSize: 10,
+				total: 0, // 列表总数
+				noDataText: '暂无货架',
+				status: 'loading',
+				vinstatus: 'loading',
+				shelfInfo: {
+					shelfSn: '',
+					shelfName: ''
+				},
+				theme: '',
+			}
+		},
+		onLoad(options) {
+			this.theme = getApp().globalData.theme
+			this.shelfInfo = {
+				shelfSn: options.shelfSn,
+				shelfName: options.shelfName
+			}
+			this.getpartList()
+		},
+		methods: {
+			clearSearch(){
+				this.queryWord = ''
+				this.pageNo = 1
+				this.partList = []
+				this.getpartList()
+			},
+			// 搜索配件
+			searchPart(){
+				this.getpartList()
+			},
+			// 获取数字货架列表
+			getpartList(){
+				const _this = this
+				let params = {
+				    pageNo: this.pageNo,
+				    pageSize: this.pageSize,
+					shelfSn: this.shelfInfo.shelfSn,
+					queryWord: this.queryWord
+				}
+				_this.status = 'loading'
+				getShelfProductList(params).then(res => {
+					uni.hideLoading()
+					if(res.status == 200){
+						let list = res.data.list
+						console.log(list)
+						if (list && list.length){
+							// 分页 拼接数据
+							if (_this.pageNo != 1) {
+								_this.partList = _this.partList ? _this.partList.concat(list) : list
+							} else {
+								_this.partList = list
+							}
+							this.total = res.data.count
+							if (_this.partList.length == res.data.count) {
+								_this.status = 'nomore'
+							} else {
+								_this.status = 'loadmore'
+							}
+						} else {
+							_this.partList = list || []
+							this.total = 0
+							_this.status = 'nomore'
+						}
+						_this.noDataText = '暂无配件'
+					}else{
+						_this.status = 'loadmore'
+						_this.partList = []
+						_this.total = 0
+						_this.noDataText = res.message ? res.message : '网络似乎出错了,请稍后再试'
+					}
+				})
+			},
+			// 加载更多
+			onreachBottom () {
+				if(this.partList.length < this.total ){
+					if(this.isGobleSearch&&this.queryWord==''){
+						return
+					}
+					this.pageNo++
+					this.getpartList()
+				}else{
+					this.status = "nomore"
+				}
+			},
+			print(data){
+				uni.navigateTo({ url: "/pages/common/printTag/printTag?page=bdtq&data="+JSON.stringify(data) })
+			}
+		}
+	}
+</script>
+
+<style lang="less">
+	.moreShelfPart{
+		width: 100%;
+		height: 100vh;
+		.moreShelfPart-search{
+			padding: 20rpx 20rpx 0;
+			background-color: #FFFFFF;
+			border-bottom: 2rpx solid #f5f5f5;
+		}
+		.p-title{
+			padding: 20rpx;
+			display: flex;
+			align-items: center;
+			color: #222;
+			font-size: 32rpx;
+			text{
+				display: block;
+				height: 32rpx;
+				width: 6rpx;
+				background: #0485F6;
+				margin-right: 10rpx;
+				border-radius: 10rpx;
+			}
+		}
+		.moreShelfPart-body{
+			flex-grow: 1;
+			background-color: #fff;
+		}
+		.nav-right{
+			height: calc(100vh - 180rpx);
+			box-sizing: border-box;
+			
+			.partList-list-box{
+				padding: 20rpx 30rpx;
+				border-bottom: 2rpx solid #f5f5f5;
+				&:last-child{
+					border:0;
+				}
+				.product{
+					flex-grow: 1;
+					.checkbox{
+						width: 60rpx;
+					}
+					.pinfo{
+						flex-grow: 1;
+						padding-left: 20rpx;
+						.pname{
+							font-size: 32rpx;
+							color: #191919;
+							font-weight: bold;
+							margin-bottom: 10rpx;
+							text{
+								font-weight: normal;
+								margin-right: 6rpx;
+								padding: 0 10rpx;
+								background: rgba(3, 54, 146, 0.15);
+								border-radius: 100rpx;
+								color: #033692;
+								font-size: 28rpx;
+							}
+						}
+						.pno{
+							background-color: rgba(3, 54, 146, 0.15);
+							border-radius: 50rpx;
+							padding: 2rpx 20rpx;
+							color: #033692;
+							font-size: 24rpx;
+							margin-right: 10rpx;
+						}
+						.ptxt{
+							font-size: 28rpx;
+							color: #999;
+							.pnums{
+								color: #222;
+							}
+						}
+					}
+				}
+				.ptools{
+					margin-top: 20rpx;
+					.print{
+						padding: 0 10rpx;
+					}
+				}
+			}
+		}
+	}
+</style>

+ 48 - 31
pages/login/forget-pass.vue

@@ -1,34 +1,37 @@
 <template>
 	<view class="forget-wrap">
-		<form class="login-form" @submit="formSubmit">
-			<view v-show="state == 0">
-				<view class="form-item">
-					<input v-model="form.phone" class="item-inp" name="phone" type="number" maxlength="11" placeholder="请输入登录手机号" />
+		<view class="login-body">
+			<form class="login-form" @submit="formSubmit">
+				<view class="login-title">{{state == 1 ? '修改密码':'找回密码'}}</view>
+				<view v-show="state == 0">
+					<view class="form-item">
+						<u-input v-model="form.phone" :custom-style="{fontSize:'34upx'}" height="110" type="number" clearable maxlength="11" placeholder="请输入登录手机号" />
+					</view>
+					<view class="form-item flex-box justify_between">
+						<view><u-input v-model="form.verifyCode" :custom-style="{fontSize:'34upx'}" height="110" type="number" clearable maxlength="6" placeholder="请输入短信验证码" /></view>
+						<button class="getcode-btn" :style="{background:$config('primaryColor')}" :disabled="isDisable" @click="getCodeValidate">{{nowVal}}</button>
+					</view>
+					<view class="form-btn-con">
+						<button class="form-btn" :disabled="isDisabled" :style="{'background':isDisabled?'#e5e5e5':$config('primaryColor')}" @click="goStep">下一步</button>
+					</view>
 				</view>
-				<view class="form-item">
-					<input v-model="form.verifyCode" class="item-inp" name="verifyCode" type="number" maxlength="6" placeholder="请输入短信验证码" />
-					<button class="getcode-btn" :disabled="isDisable" @click="getCodeValidate">{{nowVal}}</button>
+				<view v-show="state == 1">
+					<view class="form-item">
+						<u-input v-model="form.password" :custom-style="{fontSize:'34upx'}" height="110" type="password" :password-icon="true" maxlength="12" placeholder="请输入新密码"/>
+					</view>
+					<view class="form-item">
+						<u-input v-model="form.passwords" :custom-style="{fontSize:'34upx'}" height="110" type="password" :password-icon="true" maxlength="12" placeholder="请再次输入新密码"/>
+					</view>
+					<view class="form-btn-con">
+						<button class="form-btn" :disabled="isDisabledTwo" :style="{'background':isDisabledTwo?'#e5e5e5':$config('primaryColor')}" form-type="submit">提交</button>
+					</view>
 				</view>
-				<view class="form-btn-con">
-					<button class="form-btn" @click="goStep">下一步</button>
-				</view>
-			</view>
-			<view v-show="state == 1">
-				<view class="form-item">
-					<input v-model="form.password" class="item-inp" name="password" password type="text" maxlength="12" placeholder="请输入新密码" />
-				</view>
-				<view class="form-item">
-					<input v-model="form.passwords" class="item-inp" name="passwords" password type="text" maxlength="12" placeholder="请再次输入新密码" />
-				</view>
-				<view class="form-btn-con">
-					<button class="form-btn" form-type="submit">提交</button>
-				</view>
-			</view>
-		</form>
-		<!-- 图文验证码 -->
-		<uni-popup ref="imageTxtPopup" type="center">
-			<popup-con type="forgetImageTxt" title="图文验证码" :popBtn="popBtn" :changeImg="changeImg" @captchaImg="captchaImg"></popup-con>
-		</uni-popup>
+			</form>
+			<!-- 图文验证码 -->
+			<uni-popup ref="imageTxtPopup" type="center">
+				<popup-con type="forgetImageTxt" title="图文验证码" :popBtn="popBtn" :changeImg="changeImg" @captchaImg="captchaImg"></popup-con>
+			</uni-popup>
+		</view>
 	</view>
 </template>
 
@@ -61,6 +64,14 @@
 				randomCode: '',  //  图片验证码随机码
 			}
 		},
+		computed: {
+			isDisabled() {
+				return this.form.phone == '' || this.form.verifyCode == ''
+			},
+			isDisabledTwo(){
+				return this.form.password == '' || this.form.passwords == ''
+			}
+		},
 		onLoad(opts) {
 			if(opts.username){
 				this.form.phone = opts.username
@@ -133,7 +144,7 @@
 							success: function (ret) {
 						        if (ret.confirm||ret.index==0) {
 									uni.reLaunch({
-										url: '/pages/login/pwLogin'
+										url: '/pages/login/login'
 									})
 						        }
 						    }
@@ -218,12 +229,18 @@
 </script>
 <style scoped lang="scss">
 	@import './login.scss';
+	.forget-wrap .login-body{
+		justify-content: space-between;
+	}
 	.forget-wrap .login-form{
-		padding-top: 300upx;
+		margin-top: 15%;
 	}
 	.getcode-btn {
-		background-color: #298bf2 !important;
-		color: #fff !important;
+		color: #0485F6 !important;
 		border: none !important;
+		background: none !important;
+		&:after{
+			border: none !important;
+		}
 	}
 </style>

+ 54 - 36
pages/login/login.scss

@@ -1,66 +1,78 @@
-.pw-login-wrap, .forget-wrap, .apply-wrap{
+.login-wrap, .forget-wrap, .apply-wrap{
 	background-color: #FFFFFF;
 	width: 100%;
 	height: 100vh;
 	box-sizing: border-box;
-	position: relative;
-	.logo{
+	display: flex;
+	flex-direction: column;
+	align-items: center;
+	.login-head{
+		padding: 10upx 0;
+		text-align: center;
+		color: #999999;
+	}
+	.login-body{
+		flex-grow: 1;
+		width: 80%;
 		display: flex;
+		flex-direction: column;
+		align-items: center;
 		justify-content: center;
-		padding: 100upx 0;
+	}
+	.logo{
+		display: block;
+		margin-bottom: 120upx;
+		width: 160upx;
+		height: 160upx;
+	}
+	.login-title{
+		font-size: 40upx;
+		margin: 50upx 0;
 	}
 	.login-form{
 		display: block;
-		width: 80%;
 		margin: 0 auto;
+		width: 100%;
+		.mt20{
+			margin-top: 20upx;
+		}
 		.form-item{
-			margin-bottom: 20upx;
 			position: relative;
 			display: flex;
 			align-items: center;
-			border: 1upx solid #dcdee2;
-			border-radius: 15upx;
+			border-bottom: 1upx solid #EEEEEE;
 			.require-tip{
 				position: absolute;
-				left: 0;
+				left: -26upx;
 				top: 26upx;
 				color: red;
 			}
-			.item-inp{
-				flex-grow: 1;
-			}
 			.item-inp, .item-picker{
-				font-size: 30upx;
-				padding: 14upx 20upx;
+				font-size: 32upx;
+				padding: 20upx 0;
 			}
 			.getcode-btn{
-				position: absolute;
-				right: 0upx;
-				top: 0;
-				font-size: 24upx;
-				background: #999;
-				color: #FFFFFF;
-				border: 0;
-				border-top-left-radius: 0;
-				border-bottom-left-radius: 0;
-				line-height: 3;
-				z-index: 10;
+				font-size: 28upx;
+				color: #0485F6;
+				margin: 0;
+				padding: 0;
 			}
 		}
 		.flex-box{
 			display: flex;
 			justify-content: space-between;
 			font-size: 26upx;
+			align-items: center;
 		}
 		.form-btn-con{
-			margin-top: 60upx;
+			margin-top: 100upx;
 			.form-btn{
 				font-size: 32upx;
 				display: block;
-				line-height: 75upx;
+				line-height: 84upx;
 				margin: 0 auto;
-				background-color: #07c160;
 				color: #fff;
+				border-radius: 100upx;
 			}
 			uni-button.form-btn:after{
 				border: none;
@@ -68,19 +80,25 @@
 			.apply-btn{
 				display: block;
 				text-align: center;
-				margin-top: 50upx;
+				margin-top: 30upx;
+				border: 1upx solid #BBBBBB;
+				padding: 24upx 0;
+				border-radius: 100upx;
 			}
 		}
+		.forget-pass{
+			color: #606266;
+		}
 	}
-	.ysxy{
-		font-size: 24upx;
-		text-align: center;
+	
+	.authUserYs{
 		width: 100%;
-		position: absolute;
-		bottom: 160upx;
-		left: 0;
+		padding: 60upx;
+		font-size: 26upx;
+		display: flex;
+		align-items: center;
 		text{
-			color: #07c160;
+			color: #0485F6;
 		}
 	}
 }

+ 182 - 153
pages/login/login.vue

@@ -1,174 +1,203 @@
 <template>
-	<view class="login-content">
-		<view>
-			<view>
-				<view class="logo">
-					<u-image src="/static/logo.jpg" width="140" height="140" ></u-image>
+	<view class="login-wrap">
+		<view class="login-head">
+			<view v-if="showEnvTips">{{ envTips }}</view>
+		</view>
+		<view class="login-body">
+			<image :src="`../../static/${theme}/logo.png`" class="logo"></image>
+			<form class="login-form" @submit="AndroidCheckUpdate">
+				<view class="form-item">
+					<u-input v-model="form.username" :custom-style="{fontSize:'34upx'}" height="110" type="text" clearable placeholder="请输入用户账号" />
+				</view>
+				<view class="form-item">
+					<u-input v-model="form.password" :custom-style="{fontSize:'34upx'}" height="110" type="password" :password-icon="true" maxlength="50" placeholder="请输入密码"/>
 				</view>
-				<view class="login-btns">
-					<u-button shape="circle" :custom-style="wxButton" class="login-btn" type="success" :hair-line="false" open-type="getPhoneNumber" @getphonenumber="getPhoneNumber">
-						微信授权登录
-					</u-button>
-					<u-gap height="30"></u-gap>
-					<u-button shape="circle" :custom-style="phoneButton" class="login-btn" @click="pwLogin" type="primary">
-						账号密码登录
-					</u-button>
+				<view class="flex-box mt20">
+					<view class="remember-pass">
+						<checkbox-group @change="rememberChange">
+							<label>
+								<u-checkbox v-model="isRemember" label-size="13px" shape="circle">记住密码</u-checkbox>
+							</label>
+						</checkbox-group>
+					</view>
+					<!-- <view class="forget-pass" @click="forgetPass">忘记密码</view> -->
 				</view>
+				<view class="form-btn-con">
+					<button class="form-btn" :disabled="isDisabled" :style="{'background':isDisabled?'#e5e5e5':$config('primaryColor')}" form-type="submit">登录</button>
+				</view>
+			</form>
+		</view>
+		<!-- 隐私协议 -->
+		<view class="authUserYs">
+			<u-checkbox-group width="45rpx" @change="authuserChange">
+				<u-checkbox v-model="isAuthuserYs" :label-disabled="false" shape="circle">
+				</u-checkbox>
+			</u-checkbox-group>
+			<view>登录代表同意</view>
+			<view @click="toYsPage">
+				<text>用户协议</text>及<text>隐私保护政策</text>
 			</view>
 		</view>
-		<view @click="toYs">登录即代表同意<text>隐私政策</text>和<text>服务条款</text></view>
 	</view>
 </template>
 
 <script>
-	import {
-		login
-	} from "@/api/login"
-	export default {
-		components: {},
-		data() {
-			return {
-				path: '/pages/index/index',
-				lanuch: true,
-				code: '',
-				wxButton: {
-					background: '#07c160'
-				},
-				phoneButton: {
-					background: '#00aaff'
+import { checkVersionToLoadUpdate, setStorageForAppVersion,clzConfirm } from '@/libs/tools'
+import { isvalidNumLetter } from '@/libs/validate.js';
+import { login } from '@/api/user.js';
+import { getSysVersion } from '@/api/data.js'
+export default {
+	data() {
+		return {
+			form: {
+				username: this.$store.state.vuex_user.account,
+				password: this.$store.state.vuex_user.password
+			},
+			isRemember: true, //  是否记住密码
+			isAuthuserYs: false, // 是否同意隐私政策
+			envTips: '',
+			showEnvTips: false,
+			theme: ''
+		};
+	},
+	computed: {
+		isDisabled() {
+			return this.form.username == '' || this.form.password == ''
+		}
+	},
+	onShow() {
+		this.isRemember = this.$store.state.vuex_isRemember;
+		this.envTips = getApp().globalData.envTips;
+		this.showEnvTips = process.env.NODE_ENV == 'development';
+		this.theme = getApp().globalData.theme;
+		
+		//#ifdef APP-PLUS
+		  this.isAuthuserYs = this.$store.state.vuex_isUsrAuthYs
+		  uni.getSystemInfo({
+			  success:(res) => {
+				  console.log(res)
+				  // 获取最新版本信息
+				  plus.runtime.getProperty(plus.runtime.appid,(wgtinfo)=>{
+					wgtinfo.platform = res.platform
+				  	getApp().globalData.version = wgtinfo
+				  })
+			  }  
+		  })
+		//#endif
+	},
+	methods: {
+		// 版本更新
+		AndroidCheckUpdate(){
+			let _this = this
+			let version = getApp().globalData.version
+			uni.showLoading({
+				title: '正在登录...'
+			});
+			getSysVersion({versionType:version.platform=='android'?'ANDROID':'IOS'}).then(ret => {
+				if(ret.status == 200){
+					if(ret.data){
+						this.$store.state.vuex_versionInfo = ret.data || null
+						checkVersionToLoadUpdate(ret.data,0,_this.formSubmit)
+					}else{
+						this.formSubmit()
+					}
 				}
-			}
+				uni.hideLoading()
+			})
 		},
-		mounted() {},
-		onLoad(option) {
-			// 为解决首次登录异常问题 进入页面先调微信登录获取code
-			this.wxLogin()
-			const {
-				path,
-				lanuch
-			} = option;
-			this.lanuch = (lanuch + '') === 'true';
-			if (path) {
-				this.path = decodeURIComponent(path);
-			}
+		// 过滤权限code
+		fiterAuthCode(data) {
+			data.permCodes = data.permCodes.filter(item => item.indexOf('_mobile') > 0);
+			return data;
 		},
-		methods: {
-			cansel(){
-				this.$store.state.vuex_noLogin = true
-				uni.reLaunch({
-					url: '/pages/index/index'
-				})
-			},
-			toYs(){
-				uni.navigateTo({
-					url: '/pages/agreement/agreement'
-				})
-			},
-			getPhoneNumber(e) {
-				let _this = this
-				uni.showLoading({
-					mask: true,
-					title: '加载中'
-				});
-				if (!this.code) {
-					this.wxLogin()
-				} 
-				console.log(this.code, e)
-				if (e.target.errMsg === 'getPhoneNumber:ok') {
-					setTimeout(()=>{
-						login({
-							code: _this.code,
-							encryptedData: e.target.encryptedData,
-							iv: e.target.iv
-						}).then(res => {
-							uni.hideLoading();
-							_this.code = ''
-							console.log(res,_this.path, 'login data')
-							if (res.status == '200') {
-								getApp().globalData.token = res.data
-								_this.$u.vuex('vuex_token',res.data)
-								uni.$emit("getUserInfo")
-								if (_this.path === '/pages/index/index' || _this.lanuch) {
-									uni.reLaunch({
-										url: _this.path
-									});
-								} else {
-									uni.redirectTo({
-										url: _this.path
-									});
-								}
-							} else {
-								uni.showToast({
-									title: res.message,
-									icon: 'none',
-									duration: 2500
-								});
-							}
-						});
-					},300)
-				} else {
-					uni.showToast({
-						title: '授权失败',
-						icon: 'none',
-						duration: 2500
-					});
-				}
-			},
-			// 调微信登录 获取code
-			wxLogin () {
-				let _this = this
-				uni.login({
-					provider: 'weixin',
-					success(res) {
-						console.log(res.code)
-						_this.code = res.code
-					}
-				})
-			},
-			// 手机号登录
-			pwLogin () {
-			  wx.navigateTo({
-			    url: '/pages/login/pwLogin'
-			  })
+		//  表单提交
+		formSubmit() {
+			const _this = this;
+			//  表单校验
+			if (_this.form.username == '') {
+				uni.showToast({ icon: 'none', title: '请输入用户账号' });
+				return;
 			}
-		}
-	}
-</script>
-
-<style lang="scss" scoped>
-	.login-content {
-		width: 100%;
-		height: 100%;
-		padding: 40upx;
-		display: flex;
-		flex-direction: column;
-		> view{
-			text-align: center;
-			&:first-child{
-				flex-grow: 1;
-				height: 80vh;
-				padding: 20% 10%;
-				display: flex;
-				flex-direction: column;
-				justify-content: space-between;
+			if (!isvalidNumLetter(_this.form.username)) {
+				uni.showToast({ icon: 'none', title: '用户账号为数字或大小写字母组成!' });
+				return;
 			}
-			&:last-child{
-				font-size: 24upx;
-				text{
-					color: #07c160;
-				}
+			if (_this.form.password == '') {
+				uni.showToast({ icon: 'none', title: '请输入密码' });
+				return;
 			}
-			.logo{
-				text-align: center;
-				display: flex;
-				justify-content: center;
+			if (_this.form.password.length < 6 || _this.form.password.length > 50) {
+				uni.showToast({ icon: 'none', title: '请输入6-50位密码' });
+				return;
 			}
-			.login-btns{
-				padding: 60upx 0;
-				.login-btn{
-					margin: 30upx 0;
+			if (!_this.isAuthuserYs) {
+				uni.showToast({ icon: 'none', title: '请同意并阅读用户隐私政策' });
+				return;
+			}
+			
+			//  登录
+			login(_this.form).then(res => {
+				uni.hideLoading();
+				if (res.status == 200) {
+					console.log(_this.fiterAuthCode(res.data.auth_user))
+					_this.$u.vuex('vuex_userData', _this.fiterAuthCode(res.data.auth_user));
+					_this.$u.vuex('vuex_token', res.data.access_token);
+					_this.$u.vuex('vuex_authOrgs',res.data.auth_orgs);
+					getApp().globalData.token = res.data.access_token;
+					//登录成功将用户名密码存储到用户本地
+					if (_this.isRemember) {
+						//用户勾选“记住密码”
+						_this.$u.vuex('vuex_user.account', _this.form.username);
+						_this.$u.vuex('vuex_user.password', _this.form.password);
+					} else {
+						//用户没有勾选“记住密码”
+						_this.$u.vuex('vuex_user.account', '');
+						_this.$u.vuex('vuex_user.password', '');
+						_this.form.username = '';
+						_this.form.password = '';
+					}
+					uni.setStorageSync('loginTimeOut', 'NO');
+					_this.toMain();
+				} else {
+					uni.showToast({ icon: 'none', title: res.message });
 				}
+			});
+		},
+		toMain() {
+			// 跳转到首页
+			uni.switchTab({
+				url: '/pages/sales/index'
+			});
+		},
+		//  忘记密码
+		forgetPass() {
+			uni.navigateTo({
+				url: '/pages/login/forget-pass?username=' + this.form.username
+			});
+		},
+		//  判断是否记住密码
+		rememberChange(e) {
+			this.isRemember = e.detail.value.length > 0;
+		},
+		// 隐私
+		authuserChange(e) {
+			this.$u.vuex('vuex_isUsrAuthYs', this.isAuthuserYs);
+			//#ifdef APP-PLUS
+			if(!this.isAuthuserYs){
+				plus.runtime.disagreePrivacy()
+			}else{
+				plus.runtime.agreePrivacy()
 			}
+			//#endif
+		},
+		toYsPage() {
+			uni.navigateTo({
+				url: '/pages/login/userAuthYs'
+			});
 		}
 	}
+};
+</script>
+<style scoped lang="scss">
+@import './login.scss';
 </style>

+ 0 - 153
pages/login/pwLogin.vue

@@ -1,153 +0,0 @@
-<template>
-	<view class="pw-login-wrap">
-		<!-- <view v-if="!buildType" style="text-align: center;color: #999999;padding-top: 40px;">{{ envTips }}</view> -->
-		<view class="logo">
-			<u-image src="/static/logo.jpg" width="140" height="140" ></u-image>
-		</view>
-		<form class="login-form" @submit="formSubmit">
-			<view class="form-item">
-				<input v-model="form.loginName" class="item-inp" name="loginName" type="text" maxlength="30" placeholder="请输入用户名" />
-			</view>
-			<view class="form-item">
-				<input v-model="form.password" class="item-inp" name="password" password type="text" maxlength="12" placeholder="请输入密码" />
-			</view>
-			<view class="flex-box" style="margin-top: 60upx;">
-				<view class="remember-pass">
-					<u-checkbox v-model="isRemember" value="true" :size="30" :label-size="26" active-color="#07c160" class="login-form-checkbox" @change="rememberChange">记住密码</u-checkbox>
-				</view>
-			</view>
-			<view class="form-btn-con">
-				<button class="form-btn" form-type="submit">登录</button>
-			</view>
-		</form>
-		<view class="ysxy" @click="toYs">登录即代表同意<text>隐私政策</text>和<text>服务条款</text></view>
-	</view>
-</template>
-
-<script>
-import market from "@/js_sdk/dc-market/market.js"
-import { checkVersionToLoadUpdate, setStorageForAppVersion,clzConfirm } from '@/libs/tools'
-import { isvalidPhone } from '@/libs/validate.js';
-import { login } from '@/api/user.js';
-import { getSysVersion } from '@/api/data.js'
-export default {
-	data() {
-		return {
-			form: {
-				loginName: this.$store.state.vuex_user.account,
-				password: this.$store.state.vuex_user.password
-			},
-			isRemember: true, //  是否记住密码
-			envTips: '',
-			buildType: '',
-		};
-	},
-	mounted() {
-		this.isRemember = this.$store.state.vuex_isRemember || true;
-		this.envTips = getApp().globalData.envTips;
-		this.buildType = getApp().globalData.buildType;
-	},
-	onShow() {
-	},
-	methods: {
-		//  获取微信login  code
-		getWechatCode(){
-			const _this = this
-			wx.login({
-			  success (res) {
-			    if (res.code) {
-					//发起网络请求
-					let formData = JSON.parse(JSON.stringify(_this.form))
-					formData.code = res.code
-					_this.submitForm(formData)
-			    } else {
-					console.log('登录失败,点击“登录”重试!' + res.errMsg)
-			    }
-			  }
-			})
-		},
-		//  表单提交
-		formSubmit() {
-			const _this = this;
-			//  表单校验
-			// if (_this.form.loginName == '') {
-			// 	uni.showToast({ icon: 'none', title: '请输入用户名' });
-			// 	return;
-			// }
-			// // if (!isvalidPhone(_this.form.loginName)) {
-			// // 	uni.showToast({ icon: 'none', title: '请输入正确的手机号码' });
-			// // 	return;
-			// // }
-			// if (_this.form.password == '') {
-			// 	uni.showToast({ icon: 'none', title: '请输入密码' });
-			// 	return;
-			// }
-			// if (_this.form.password.length < 6 || _this.form.password.length > 12) {
-			// 	uni.showToast({ icon: 'none', title: '请输入6-12位密码' });
-			// 	return;
-			// }
-			// uni.showLoading({
-			// 	title: '正在登录...'
-			// });
-			// // #ifdef MP-WEIXIN
-			// 	//  获取微信login   code
-			// 	this.getWechatCode()
-			// // #endif
-			// // #ifndef MP-WEIXIN
-				this.submitForm(_this.form)
-			// // #endif
-		},
-		submitForm(formData){
-			const _this = this
-			//  登录
-			// login(formData).then(res => {
-			// 	uni.hideLoading()
-			// 	if (res.status == 200) {
-			// 		_this.$u.vuex('vuex_token', res.data)
-			// 		getApp().globalData.token = res.data
-			// 		//登录成功将用户名密码存储到用户本地
-			// 		if (_this.isRemember) {
-			// 			//用户勾选“记住密码”
-			// 			_this.$u.vuex('vuex_user.account', _this.form.loginName)
-			// 			_this.$u.vuex('vuex_user.password', _this.form.password)
-			// 		} else {
-			// 			//用户没有勾选“记住密码”
-			// 			_this.$u.vuex('vuex_user.account', '')
-			// 			_this.$u.vuex('vuex_user.password', '')
-			// 			_this.form.loginName = ''
-			// 			_this.form.password = ''
-			// 		}
-			// 		uni.setStorageSync('loginTimeOut', 'NO')
-					_this.toMain()
-			// 	} else {
-			// 		uni.showToast({ icon: 'none', title: res.message })
-			// 	}
-			// })
-		},
-		toMain() {
-			// 跳转到首页
-			uni.switchTab({
-				url: '/pages/index/index'
-			});
-		},
-		//  忘记密码
-		forgetPass() {
-			uni.navigateTo({
-				url: '/pages/login/forget-pass?username=' + this.form.loginName
-			});
-		},
-		//  判断是否记住密码
-		rememberChange(e) {
-			this.isRemember = e.value;
-		},
-		toYs(){
-			uni.navigateTo({
-				url: '/pages/agreement/agreement'
-			})
-		}
-	}
-};
-</script>
-<style scoped lang="scss">
-@import './login.scss';
-</style>

+ 11 - 1
pages/login/userAuthYs.vue

@@ -1,6 +1,6 @@
 <template>
 	<view class="article">
-		<view>章鱼车管家尊重并保护所有使用服务用户的个人隐私权。为了给您提供更准确、更有个性化的服务,本应用会按照本隐私权政策的规定使用和披露您的个人信息。但本应用将以高度的勤勉、审慎义务对待这些信息。除本隐私权政策另有规定外,在未征得您事先许可的情况下,本应用不会将这些信息对外披露或向第三方提供。</view>
+		<view>{{$config('appName')}}尊重并保护所有使用服务用户的个人隐私权。为了给您提供更准确、更有个性化的服务,本应用会按照本隐私权政策的规定使用和披露您的个人信息。但本应用将以高度的勤勉、审慎义务对待这些信息。除本隐私权政策另有规定外,在未征得您事先许可的情况下,本应用不会将这些信息对外披露或向第三方提供。</view>
 		<view>本应用会不时更新本隐私权政策。 您在同意本应用服务使用协议之时,即视为您已经同意本隐私权政策全部内容。本隐私权政策属于本应用服务使用协议不可分割的一部分。</view>
 		<view>
 			<p>适用范围</p>
@@ -47,6 +47,16 @@
 </template>
 
 <script>
+	export default {
+		data() {
+			return {
+				theme: ''
+			}
+		},
+		onLoad() {
+			this.theme = getApp().globalData.theme
+		}
+	}
 </script>
 
 <style lang="scss">

+ 122 - 0
pages/replenishmentManage/chooseTypeModal.vue

@@ -0,0 +1,122 @@
+<template>
+	<u-mask class="commonModal" :show="isShow" :mask-click-able="false">
+		<view class="modal-con">
+			<view class="modal-title">选择配送方式</view>
+			<view class="modal-main">
+				<u-radio-group v-model="form.dispatchType" width="50%" style="width: 100%;">
+					<u-radio v-for="(item, index) in dispatchTypeList" :key="index" :name="item.code">{{item.dispName}}</u-radio>
+				</u-radio-group>
+				<view style="padding: 20upx 0 16upx;">备注</view>
+				<u-input v-model="form.remarks" placeholder="请输入出库备注(最多500字符)" type="textarea" :maxlength="500" :border="true" :auto-height="false" :custom-style="{height: '100upx'}" />
+			</view>
+			<view class="modal-footer">
+				<view class="button-cancel" @click="isShow=false">取消</view>
+				<view class="button-confirm" @click="handleConfirm">提交</view>
+			</view>
+		</view>
+	</u-mask>
+</template>
+
+<script>
+	import { getLookUpItem } from '@/api/data'
+	export default {
+		props: {
+			openModal: { //  弹框显示状态
+				type: Boolean,
+				default: false
+			}
+		},
+		data() {
+			return {
+				isShow: this.openModal, //  是否打开弹框
+				form: {
+				  dispatchType: undefined,
+				  remarks: ''
+				},
+				dispatchTypeList: []
+			}
+		},
+		mounted() {
+			this.getLookUpItem()
+		},
+		methods: {
+			// 确认
+			handleConfirm(){
+				const _this = this;
+				//  表单校验
+				if (!_this.form.dispatchType) {
+					uni.showToast({ icon: 'none', title: '请选择配送方式' });
+					return;
+				}
+				this.$emit('confirm', _this.form)
+			},
+			// 配送方式
+			getLookUpItem () {
+				getLookUpItem({ lookupCode: 'DISTRIBUTION_MODE', pageNo: 1, pageSize: 1000 }).then(res => {
+					if (res.status == 200 && res.data && res.data.list) {
+						this.dispatchTypeList = res.data.list
+					} else {
+						this.dispatchTypeList = []
+					}
+				})
+			}
+		},
+		watch: {
+			//  父页面传过来的弹框状态
+			openModal (newValue, oldValue) {
+				this.isShow = newValue
+			},
+			//  重定义的弹框状态
+			isShow (newValue, oldValue) {
+				if (!newValue) {
+					this.$emit('close')
+				}
+			}
+		}
+	}
+</script>
+
+<style lang="scss" scoped>
+	.commonModal{
+		width: 100%;
+		height: 100%;
+		position: absolute;
+		left: 0;
+		top: 0;
+		z-index: 9999999;
+		.modal-con{
+			width: 78%;
+			margin: 40vh auto 0;
+			background-color: #fff;
+			border-radius: 24upx;
+			.modal-title{
+				text-align: center;
+				font-size: 30upx;
+				color: #000;
+				padding: 30upx 30upx 0;
+			}
+			.modal-main{
+				margin: 40upx 30upx 30upx;
+			}
+			.modal-footer{
+				font-size: 30upx;
+				display: flex;
+				justify-content: space-between;
+				align-items: center;
+				text-align: center;
+				border-top: 1upx solid #E5E5E5;
+				.button-cancel{
+					color: #999;
+					border-right: 1upx solid #E5E5E5;
+					flex-grow: 1;
+					padding: 20upx 0;
+				}
+				.button-confirm{
+					color: #2A86F4;
+					flex-grow: 1;
+					padding: 20upx 0;
+				}
+			}
+		}
+	}
+</style>

+ 227 - 0
pages/replenishmentManage/confirm.vue

@@ -0,0 +1,227 @@
+<template>
+	<view class="replenishment-confirm-wrap">
+		<scroll-view scroll-y class="replenishment-confirm-cont">
+			<view class="replenishment-confirm-main" v-for="(item,index) in listdata" :key="item.id">
+				<u-image class="item-pic" :src="item.product&&item.product.productMsg?item.product.productMsg:`../../static/${theme}/def_img@2x.png`" width="64px" height="64px"></u-image>
+				<view class="item-con">
+					<view class="item-name">{{item.product&&item.product.name?item.product.name:'--'}}</view>
+					<view class="item-code">{{item.product&&item.product.code?item.product.code:'--'}}</view>
+					<view class="item-num">
+						<view class="num-t">x {{item.qty||item.qty==0?item.qty:'--'}} {{item.product&&item.product.unit?item.product.unit:'--'}}</view>
+						<view class="num-v">
+							<u-number-box color="#000" bg-color="#fff" v-model="item.confirmQty" @change="handlerChange" :min="0" :max="item.qty"></u-number-box>
+						</view>
+					</view>
+				</view>
+			</view>
+			<u-empty :src="`/static/${$config('themePath')}/def_no_data@3x.png`" icon-size="240" :text="noDataText" img-width="120" v-if="listdata.length==0 && status!='loading'" mode="list"></u-empty>
+		</scroll-view>
+		<view class="replenishment-confirm-footer" v-if="listdata.length>0">
+			<u-button @click="confirmModal=true" type="success" :custom-style="customStyle" hover-class="none" shape="circle">确定补货({{confirmQty}}/{{totalQty}})</u-button>
+		</view>
+		<!-- 确认弹框 -->
+		<common-modal :openModal="confirmModal" content="确认对该数字货架进行补货吗?" confirmText="确认补货" @confirm="modalConfirm" @close="confirmModal=false" />
+		<!-- 库存不足 弹框 -->
+		<stock-modal :openModal="stockModal" :list="stockList" :params="paramsData" @confirm="modalStock" @close="stockModal=false" />
+	</view>
+</template>
+
+<script>
+	import commonModal from '@/pages/common/commonModal.vue'
+	import stockModal from './stockModal.vue'
+	import { shelfReplenishDetailList, shelfReplenishDetailStock, shelfReplenishConfirm } from '@/api/shelfReplenish'
+	export default {
+		components: { commonModal, stockModal },
+		data() {
+			return {
+				listdata: [],
+				status: 'loadmore',
+				noDataText: '暂无数据',
+				theme: '',
+				customStyle: {
+					borderRadius:'100rpx',
+					fontSize:'30rpx',
+					background: this.$config('primaryColor')
+				},
+				confirmQty: 0,  // 实发数量之和
+				totalQty: 0,  // 应发数量之和
+				replenishBillSn: '',
+				confirmModal: false,
+				stockModal: false,
+				stockList: [],
+				paramsData: null
+			}
+		},
+		onReady() {
+			uni.setNavigationBarColor({
+				frontColor: '#ffffff',
+				backgroundColor: this.$config('primaryColor')
+			})
+		},
+		onLoad(options){
+			this.theme = getApp().globalData.theme
+			this.replenishBillSn = options.sn
+			this.getRow()
+		},
+		methods:{
+			// 查询列表
+			getRow () {
+				const _this = this
+				shelfReplenishDetailList({ replenishBillSn: this.replenishBillSn }).then(res => {
+					if (res.status == 200) {
+						_this.totalQty = 0
+						_this.confirmQty = 0
+						res.data.map(item =>{
+							item.confirmQty = item.qty || 0
+							if(item.qty && Number(item.qty)){
+								_this.totalQty += Number(item.qty)
+							}
+							if(item.confirmQty && Number(item.confirmQty)){
+								_this.confirmQty += Number(item.confirmQty)
+							}
+						})
+						this.listdata = res.data || []
+					} else {
+						this.listdata = []
+					}
+				})
+			},
+			handlerChange(value, index){
+				const _this = this
+				this.confirmQty = 0
+				this.listdata.map(item => {
+					if(item.confirmQty && Number(item.confirmQty)){
+						_this.confirmQty += Number(item.confirmQty)
+					}
+				})
+			},
+			// 确认补货 confirm
+			modalConfirm(){
+				const arr = []
+				this.listdata.map((item, index) => {
+					if (item.confirmQty || item.confirmQty == 0) {
+						arr.push({
+							productSn: item.productSn,
+							confirmQty: item.confirmQty,
+							replenishBillDetailSn: item.replenishBillDetailSn
+						})
+					}
+				})
+				const params = {
+					shelfSn: this.listdata[0].shelfSn,
+					replenishBillSn: this.replenishBillSn,
+					replenishBillNo: this.listdata[0].replenishBillNo,
+					detailList: arr
+				}
+				// 校验产品库存是否足够
+				shelfReplenishDetailStock(params).then(res => {
+					if (res.status == 200) {
+						if (res.data && res.data.length > 0) {
+							this.stockList = res.data || []
+							this.paramsData = params
+							this.confirmModal = false
+							this.stockModal = true
+						} else {
+							this.confirmFun(params)
+						}
+					}
+				})
+			},
+			// 提交确认
+			confirmFun (params) {
+				shelfReplenishConfirm(params).then(res => {
+					if (res.status == 200) {
+						this.toashMsg(res.message)
+						uni.$emit('refreshBL')
+						uni.$emit("refreshBhList",'WAIT_OUT_STOCK')
+						uni.navigateBack()
+					}else{
+						this.toashMsg(res.message)
+					}
+				})
+			},
+			// 库存不足  confirm
+			modalStock(params){
+				this.stockModal = false
+				this.confirmFun(params)
+			}
+		}
+	}
+</script>
+
+<style lang="scss">
+	page {
+		height: 100vh;
+	}
+	.replenishment-confirm-wrap{
+		background-color: #fff;
+		position: relative;
+		width: 100%;
+		height: 100%;
+		overflow: hidden;
+		padding-bottom: 136upx;
+		.replenishment-confirm-cont{
+			width: 100%;
+			height: 100%;
+			overflow: auto;
+			.replenishment-confirm-main{
+				display: flex;
+				justify-content: space-between;
+				margin: 0 32upx;
+				padding: 30upx 0;
+				border-bottom: 1px solid #E5E5E5;
+				.item-pic{
+					flex-shrink: 0;
+					margin-right: 20upx;
+				}
+				.item-con{
+					flex-grow: 1;
+					.item-name{
+						color: #191919;
+						font-size: 30upx;
+						font-weight: bold;
+					}
+					.item-code{
+						color: #999999;
+						font-size: 26upx;
+					}
+					.item-num{
+						display: flex;
+						justify-content: space-between;
+						align-items: center;
+						.num-t{
+							color: #707070;
+							font-size: 26upx;
+						}
+						.num-v{
+							border: 2rpx solid #eee;
+							border-radius: 50rpx;
+							padding: 0 6rpx;
+						}
+						/deep/ .u-icon-disabled{
+							background: #fff!important;
+						}
+						/deep/ .u-number-input{
+							margin: 0 0;
+							border: 2rpx solid #eee;
+							border-top: 0;
+							border-bottom: 0;
+						}
+						/deep/ .u-icon-plus, /deep/ .u-icon-minus{
+							border-radius: 50rpx;
+						}
+					}
+				}
+			}
+		}
+		.replenishment-confirm-footer{
+			padding: 26upx 32upx 30upx;
+			background-color: #fff;
+			position: fixed;
+			left: 0;
+			bottom: 0;
+			width: 100%;
+			box-shadow: 3px 1px 7px #eee;
+		}
+	}
+</style>

+ 164 - 0
pages/replenishmentManage/detail.vue

@@ -0,0 +1,164 @@
+<template>
+	<view class="replenishment-detail-wrap" :style="`backgroundImage:linear-gradient(180deg, ${$config('primaryColor')}, #F5F6F7 12%)`">
+		<view class="replenishment-detail-body">
+			<view class="head-info" v-if="basicInfoData">
+				<view class="states">
+					<view>
+						<u-icon :name="pageType=='success'?'icon_complete':'icon_cancel'" custom-prefix="iscm-icon" size="48"></u-icon>
+						<text>{{pageType=='success'?'已完成':'已取消'}}</text>
+					</view>
+				</view>
+				<view>
+					<view class="label"><u-icon name="icon_order" custom-prefix="iscm-icon" size="32"></u-icon><text>补货单号</text></view>
+					<view class="info-txt">{{basicInfoData.replenishBillNo || '--'}}</view>
+				</view>
+				<view>
+					<view class="label"><u-icon name="ison_shelf" custom-prefix="iscm-icon" size="32"></u-icon><text>货架名称</text></view>
+					<view class="info-txt">{{basicInfoData.shelfInfo&&basicInfoData.shelfInfo.shelfName || '--'}}</view>
+				</view>
+				<view v-if="pageType=='success'">
+					<view class="label"><u-icon name="icon_delivery" custom-prefix="iscm-icon" size="32"></u-icon><text>配送方式</text></view>
+					<view class="info-txt">{{basicInfoData.dispatchTypeDictValue || '--'}}</view>
+				</view>
+				<view v-if="pageType=='success'">
+					<view class="label"><u-icon name="icon_remark" custom-prefix="iscm-icon" size="32"></u-icon><text>出库备注</text></view>
+					<view class="info-txt">{{basicInfoData.remarks || '--'}}</view>
+				</view>
+			</view>
+			<view class="part-list">
+				<!-- 补货产品 -->
+				<partList :list="partList" title="补货产品" model="view" :fromPage="pageType=='success'?'replenishmentDetail':'replenishmentDetailc'" ref="partList" noDataText="暂无产品"></partList>
+			</view>
+		</view>
+	</view>
+</template>
+
+<script>
+	import { shelfReplenishDetail, shelfReplenishDetailList, shelfReplenishPutStock } from '@/api/shelfReplenish'
+	import partList from '@/pages/common/partList.vue'
+	export default {
+		components: { partList },
+		data() {
+			return {
+				replenishBillSn: '',
+				basicInfoData:null,
+				partList: [],
+				customStyle: {
+					borderRadius:'100rpx',
+					fontSize:'30rpx',
+					background: this.$config('primaryColor')
+				},
+				pageType: ''
+			}
+		},
+		onReady() {
+			uni.setNavigationBarColor({
+				frontColor: '#ffffff',
+				backgroundColor: this.$config('primaryColor')
+			})
+		},
+		onLoad(option) {
+			this.replenishBillSn = option.sn
+			this.pageType = option.type
+			this.getDetail()
+			this.getPartList()
+		},
+		methods: {
+			// 查询详情
+			getDetail(){
+				shelfReplenishDetail({ sn: this.replenishBillSn }).then(res => {
+					if(res.status == 200){
+						this.basicInfoData = res.data || null
+					}else{
+						this.basicInfoData = null
+					}
+				})
+			},
+			// 查询列表
+			getPartList(){
+				const _this = this
+				shelfReplenishDetailList({ replenishBillSn: this.replenishBillSn }).then(res => {
+					if(res.status == 200 && res.data){
+						res.data.map(item =>{
+							item.confirmQty = item.confirmQty ? Number(item.confirmQty) : 0
+							item.putQty = item.confirmQty ? Number(item.confirmQty) : 0
+						})
+						this.partList = res.data || []
+					}else{
+						this.partList = []
+					}
+				})
+			}
+		}
+	}
+</script>
+
+<style lang="less">
+.replenishment-detail-wrap{
+	position: relative;
+	width: 100%;
+	height: 100%;
+	overflow: hidden;
+	.replenishment-detail-body{
+		padding: 0 30rpx;
+		height: 100%;
+		overflow: auto;
+		> view{
+			padding: 10rpx 25rpx;
+			background-color: #fff;
+			margin-bottom: 20rpx;
+			border-radius: 25rpx;
+			box-shadow: 2rpx 3rpx 5rpx #eee;
+		}
+		.head-info{
+			.states{
+				border: 0;
+				padding: 20rpx 0;
+				> view{
+					color: #191919;
+					text-align: center;
+					font-size: 40rpx;
+					text{
+						margin-left: 20rpx;
+					}
+				}
+			}
+			.info-txt{
+				word-break: break-word;
+			}
+			font-size: 30rpx;
+			> view{
+				display: flex;
+				border-bottom: 2rpx solid #f5f5f5;
+				padding: 20rpx 0;
+				> view:last-child{
+					flex-grow: 1;
+					width: 80%;
+				}
+				&:last-child{
+					border:0;
+				}
+			}
+			.label{
+				display: flex;
+				align-items: center;
+				width: 220rpx;
+				height: 44rpx;
+				color: #7C7D7E;
+				text{
+					margin-left: 10rpx;
+				}
+			}
+		}
+	}
+	.replenishment-detail-footer{
+		padding: 26upx 32upx 30upx;
+		background-color: #fff;
+		position: fixed;
+		left: 0;
+		bottom: 0;
+		width: 100%;
+		box-shadow: 3px 1px 7px #eee;
+	}
+}
+</style>

+ 164 - 0
pages/replenishmentManage/manualPrint.vue

@@ -0,0 +1,164 @@
+<template>
+	<view class="replenishment-manualPrint-wrap">
+		<view class="replenishment-manualPrint-body">
+			<view class="part-list">
+				<!-- 补货产品 -->
+				<partList :list="partList" title="补货产品" model="checkbox" fromPage="manualPrint" ref="partList" noDataText="暂无产品" @allChecked="allCheckedCallback"></partList>
+			</view>
+		</view>
+		<view class="replenishment-manualPrint-footer">
+			<view>
+				<u-checkbox size="40" @change="allCheckeChange" v-model="allChecked" shape="circle">{{allChecked?'取消全选':'全选'}}</u-checkbox>
+			</view>
+			<view>
+				<kk-printer ref="kkprinter" defaultText="开始打印" @startPrint="startPrint"></kk-printer>
+			</view>
+		</view>
+	</view>
+</template>
+
+<script>
+	import kkPrinter from '@/components/kk-printer/index.vue';
+	import { shelfReplenishDetail, shelfReplenishDetailList, shelfReplenishPrintSign } from '@/api/shelfReplenish'
+	import partList from '@/pages/common/partList.vue'
+	import {printTempl} from '@/libs/printTools.js'
+	export default {
+		components: { partList, kkPrinter },
+		data() {
+			return {
+				replenishBillSn: '',
+				basicInfoData:null,
+				partList: [],
+				allChecked: false,
+				printIndex: 0,
+			}
+		},
+		onReady() {
+			uni.setNavigationBarColor({
+				frontColor: '#ffffff',
+				backgroundColor: this.$config('primaryColor')
+			})
+		},
+		onLoad(option) {
+			this.replenishBillSn = option.sn
+			this.getDetail()
+			this.getPartList()
+		},
+		onUnload() {
+			// this.$refs.kkprinter.closeConnect()
+		},
+		methods: {
+			// 查询详情
+			getDetail(){
+				shelfReplenishDetail({ sn: this.replenishBillSn }).then(res => {
+					if(res.status == 200){
+						this.basicInfoData = res.data || null
+					}else{
+						this.basicInfoData = null
+					}
+				})
+			},
+			// 查询列表
+			getPartList(){
+				const _this = this
+				shelfReplenishDetailList({ replenishBillSn: this.replenishBillSn }).then(res => {
+					if(res.status == 200 && res.data){
+						res.data.map(item =>{
+							item.confirmQty = item.confirmQty ? Number(item.confirmQty) : 0
+							item.printQty = item.confirmQty ? Number(item.confirmQty) : 0
+						})
+						this.partList = res.data || []
+					}else{
+						this.partList = []
+					}
+				})
+			},
+			// 全选
+			allCheckeChange(e){
+				this.$refs.partList.allSelect(e.value)
+			},
+			allCheckedCallback(val){
+				this.allChecked = val
+			},
+			printOnce(opt,tsc,blesdk,data){
+				const _this = this
+				const dealer = this.$store.state.vuex_userData
+				// 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: `${data.shelfSn}&${data.productCode}&${data.productSn}&${data.shelfPlaceSn}`
+					// 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, 
+				opt.writeId, 
+				command.getData(), 
+				function(){
+					const result =_this.$refs.partList.getAllChecked()
+					_this.printIndex = _this.printIndex + 1
+					if(_this.printIndex < result.length){
+						_this.printOnce(opt,tsc,blesdk,result[_this.printIndex])
+					}else{
+						_this.printIndex = 0
+						_this.$refs.kkprinter.onPrintSuccess()
+						_this.isParinting = false
+					}
+				});
+			},
+			// 批量打印 
+			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("请选择产品!")
+					this.$refs.kkprinter.onPrintFail()
+				}
+			},
+		}
+	}
+</script>
+
+<style lang="less">
+.replenishment-manualPrint-wrap{
+	position: relative;
+	width: 100%;
+	height: 100%;
+	overflow: hidden;
+	padding-bottom: 102upx;
+	.replenishment-manualPrint-body{
+		> view{
+			padding: 10rpx 25rpx;
+			background-color: #fff;
+			margin-bottom: 20rpx;
+			border-radius: 25rpx;
+			box-shadow: 2rpx 3rpx 5rpx #eee;
+		}
+	}
+	.replenishment-manualPrint-footer{
+		padding: 10upx 32upx 12upx;
+		background-color: #fff;
+		position: fixed;
+		left: 0;
+		bottom: 0;
+		width: 100%;
+		box-shadow: 3px 1px 7px #eee;
+		display: flex;
+		align-items: center;
+		justify-content: space-between;
+	}
+}
+</style>

+ 190 - 0
pages/replenishmentManage/outWarehousing.vue

@@ -0,0 +1,190 @@
+<template>
+	<view class="replenishment-outWarehousing-wrap" :style="`backgroundImage:linear-gradient(180deg, ${$config('primaryColor')}, #F5F6F7 12%)`">
+		<view class="replenishment-outWarehousing-body">
+			<view class="head-info" v-if="basicInfoData">
+				<view class="states">
+					<view>
+						<u-icon name="icon_out" custom-prefix="iscm-icon" size="48"></u-icon>
+						<text>待出库</text>
+					</view>
+				</view>
+				<view>
+					<view class="label"><u-icon name="ison_shelf" custom-prefix="iscm-icon" size="32"></u-icon><text>货架名称</text></view>
+					<view class="info-txt">{{basicInfoData.shelfInfo&&basicInfoData.shelfInfo.shelfName || '--'}}</view>
+				</view>
+				<view>
+					<view class="label"><u-icon name="icon_position" custom-prefix="iscm-icon" size="32"></u-icon><text>客户地址</text></view>
+					<view class="info-txt">{{basicInfoData.customerAddr}}</view>
+				</view>
+			</view>
+			<view class="part-list">
+				<!-- 配件列表 -->
+				<partList :list="partList" title="配件列表" model="view" fromPage="replenishmentOut" ref="partList" noDataText="暂无配件"></partList>
+			</view>
+		</view>
+		<view class="replenishment-outWarehousing-footer">
+			<u-button class="button" @click="printModal=true" :custom-style="customDefalutStyle" hover-class="none" shape="circle">打印标签</u-button>
+			<u-button class="button" @click="goSendOutGoods" type="success" :custom-style="customStyle" hover-class="none" shape="circle">发货出库</u-button>
+		</view>
+		<!-- 打印贴签 -->
+		<print-sticker-modal :openModal="printModal" @confirm="modalPrint" @close="printModal=false" />
+	</view>
+</template>
+
+<script>
+	import printStickerModal from './printStickerModal.vue'
+	import { shelfReplenishDetail, shelfReplenishDetailList } from '@/api/shelfReplenish'
+	import partList from '@/pages/common/partList.vue'
+	export default {
+		components: { partList, printStickerModal },
+		data() {
+			return {
+				replenishBillSn: '',
+				basicInfoData:null,
+				partList: [],
+				customStyle: {
+					borderRadius:'100rpx',
+					fontSize:'30rpx',
+					background: this.$config('primaryColor')
+				},
+				customDefalutStyle: {
+					borderRadius:'100rpx',
+					fontSize:'30rpx',
+					color: this.$config('primaryColor'),
+					background: '#fff'
+				},
+				printModal: false
+			}
+		},
+		onReady() {
+			uni.setNavigationBarColor({
+				frontColor: '#ffffff',
+				backgroundColor: this.$config('primaryColor')
+			})
+		},
+		onLoad(option) {
+			this.replenishBillSn = option.sn
+			this.getDetail()
+			this.getPartList()
+		},
+		methods: {
+			// 查询详情
+			getDetail(){
+				shelfReplenishDetail({ sn: this.replenishBillSn }).then(res => {
+					if(res.status == 200){
+						this.basicInfoData = res.data || null
+					}else{
+						this.basicInfoData = null
+					}
+				})
+			},
+			// 查询列表
+			getPartList(){
+				const _this = this
+				shelfReplenishDetailList({ replenishBillSn: this.replenishBillSn }).then(res => {
+					if(res.status == 200 && res.data){
+						res.data.map(item =>{
+							item.confirmQty = item.confirmQty ? Number(item.confirmQty) : 0
+						})
+						this.partList = res.data || []
+					}else{
+						this.partList = []
+					}
+				})
+			},
+			// 打印贴签 confirm
+			modalPrint(type){
+				this.printModal = false
+				if(type == 'manual'){  // 手动打印
+					uni.navigateTo({ url: "/pages/replenishmentManage/manualPrint?sn="+this.replenishBillSn })
+				}else if(type == 'scan'){  // 扫码打印
+					uni.navigateTo({ url: "/pages/replenishmentManage/scanCodePrint?sn="+this.replenishBillSn })
+				}
+			},
+			// 发货出库
+			goSendOutGoods(){
+				uni.navigateTo({ url: "/pages/replenishmentManage/sendOutGoods?sn="+this.replenishBillSn+'&shelfSn='+this.basicInfoData.shelfSn })
+			}
+		}
+	}
+</script>
+
+<style lang="less">
+	page {
+		height: 100vh;
+	}
+.replenishment-outWarehousing-wrap{
+	position: relative;
+	width: 100%;
+	height: 100%;
+	overflow: hidden;
+	padding-bottom: 136upx;
+	.replenishment-outWarehousing-body{
+		padding: 0 30rpx;
+		height: 100%;
+		overflow: auto;
+		> view{
+			padding: 10rpx 25rpx;
+			background-color: #fff;
+			margin-bottom: 20rpx;
+			border-radius: 25rpx;
+			box-shadow: 2rpx 3rpx 5rpx #eee;
+		}
+		.head-info{
+			.states{
+				border: 0;
+				padding: 20rpx 0;
+				> view{
+					color: #191919;
+					text-align: center;
+					font-size: 40rpx;
+					text{
+						margin-left: 20rpx;
+					}
+				}
+			}
+			.info-txt{
+				word-break: break-word;
+			}
+			font-size: 30rpx;
+			> view{
+				display: flex;
+				border-bottom: 2rpx solid #f5f5f5;
+				padding: 20rpx 0;
+				> view:last-child{
+					flex-grow: 1;
+					width: 80%;
+				}
+				&:last-child{
+					border:0;
+				}
+			}
+			.label{
+				display: flex;
+				align-items: center;
+				width: 220rpx;
+				height: 44rpx;
+				color: #7C7D7E;
+				text{
+					margin-left: 10rpx;
+				}
+			}
+		}
+	}
+	.replenishment-outWarehousing-footer{
+		padding: 26upx 32upx 30upx;
+		background-color: #fff;
+		position: fixed;
+		left: 0;
+		bottom: 0;
+		width: 100%;
+		box-shadow: 3px 1px 7px #eee;
+		display: flex;
+		justify-content: space-between;
+		align-items: center;
+		.button{
+			width: 45%;
+		}
+	}
+}
+</style>

+ 149 - 0
pages/replenishmentManage/printStickerModal.vue

@@ -0,0 +1,149 @@
+<template>
+	<u-mask class="commonModal" :show="isShow" :mask-click-able="false">
+		<view class="modal-con">
+			<view class="modal-title">打印贴签</view>
+			<view class="modal-main">
+				<u-radio-group v-model="printType">
+					<u-radio name="manual">
+						<view class="print-con">
+							<u-image class="item-pic" src="../../static/default/icon_print_manual.png" width="80" height="80"></u-image>
+							<view class="print-main">
+								<text class="print-type">手动打印</text>
+								<text class="print-exp">在产品列表中自行选择需要打印贴签的产品</text>
+							</view>
+						</view>
+					</u-radio>
+					<u-radio name="scan">
+						<view class="print-con">
+							<u-image class="item-pic" src="../../static/default/icon_print_code.png" width="80" height="80"></u-image>
+							<view class="print-main">
+								<text class="print-type">扫码打印</text>
+								<text class="print-exp">扫描产品条形码进行打印</text>
+							</view>
+						</view>
+					</u-radio>
+				</u-radio-group>
+			</view>
+			<view class="modal-footer">
+				<view class="button-cancel" @click="isShow=false">取消</view>
+				<view class="button-confirm" @click="handleConfirm">确定</view>
+			</view>
+		</view>
+	</u-mask>
+</template>
+
+<script>
+	export default {
+		props: {
+			openModal: { //  弹框显示状态
+				type: Boolean,
+				default: false
+			}
+		},
+		data() {
+			return {
+				isShow: this.openModal, //  是否打开弹框
+				printType: 'manual'
+			}
+		},
+		methods: {
+			// 确认
+			handleConfirm(){
+				this.$emit('confirm', this.printType)
+			}
+		},
+		watch: {
+			//  父页面传过来的弹框状态
+			openModal (newValue, oldValue) {
+				this.isShow = newValue
+			},
+			//  重定义的弹框状态
+			isShow (newValue, oldValue) {
+			  if (!newValue) {
+			    this.$emit('close')
+			  }
+			}
+		}
+	}
+</script>
+
+<style lang="scss" scoped>
+	.commonModal{
+		width: 100%;
+		height: 100%;
+		position: absolute;
+		left: 0;
+		top: 0;
+		.modal-con{
+			width: 78%;
+			margin: 50% auto 0;
+			background-color: #fff;
+			border-radius: 24upx;
+			.modal-title{
+				text-align: center;
+				font-size: 30upx;
+				color: #000;
+				padding: 30upx 30upx 0;
+			}
+			.modal-main{
+				margin: 20upx 0 30upx;
+				/deep/ .u-radio{
+					width: 94%!important;
+					flex-direction: row-reverse;
+					justify-content: space-between;
+					margin: 0 3%;
+				}
+				/deep/ .u-radio__icon-wrap{
+					flex-shrink: 0;
+				}
+				/deep/ .u-radio__label{
+					flex-grow: 1;
+					border-bottom: 2upx dashed #E5E5E5;
+					padding: 3% 0;
+				}
+				.print-con{
+					display: flex;
+					justify-content: space-between;
+					align-items: center;
+					.item-pic{
+						flex-shrink: 0;
+						margin-right: 20upx;
+					}
+					.print-main{
+						flex-grow: 1;
+						.print-type{
+							display: block;
+							font-size: 30upx;
+							color: #222;
+						}
+						.print-exp{
+							display: block;
+							font-size: 26upx;
+							color: #666E75;
+							line-height: 40upx;
+						}
+					}
+				}
+			}
+			.modal-footer{
+				font-size: 30upx;
+				display: flex;
+				justify-content: space-between;
+				align-items: center;
+				text-align: center;
+				border-top: 1upx solid #E5E5E5;
+				.button-cancel{
+					color: #999;
+					border-right: 1upx solid #E5E5E5;
+					flex-grow: 1;
+					padding: 20upx 0;
+				}
+				.button-confirm{
+					color: #2A86F4;
+					flex-grow: 1;
+					padding: 20upx 0;
+				}
+			}
+		}
+	}
+</style>

+ 277 - 0
pages/replenishmentManage/replenishmentList.vue

@@ -0,0 +1,277 @@
+<template>
+	<view class="pagesCons">
+		<view class="utabs">
+			<u-tabs-swiper ref="uTabs" :list="tabList" name="dispName" :current="current" @change="tabsChange" :is-scroll="false" swiperWidth="750"></u-tabs-swiper>
+		</view>
+		<swiper class="check-list" :current="swiperCurrent" @transition="transition" @change="swiperChange" @animationfinish="animationfinish">
+			<swiper-item class="swiper-item" v-for="(tabs, index) in tabList" :key="index">
+				<scroll-view scroll-y class="scroll-view" @scrolltolower="onreachBottom">
+					<view  
+					class="check-order-list" 
+					v-if="index==current"
+					v-for="(item,sindex) in list" 
+					:key="item.id+'-'+sindex"
+					@click="viewRow(item)" >
+						<view class="check-row">
+							<view>{{item.shelfInfo&&item.shelfInfo.shelfName}}</view>
+							<view>
+								<text :style="{color: item.billState=='FINISH'?$config('successColor'):item.billState=='CANCEL'?$config('infoColor'):$config('errorColor')}">{{item.billStateDictValue}}</text>
+							</view>
+						</view>
+						<view class="check-col">
+							<view>补货单号:{{item.replenishBillNo}}</view>
+							<view v-if="item.billState=='WAIT_CONFIRM' || item.billState=='CANCEL'">应发数量:{{item.totalQty}}</view>
+							<view v-if="item.billState=='WAIT_OUT_STOCK' || item.billState=='WAIT_CHECK'">实发数量:{{item.totalConfirmQty}}</view>
+							<view v-if="item.billState=='FINISH'">入库数量:{{item.totalPutQty}}</view>
+							<view>{{item.createDate}}</view>
+						</view>
+					 </view>
+					 <u-empty :src="`/static/${$config('themePath')}/def_no_data@3x.png`" icon-size="240" :text="noDataText" img-width="120" v-if="list.length==0 && status!='loading'" mode="list"></u-empty>
+					 <view v-if="index==current" style="padding: 20upx;">
+						 <u-loadmore :load-text="$config('loadText')" v-if="total>pageSize || status=='loading'" :status="status" />
+					 </view>
+				</scroll-view>
+			</swiper-item>
+		</swiper>
+	</view>
+</template>
+
+<script>
+	import { shelfReplenishList, shelfReplenishStateCount } from '@/api/shelfReplenish'
+	export default {
+		components: {},
+		data() {
+			return {
+				status: 'loadmore',
+				noDataText: '暂无数据',
+				tabList: [
+					{
+						dispName: '全部',
+						status: 'ALL'
+					},
+					{
+						dispName: '待确认',
+						status: 'WAIT_CONFIRM',
+						count: 0
+					},
+					{
+						dispName: '待出库',
+						status: 'WAIT_OUT_STOCK',
+						count: 0
+					},
+					{
+						dispName: '待签收',
+						status: 'WAIT_CHECK',
+						count: 0
+					},
+					{
+						dispName: '已完成',
+						status: 'FINISH'
+					},
+					{
+						dispName: '已取消',
+						status: 'CANCEL'
+					},
+				],
+				current: 0,
+				swiperCurrent: 0,
+				pageNo: 1,
+				pageSize: 6,
+				list: [],
+				total: 0,
+				action:'swiperChange', // 操作类型,上划分页,或左右滑动
+			}
+		},
+		onLoad(options) {
+			const _this = this
+			if(options&&options.billState){  // 指定单据状态
+				const index = this.tabList.findIndex(item => item.status == options.billState)
+				_this.swiperCurrent = index
+				_this.current = index
+			}else{
+				_this.swiperCurrent = 0
+				_this.current = 0
+			}
+			// 监听整改完成后刷新事件
+			uni.$on('refreshBL', this.queryByTypeSum)
+			this.queryByTypeSum()
+			// 跳到指定tab
+			uni.$on('refreshBhList',this.refreshBhList)
+		},
+		onUnload() {
+			uni.$off('refreshBL')
+		},
+		methods:{
+			// tabs通知swiper切换
+			tabsChange(index) {
+				this.swiperCurrent = index
+			},
+			swiperChange(event){
+				this.action = 'swiperChange'
+				this.status = 'loading'
+			},
+			// swiper-item左右移动,通知tabs的滑块跟随移动
+			transition(e) {
+				let dx = e.detail.dx
+				this.$refs.uTabs.setDx(dx)
+			},
+			// 由于swiper的内部机制问题,快速切换swiper不会触发dx的连续变化,需要在结束时重置状态
+			// swiper滑动结束,分别设置tabs和swiper的状态
+			animationfinish(e) {
+				let current = e.detail.current
+				let isCurtab = this.current == current
+				if(this.status!="nomore"){
+					let loadData = this.action == 'swiperChange' ? !isCurtab : isCurtab
+					if(loadData){
+						this.$refs.uTabs.setFinishCurrent(current)
+						this.swiperCurrent = current
+						this.current = current
+						this.resetPage()
+					}
+				}
+			},
+			// scroll-view到底部加载更多
+			onreachBottom() {
+				this.action = 'onreachBottom'
+				if(this.list.length < this.total){
+					this.resetPage()
+				}else{
+					this.status = "nomore"
+				}
+			},
+			// 查询列表
+			getRow (pageNo) {
+				if (pageNo) {
+					this.pageNo = pageNo
+				}
+				let params = {
+					pageNo: this.pageNo,
+					pageSize: this.pageSize,
+					billState: this.tabList[this.current].status=='ALL'?'':this.tabList[this.current].status
+				}
+				this.status = "loading"
+				shelfReplenishList(params).then(res => {
+					if (res.status == 200) {
+						if(this.pageNo>1){
+							this.list = this.list.concat(res.data.list || [])
+						}else{
+							this.list = res.data.list || []
+						}
+						this.total = res.data.count || 0
+					} else {
+						this.list = []
+						this.total = 0
+						this.noDataText = res.message
+					}
+					this.status = "loadmore"
+				})
+			},
+			resetPage(){
+				this.status = 'loading';
+				// 上划分页
+				if(this.action == 'onreachBottom'){
+					this.pageNo += 1
+					this.getRow()
+				}
+				// 左右切换tab
+				if(this.action == 'swiperChange'){
+					this.list = []
+					this.getRow(1)
+				}
+			},
+			// 详细页
+			viewRow(item){
+				if(item.billState=='WAIT_CONFIRM'){ // 待确认
+					uni.navigateTo({ url: "/pages/replenishmentManage/confirm?sn="+item.replenishBillSn })
+				}else if(item.billState=='WAIT_OUT_STOCK'){ // 待出库
+					uni.navigateTo({ url: "/pages/replenishmentManage/outWarehousing?sn="+item.replenishBillSn })
+				}else if(item.billState=='WAIT_CHECK'){ // 待签收
+					uni.navigateTo({ url: "/pages/replenishmentManage/signWarehousing?sn="+item.replenishBillSn })
+				}else if(item.billState=='FINISH'){ // 已完成
+					uni.navigateTo({ url: "/pages/replenishmentManage/detail?sn="+item.replenishBillSn+"&type=success" })
+				}else if(item.billState=='CANCEL'){ // 已取消
+					uni.navigateTo({ url: "/pages/replenishmentManage/detail?sn="+item.replenishBillSn+"&type=cancel" })
+				}
+			},
+			// 查询每个状态的数据条数
+			queryByTypeSum () {
+				shelfReplenishStateCount({}).then(res => {
+					if (res.data && res.status == 200) {
+						this.tabList[1].count = res.data.WAIT_CONFIRM || 0
+						this.tabList[2].count = res.data.WAIT_OUT_STOCK || 0
+						this.tabList[3].count = res.data.WAIT_CHECK || 0
+						this.getRow(1)
+					}
+				})
+			},
+			refreshBhList(tab){
+				const _this = this
+				const index = this.tabList.findIndex(item => item.status == tab)
+				_this.tabsChange(index)
+			}
+		}
+	}
+</script>
+
+<style lang="scss">
+	page {
+		height: 100%;
+	}
+	.pagesCons{
+		width: 100%;
+		height: 100%;
+		display: flex;
+		flex-direction: column;
+		.text-right {
+			text-align: right;
+		}
+		.utabs{
+			border-bottom: 1px solid #eee;
+		}
+		.check-list{
+			flex: 1;
+			.swiper-item{
+				width: 100%;
+				height: 100%;
+				overflow: hidden;
+				.scroll-view {
+					width: 100%;
+					height: 100%;
+					overflow: auto;
+				}
+			}
+		}
+		 
+		// 列表样式
+		.check-order-list{
+			background: #ffffff;
+			padding: 25upx 35upx;
+			margin: 25upx;
+			border-radius: 25upx;
+			box-shadow: 1px 1px 3px #EEEEEE;
+			.check-row{
+				 display: flex;
+				 justify-content: space-between;
+				 margin-bottom: 10rpx;
+				 >view{
+					 &:first-child{
+						 color: #222;
+						 font-size: 32rpx;
+						 width: 80%;
+					 }
+					 &:last-child{
+						 font-size: 28rpx;
+						 margin-top: 5rpx;
+					 }
+				 }
+			}
+			.check-col{
+				> view{
+					padding: 2rpx 0;
+					color: #707070;
+					font-size: 26rpx;
+				}
+			}
+		}
+	}
+</style>

+ 221 - 0
pages/replenishmentManage/scanCodePrint.vue

@@ -0,0 +1,221 @@
+<template>
+	<view class="scanCodePrint-wrap">
+		<!-- <view class="barCode" id="barcode"></view> -->
+		<view class="info-body">
+			<view class="info partList">
+				<!-- 补货产品 -->
+				<partList :list="partList" title="补货产品" model="view" fromPage="scanCodePrint" ref="partList" noDataText="暂无产品"></partList>
+			</view>
+		</view>
+		<view class="sendOutGoods-footer">
+			<u-button @click="scanCode" type="success" :custom-style="customStyle" hover-class="none" shape="circle">
+				<u-icon name="scan" size="34"></u-icon>
+				点击扫码
+			</u-button>
+		</view>
+		<!-- 确认弹框 -->
+		<common-modal v-if="confirmModal" :openModal="confirmModal" :title="contTitle?'扫码成功':'扫码失败'" :content="contModal" confirmText="继续扫码" @confirm="modalConfirm" @close="confirmModal=false" />
+	</view>
+</template>
+
+<script>
+	import partList from '@/pages/common/partList.vue'
+	import commonModal from '@/pages/common/commonModal.vue'
+	import { shelfReplenishDetailList, shelfReplenishQrCode, shelfReplenishDetailOutScan } from '@/api/shelfReplenish'
+	export default {
+		components: { partList, commonModal },
+		data() {
+			return {
+				barcode:null,
+				replenishBillSn: null,
+				partList: [],
+				contTitle: '',
+				contModal: '',
+				confirmModal: false,
+				mpaasScanModule: null,
+				customStyle: {
+					borderRadius:'100rpx',
+					fontSize:'30rpx',
+					background: this.$config('primaryColor')
+				},
+			}
+		},
+		onReady() {
+			// 初始化摄像头
+			// this.init()
+		},
+		onLoad(options) {
+			this.replenishBillSn = options.sn
+			this.getPartList()
+			// 监听整改完成后刷新事件
+			uni.$on('refreshBL', this.modalConfirm)
+		},
+		onUnload() {
+			uni.$off('refreshBL')
+		},
+		methods: {
+			// 扫码
+			scanCode(){
+				// this.mpaasScanModule = uni.requireNativePlugin("Mpaas-Scan-Module")
+				// this.mpaasScanModule.mpaasScan({
+				// 	// 扫码识别类型,参数可多选,qrCode、barCode,不设置,默认识别所有
+				// 	'scanType':  ['qrCode','barCode'],
+				// 	// 是否隐藏相册,默认false不隐藏
+				// 	'hideAlbum': false
+				// },
+				// (ret) => {
+				// 	// 返回值中,resp_code 表示返回结果值,10:用户取消,11:其他错误,1000:成功
+				// 	// 返回值中,resp_message 表示返回结果信息
+				// 	// 返回值中,resp_result 表示扫码结果,只有成功才会有返回
+				// 	if(ret.resp_code == '1000'){
+				// 		this.scanResult(ret.resp_result)
+				// 	}
+				// })
+				this.mpaasScanModule = uni.requireNativePlugin("wss-scan")
+				this.mpaasScanModule.scan(
+					{
+						"scanType":["CODABAR","CODE93","CODE39","CODE128","EAN13","EAN8","ITF14","UPCCODE_A","UPCCODE_E"],
+						"scanMode":"Customized",
+						"scanStyle":{
+							"scanFrameSizePlus":{"width":250,"height":120},
+							"scanFrameSize":200,
+							"scanLight":"visible",
+							"scanText":"对准物品条形码",
+							"scanTitle":"扫码打印",
+						}
+					},
+					(result) => {
+						console.log(result)
+						if(result.scanStatus == 1){
+							this.scanResult(result.scanValue)
+						}
+					})
+			},
+			// 查询列表
+			getPartList(){
+				const _this = this
+				shelfReplenishDetailList({ replenishBillSn: this.replenishBillSn }).then(res => {
+					if(res.status == 200 && res.data){
+						res.data.map(item =>{
+							item.confirmQty = item.confirmQty ? Number(item.confirmQty) : 0
+						})
+						this.partList = res.data || []
+					}else{
+						this.partList = []
+					}
+				})
+			},
+			// 扫码结果
+			scanResult(qrCode){
+				const _this = this
+				uni.showLoading({
+					title: "正在查询产品信息"
+				})
+				console.log({
+					productQrCode: qrCode,
+					replenishBillSn: this.replenishBillSn
+				})
+				shelfReplenishQrCode({
+					productQrCode: qrCode,
+					replenishBillSn: this.replenishBillSn
+				}).then(res => {
+					console.log(res)
+					if(res.status == 200&&res.data.length){
+						let params = {
+							shelfName: res.data&&res.data[0]&&res.data[0].shelf&&res.data[0].shelf.shelfName,
+							productName: res.data&&res.data[0]&&res.data[0].product&&res.data[0].product.name,
+							productCode: res.data&&res.data[0]&&res.data[0].product&&res.data[0].product.code,
+							productSn: res.data&&res.data[0]&&res.data[0].product&&res.data[0].product.productSn,
+							confirmQty: res.data&&res.data[0]&&res.data[0].confirmQty,
+							shelfSn: res.data&&res.data[0]&&res.data[0].shelfSn,
+							replenishBillDetailSn: res.data&&res.data[0]&&res.data[0].replenishBillDetailSn,
+							shelfPlaceCode: res.data&&res.data[0]&&res.data[0].shelfPlaceCode,
+							shelfPlaceSn: res.data&&res.data[0]&&res.data[0].shelfPlaceSn
+						}
+						uni.navigateTo({ url: "/pages/common/printTag/printTag?page=smdy&data="+JSON.stringify(params) })
+					}else{
+						this.contTitle = 0
+						this.contModal = "抱歉,该产品不是此补货单的产品请更换产品重新扫描?"
+						this.confirmModal = true
+					}
+					uni.hideLoading()
+				})
+			},
+			modalConfirm(){
+				this.confirmModal = false
+				this.scanCode()
+			},
+			init(){
+				const _this = this
+				// 初始化
+				this.barcode = plus.barcode.create('barcode', [], {
+					top:'0px',
+					left:'0px',
+					width: '100%',
+					height: '28%',
+					position: 'static',
+					frameColor: '#00aaff',
+					scanbarColor: '#00aaff'
+				})
+				// 设置高度
+				const query = uni.createSelectorQuery().in(this);
+				query.select('#barcode').boundingClientRect(data => {
+					this.barcode.setStyle({
+						height: data.height	+ 'px'	// 调整扫码控件的位置
+					})
+				}).exec()
+				 
+				// 扫码成功后
+				this.barcode.onmarked = function(type, result) {
+					console.log(type,result)
+					_this.scanResult(result)
+				}
+				// 扫码识别出错
+				this.barcode.onerror = function(error){
+					console.log(error)
+					_this.toashMsg("条形码错误!")
+					_this.barcode.start()
+				}
+				
+				 const currentWebview = this.$mp.page.$getAppWebview()
+				 currentWebview.append(this.barcode)
+				 this.barcode.start()
+			}
+		}
+	}
+</script>
+
+<style lang="less">
+	page{
+		height: 100vh;
+	}
+	.scanCodePrint-wrap{
+		width: 100%;
+		height: 100%;
+		display: flex;
+		flex-direction: column;
+		.barCode{
+			height: 28%;
+		}
+		.info-body{
+			flex-grow: 1;
+			overflow: auto;
+			padding-bottom: 120rpx;
+		}
+		.info{
+			background-color: #FFFFFF;
+			padding: 10rpx 30upx;
+			font-size: 32rpx;
+			margin-top: 20rpx;
+		}
+		.sendOutGoods-footer{
+			padding: 26upx 32upx 30upx;
+			background-color: #fff;
+			position: fixed;
+			left: 0;
+			bottom: 0;
+			width: 100%;
+			box-shadow: 3px 1px 7px #eee;
+		}
+	}
+</style>

+ 304 - 0
pages/replenishmentManage/sendOutGoods.vue

@@ -0,0 +1,304 @@
+<template>
+	<view class="sendOutGoods-wrap">
+		<view class="sendOutGoods-con">
+			<!-- <view class="barCode" id="barcode"></view> -->
+			<view class="info-body">
+				<view class="info partList">
+					<!-- 补货产品 -->
+					<partList :list="partList" title="补货产品" model="view" fromPage="sendOutGoods" ref="partList" noDataText="暂无产品"></partList>
+				</view>
+			</view>
+		</view>
+		<view class="sendOutGoods-footer">
+			<u-button v-if="!isAll" @click="scanCode" type="success" :custom-style="customStyle" hover-class="none" shape="circle">
+				<u-icon name="scan" size="34"></u-icon>
+				点击扫码
+			</u-button>
+			<u-button v-else @click="handleOutGoods" type="success" :custom-style="customStyle" hover-class="none" shape="circle">立即出库</u-button>
+		</view>
+		<!-- 确认弹框 -->
+		<common-modal v-if="confirmModal" :openModal="confirmModal" :title="contTitle?'扫码成功':'扫码失败'" :content="contModal" confirmText="继续扫码" @confirm="modalConfirm" @close="confirmModal=false" />
+		<!-- 出库确认弹框 -->
+		<common-modal v-if="confirmOutModal" :openModal="confirmOutModal" title="出库" content="此补货单产品已经全部扫描完成,确认出库吗?" confirmText="确认出库" @confirm="modalOutConfirm" @close="confirmOutModal=false" />
+		<!-- 选择配送方式弹框 -->
+		<choose-type-modal v-if="chooseModal" :openModal="chooseModal" @confirm="modalChooseType" @close="closeChooseType" />
+	</view>
+</template>
+
+<script>
+	import partList from '@/pages/common/partList.vue'
+	import chooseTypeModal from './chooseTypeModal.vue'
+	import commonModal from '@/pages/common/commonModal.vue'
+	import { getQueryString } from '@/libs/tools'
+	import { shelfReplenishDetailList, shelfReplenishDetailOutScan, shelfReplenishOutStock, shelfReplenishDetail } from '@/api/shelfReplenish'
+	export default {
+		components: { partList, commonModal, chooseTypeModal },
+		data() {
+			return {
+				barcode:null,
+				replenishBillSn: null,
+				shelfSn: null,
+				partList: [],
+				confirmModal: false,
+				customStyle: {
+					borderRadius:'100rpx',
+					fontSize:'30rpx',
+					background: this.$config('primaryColor')
+				},
+				isAll: false,
+				contTitle: '',
+				contModal: '',
+				confirmOutModal: false,
+				chooseModal: false,
+				mpaasScanModule: null
+			}
+		},
+		onReady() {
+			// 初始化摄像头
+			// this.init()
+		},
+		onLoad(options) {
+			this.replenishBillSn = options.sn
+			this.shelfSn = options.shelfSn
+			this.getPartList()
+			this.getDetail()
+		},
+		methods: {
+			// 扫码
+			scanCode(){
+				// this.mpaasScanModule = uni.requireNativePlugin("Mpaas-Scan-Module")
+				// this.mpaasScanModule.mpaasScan({
+				// 	// 扫码识别类型,参数可多选,qrCode、barCode,不设置,默认识别所有
+				// 	'scanType':  ['qrCode','barCode'],
+				// 	// 是否隐藏相册,默认false不隐藏
+				// 	'hideAlbum': false
+				// },
+				// (ret) => {
+				// 	// 返回值中,resp_code 表示返回结果值,10:用户取消,11:其他错误,1000:成功
+				// 	// 返回值中,resp_message 表示返回结果信息
+				// 	// 返回值中,resp_result 表示扫码结果,只有成功才会有返回
+				// 	if(ret.resp_code == '1000'){
+				// 		this.scanResult(ret.resp_result)
+				// 	}
+				// })
+				this.mpaasScanModule = uni.requireNativePlugin("wss-scan")
+				this.mpaasScanModule.scan(
+					{
+						"scanType":["QRCODE","DATAMATRIX"],
+						"scanMode":"Customized",
+						"scanStyle":{
+							"scanFrameSizePlus":{"width":200,"height":200},
+							"scanFrameSize":200,
+							"scanLight":"visible",
+							"scanText":"对准物品二维码",
+							"scanTitle":"扫码发货出库",
+						}
+					},
+					(result) => {
+						console.log(result)
+						if(result.scanStatus == 1){
+							this.scanResult(result.scanValue)
+						}
+					})
+			},
+			// 详情
+			getDetail(){
+				shelfReplenishDetail({ sn: this.replenishBillSn }).then(res => {
+					console.log(res)
+					if(res.status == 200 && res.data){
+						if(res.data.totalConfirmQty && res.data.totalScanQty && res.data.totalConfirmQty == res.data.totalScanQty){
+							this.isAll = true
+						}else{
+							this.isAll = false
+						}
+					}else{
+						this.isAll = false
+					}
+				})
+			},
+			// 立即出库
+			handleOutGoods(){
+				if(this.isAll){
+					this.confirmOutModal = true
+				}else{
+					this.toashMsg("请全部扫描完成后,再进行出库操作")
+				}
+			},
+			// 选择配送方式
+			modalChooseType(data){
+				const _this = this
+				const arr = []
+				_this.partList.map((item, index) => {
+				  arr.push({
+				    productSn: item.productSn,
+				    confirmQty: item.confirmQty,
+				    replenishBillDetailSn: item.replenishBillDetailSn
+				  })
+				})
+				const params = {
+				  replenishBillSn: _this.replenishBillSn,
+				  detailList: arr,
+				  dispatchType: data.dispatchType,
+				  remarks: data.remarks,
+				  shelfSn: _this.shelfSn
+				}
+				console.log(params)
+				shelfReplenishOutStock(params).then(res => {
+					console.log(res)
+				  if (res.status == 200) {
+				    _this.toashMsg(res.message)
+					_this.chooseModal = false
+					
+					uni.$emit('refreshBL')
+					uni.$emit("refreshBhList",'WAIT_CHECK')
+					uni.navigateBack({
+						delta:2
+					})
+				  }else{
+					  _this.toashMsg(res.message)
+				  }
+				})
+			},
+			// 确认出库
+			modalOutConfirm(){
+				this.confirmOutModal = false
+				this.chooseModal = true
+			},
+			closeChooseType(){
+				this.confirmOutModal = false
+				this.chooseModal = false
+			},
+			// 查询列表
+			getPartList(){
+				const _this = this
+				shelfReplenishDetailList({ replenishBillSn: this.replenishBillSn }).then(res => {
+					if(res.status == 200 && res.data){
+						res.data.map(item =>{
+							item.confirmQty = item.confirmQty ? Number(item.confirmQty) : 0
+						})
+						this.partList = res.data || []
+					}else{
+						this.partList = []
+					}
+				})
+			},
+			// 扫码结果
+			scanResult(qrCode){
+				const _this = this
+				const pa = qrCode.split("&")
+				console.log(qrCode,pa)
+				shelfReplenishDetailOutScan({
+					replenishBillSn: _this.replenishBillSn,
+					// shelfSn: getQueryString('&'+qrCode, 'shelfSn'),
+					// shelfPlaceSn: getQueryString('&'+qrCode, 'shelfPlaceSn'),
+					// productSn: getQueryString('&'+qrCode, 'productSn')
+					shelfSn: pa[0],
+					shelfPlaceSn: pa[3],
+					productSn: pa[2]
+				}).then(res => {
+					console.log(res)
+					if(res.status == 200){
+						// 刷新列表
+						_this.getPartList()
+						if(res.data && res.data.totalConfirmQty && res.data.totalScanQty && res.data.totalConfirmQty == res.data.totalScanQty){
+							_this.isAll = true
+							_this.handleOutGoods()
+						}else{
+							this.contTitle = 1
+							this.contModal = '是否继续扫码'
+							this.confirmModal = true
+						}
+					}else{
+						this.contTitle = 0
+						this.contModal = res.message
+						this.confirmModal = true
+					}
+				})
+			},
+			modalConfirm(){
+				this.confirmModal = false
+				this.scanCode()
+			},
+			init(){
+				// const _this = this
+				// // 初始化
+				// this.barcode = plus.barcode.create('barcode', [], {
+				// 	top:'0px',
+				// 	left:'0px',
+				// 	width: '100%',
+				// 	height: '28%',
+				// 	position: 'static',
+				// 	frameColor: '#00aaff',
+				// 	scanbarColor: '#00aaff'
+				// })
+				// // 设置高度
+				// const query = uni.createSelectorQuery().in(this);
+				// query.select('#barcode').boundingClientRect(data => {
+				// 	this.barcode.setStyle({
+				// 		height: data.height	+ 'px'	// 调整扫码控件的位置
+				// 	})
+				// }).exec()
+				 
+				// // 扫码成功后
+				// this.barcode.onmarked = function(type, result) {
+				// 	console.log(type,result)
+				// 	_this.scanResult(result)
+				// }
+				// // 扫码识别出错
+				// this.barcode.onerror = function(error){
+				// 	console.log(error)
+				// 	_this.toashMsg("条形码错误!")
+				// 	_this.barcode.start()
+				// }
+				
+				//  const currentWebview = this.$mp.page.$getAppWebview()
+				//  currentWebview.append(this.barcode)
+				//  this.barcode.start()
+			}
+		}
+	}
+</script>
+
+<style lang="less">
+	page{
+		height: 100vh;
+	}
+	.sendOutGoods-wrap{
+		position: relative;
+		width: 100%;
+		height: 100%;
+		overflow: hidden;
+		padding-bottom: 136upx;
+		.sendOutGoods-con{
+			width: 100%;
+			height: 100%;
+			overflow: auto;
+			display: flex;
+			flex-direction: column;
+			.barCode{
+				height: 33%;
+				margin-bottom: 10%;
+			}
+			.info-body{
+				flex-flow: 1;
+				overflow: auto;
+				height: 100%;
+			}
+			.info{
+				background-color: #FFFFFF;
+				padding: 10rpx 30upx;
+				font-size: 32rpx;
+				margin-top: 20rpx;
+			}
+		}
+		.sendOutGoods-footer{
+			padding: 26upx 32upx 30upx;
+			background-color: #fff;
+			position: fixed;
+			left: 0;
+			bottom: 0;
+			width: 100%;
+			box-shadow: 3px 1px 7px #eee;
+		}
+	}
+</style>

+ 213 - 0
pages/replenishmentManage/signWarehousing.vue

@@ -0,0 +1,213 @@
+<template>
+	<view class="replenishment-putWarehousing-wrap" :style="`backgroundImage:linear-gradient(180deg, ${$config('primaryColor')}, #F5F6F7 12%)`">
+		<view class="replenishment-putWarehousing-body">
+			<view class="head-info" v-if="basicInfoData">
+				<view class="states">
+					<view>
+						<u-icon name="icon_warehousing" custom-prefix="iscm-icon" size="48"></u-icon>
+						<text>待签收</text>
+					</view>
+				</view>
+				<view>
+					<view class="label"><u-icon name="icon_delivery" custom-prefix="iscm-icon" size="32"></u-icon><text>配送方式</text></view>
+					<view class="info-txt">{{basicInfoData.dispatchTypeDictValue || '--'}}</view>
+				</view>
+				<view>
+					<view class="label"><u-icon name="icon_remark" custom-prefix="iscm-icon" size="32"></u-icon><text>出库备注</text></view>
+					<view class="info-txt">{{basicInfoData.remarks || '--'}}</view>
+				</view>
+			</view>
+			<view class="part-list">
+				<!-- 补货产品 -->
+				<partList :list="partList" title="补货产品" model="view" fromPage="replenishmentSign" ref="partList" noDataText="暂无产品" @numberChange="numberChange"></partList>
+			</view>
+		</view>
+		<view class="replenishment-putWarehousing-footer">
+			<u-button @click="confirmModal=true" type="success" :custom-style="customStyle" hover-class="none" shape="circle">确定签收({{confirmQty}}/{{totalQty}})</u-button>
+		</view>
+		<!-- 确认弹框 -->
+		<common-modal :openModal="confirmModal" content="签收后数字货架的产品数量将增加,确认签收吗?" confirmText="确认签收" @confirm="modalConfirm" @close="confirmModal=false" />
+	</view>
+</template>
+
+<script>
+	import commonModal from '@/pages/common/commonModal.vue'
+	import { shelfReplenishDetail, shelfReplenishDetailList, shelfReplenishPutStock } from '@/api/shelfReplenish'
+	import partList from '@/pages/common/partList.vue'
+	export default {
+		components: { partList, commonModal },
+		data() {
+			return {
+				replenishBillSn: '',
+				basicInfoData:null,
+				partList: [],
+				confirmQty: 0,  // 实发数量之和
+				totalQty: 0,  // 应发数量之和
+				customStyle: {
+					borderRadius:'100rpx',
+					fontSize:'30rpx',
+					background: this.$config('primaryColor')
+				},
+				confirmModal: false
+			}
+		},
+		onReady() {
+			uni.setNavigationBarColor({
+				frontColor: '#ffffff',
+				backgroundColor: this.$config('primaryColor')
+			})
+		},
+		onLoad(option) {
+			this.replenishBillSn = option.sn
+			this.getDetail()
+			this.getPartList()
+		},
+		methods: {
+			// 查询详情
+			getDetail(){
+				shelfReplenishDetail({ sn: this.replenishBillSn }).then(res => {
+					if(res.status == 200){
+						this.basicInfoData = res.data || null
+					}else{
+						this.basicInfoData = null
+					}
+				})
+			},
+			// 查询列表
+			getPartList(){
+				const _this = this
+				shelfReplenishDetailList({ replenishBillSn: this.replenishBillSn }).then(res => {
+					if(res.status == 200 && res.data){
+						_this.totalQty = 0
+						_this.confirmQty = 0
+						res.data.map(item =>{
+							item.confirmQty = item.confirmQty ? Number(item.confirmQty) : 0
+							item.putQty = item.confirmQty ? Number(item.confirmQty) : 0
+							if(item.confirmQty && Number(item.confirmQty)){
+								_this.totalQty += Number(item.confirmQty)
+							}
+							if(item.putQty && Number(item.putQty)){
+								_this.confirmQty += Number(item.putQty)
+							}
+						})
+						this.partList = res.data || []
+					}else{
+						this.partList = []
+					}
+				})
+			},
+			// 确认签收 confirm
+			modalConfirm(){
+				const arr = []
+				this.partList.map((item, index) => {
+				  if (item.putQty || item.putQty == 0) {
+				    arr.push({
+						productSn: item.productSn,
+						putQty: item.putQty,
+						replenishBillDetailSn: item.replenishBillDetailSn,
+						shelfPlaceSn: item.shelfPlaceSn,
+						shelfPlaceCode: item.shelfPlaceCode
+					})
+				  }
+				})
+				const params = {
+				  replenishBillSn: this.replenishBillSn,
+				  detailList: arr
+				}
+				shelfReplenishPutStock(params).then(res => {
+					if(res.status == 200){
+						uni.$emit('refreshBL')
+						uni.$emit("refreshBhList",'FINISH')
+						uni.navigateBack()
+					}
+					this.toashMsg(res.message)
+				})
+			},
+			// 数量 change
+			numberChange(value, index){
+				const _this = this
+				this.confirmQty = 0
+				let list = this.$refs.partList.getAllData()
+				list.map(item => {
+					if(item.putQty && Number(item.putQty)){
+						_this.confirmQty += Number(item.putQty)
+					}
+				})
+			}
+		}
+	}
+</script>
+
+<style lang="less">
+page{
+	height: 100vh;
+}
+.replenishment-putWarehousing-wrap{
+	position: relative;
+	width: 100%;
+	height: 100%;
+	overflow: hidden;
+	padding-bottom: 136upx;
+	.replenishment-putWarehousing-body{
+		padding: 0 30rpx;
+		height: 100%;
+		overflow: auto;
+		> view{
+			padding: 10rpx 25rpx;
+			background-color: #fff;
+			margin-bottom: 20rpx;
+			border-radius: 25rpx;
+			box-shadow: 2rpx 3rpx 5rpx #eee;
+		}
+		.head-info{
+			.states{
+				border: 0;
+				padding: 20rpx 0;
+				> view{
+					color: #191919;
+					text-align: center;
+					font-size: 40rpx;
+					text{
+						margin-left: 20rpx;
+					}
+				}
+			}
+			.info-txt{
+				word-break: break-word;
+			}
+			font-size: 30rpx;
+			> view{
+				display: flex;
+				border-bottom: 2rpx solid #f5f5f5;
+				padding: 20rpx 0;
+				> view:last-child{
+					flex-grow: 1;
+					width: 80%;
+				}
+				&:last-child{
+					border:0;
+				}
+			}
+			.label{
+				display: flex;
+				align-items: center;
+				width: 220rpx;
+				height: 44rpx;
+				color: #7C7D7E;
+				text{
+					margin-left: 10rpx;
+				}
+			}
+		}
+	}
+	.replenishment-putWarehousing-footer{
+		padding: 26upx 32upx 30upx;
+		background-color: #fff;
+		position: fixed;
+		left: 0;
+		bottom: 0;
+		width: 100%;
+		box-shadow: 3px 1px 7px #eee;
+	}
+}
+</style>

+ 132 - 0
pages/replenishmentManage/stockModal.vue

@@ -0,0 +1,132 @@
+<template>
+	<u-mask class="stockModal" :show="isShow" :mask-click-able="false">
+		<view class="modal-con">
+			<view class="modal-title">以下产品库存不足<br/>确认继续补货吗?</view>
+			<scroll-view scroll-y class="modal-main">
+				<view class="modal-box" v-for="(item, index) in list" :key="index">
+					<view class="modal-p-header">
+						<view class="modal-p-code">{{item.product&&item.product.code?item.product.code:'--'}}</view>
+						<view class="modal-p-num">库存<text class="txt-red">{{item.stockQty||item.stockQty==0?item.stockQty:'--'}}</text>/补货<text class="txt-main">{{item.confirmQty||item.confirmQty==0?item.confirmQty:'--'}}</text>{{item.product&&item.product.unit?item.product.unit:'--'}}</view>
+					</view>
+					<view class="modal-p-footer">{{item.product&&item.product.name?item.product.name:'--'}}</view>
+				</view>
+			</scroll-view>	
+			<view class="modal-footer">
+				<view class="button-cancel" @click="isShow=false">返回修改</view>
+				<view class="button-confirm" @click="handleConfirm">仍然补货</view>
+			</view>
+		</view>
+	</u-mask>
+</template>
+
+<script>
+	export default {
+		props: {
+			openModal: { //  弹框显示状态
+				type: Boolean,
+				default: false
+			},
+			list: { //  库存不足产品信息
+				type: Array,
+				default: () => {
+					return []
+				}
+			},
+			params: {
+			  type: Object,
+			  default: () => {
+			    return {}
+			  }
+			}
+		},
+		data() {
+			return {
+				isShow: this.openModal, //  是否打开弹框
+			}
+		},
+		methods: {
+			// 确认
+			handleConfirm(){
+				this.$emit('confirm', this.params)
+			}
+		},
+		watch: {
+			//  父页面传过来的弹框状态
+			openModal (newValue, oldValue) {
+				this.isShow = newValue
+			},
+			//  重定义的弹框状态
+			isShow (newValue, oldValue) {
+			  if (!newValue) {
+			    this.$emit('close')
+			  }
+			}
+		}
+	}
+</script>
+
+<style lang="scss" scoped>
+	.stockModal{
+		width: 100%;
+		height: 100%;
+		position: absolute;
+		left: 0;
+		top: 0;
+		.modal-con{
+			width: 78%;
+			margin: 40% auto 0;
+			background-color: #fff;
+			border-radius: 24upx;
+			.modal-title{
+				text-align: center;
+				font-size: 28upx;
+				color: #000;
+				padding: 30upx 30upx 0;
+			}
+			.modal-main{
+				padding: 30upx 20upx 40upx;
+				box-sizing: border-box;
+				height: 400upx;
+				overflow: hidden;
+				.modal-box{
+					padding: 20upx 0;
+					border-top: 1upx dashed #E5E5E5;
+					.modal-p-header{
+						display: flex;
+						justify-content: space-between;
+						align-content: center;
+						color: #999999;
+						margin-bottom: 20upx;
+						.modal-p-num{
+							.txt-red{
+								color: red;
+							}
+							.txt-main{
+								color: #000;
+							}
+						}
+					}
+				}
+			}
+			.modal-footer{
+				font-size: 30upx;
+				display: flex;
+				justify-content: space-between;
+				align-items: center;
+				text-align: center;
+				border-top: 1upx solid #E5E5E5;
+				.button-cancel{
+					color: #999;
+					border-right: 1upx solid #E5E5E5;
+					flex-grow: 1;
+					padding: 20upx 0;
+				}
+				.button-confirm{
+					color: #2A86F4;
+					flex-grow: 1;
+					padding: 20upx 0;
+				}
+			}
+		}
+	}
+</style>

+ 282 - 0
pages/sales/addCustomer.vue

@@ -0,0 +1,282 @@
+<template>
+	<view class="addCustomer-content">
+		<view class="content-form">
+			<u-form :model="form" ref="uForm"  label-width="180" :error-type="['toast']">
+				<u-form-item label="客户名称" required ><u-input v-model.trim="form.customerName" placeholder="请输入客户名称(最多30个字符)" input-align="right" :maxlength="60"/></u-form-item>
+				<u-form-item label="客户地址" required >
+					<u-input v-model="areaInfo.label" :disabled="true" input-align="right" placeholder="请选择客户地址" @click="openAddress"/>
+					<u-icon name="arrow-right" color="#C0C4CC" slot="right"  @click="openAddress"></u-icon>
+				</u-form-item>
+				<u-form-item label="详细地址">
+					<textarea :auto-height="true" input-align="right" placeholder="请输入详细地址(最多60个字符)" :maxlength="60" v-model="form.customerAddr" class="receiveAddress" placeholder-style="color:#C0C4CC;font-size:28upx;"/>
+				</u-form-item>
+				<u-form-item label="联系人">
+					<u-input v-model="form.contactName" input-align="right" placeholder="请输入联系人(最多30个字符)" :maxlength="11"/>
+				</u-form-item>
+				<u-form-item label="联系电话">
+					<u-input v-model.trim="form.contactTel" placeholder="请输入联系电话(最多15个字符)" input-align="right" :maxlength="15"/>
+				</u-form-item>
+				<u-form-item label="联系手机"><u-input v-model.trim="form.contactMobile" placeholder="请输入联系手机(最多11位字符)" input-align="right" :maxlength="11"/>
+				</u-form-item>
+				<u-form-item label="价格类型" required >
+					<v-select ref="priceType" :disabled="true" placeholder="请选择价格类型" @itemChange="chooseType" code="PRICE_TYPE" style="width: 100%"></v-select>
+				</u-form-item>
+				<u-form-item label="收款方式" required prop="settleStyleSn">
+					<u-input v-model="settleStyleName" input-align="right" :disabled="true" placeholder="请选择收款方式" @click="showSettle=true"/>
+					<u-icon name="arrow-right" color="#C0C4CC" slot="right"></u-icon>
+				</u-form-item>
+				<u-form-item label="客户传真">
+					<u-input v-model="form.fax" input-align="right" placeholder="请输入客户传真(最多30个字符)" :maxlength="30"/>
+				</u-form-item>
+				<u-form-item label="客户类型">
+					<u-input v-model="custTypeName" input-align="right" :disabled="true" placeholder="请选择客户类型"  @click="showCust=true"/>
+					<u-icon name="arrow-right" color="#C0C4CC" slot="right"  @click="showCust=true"></u-icon>
+				</u-form-item>
+				<u-form-item label="配送方式" >
+					<v-select ref="dispatchType" :disabled="true" placeholder="请选择配送方式" @itemChange="choosedispatchType" code="DISPATCH_TYPE" style="width: 100%"></v-select>
+				</u-form-item>
+			</u-form>
+		</view>
+		<view class="form-footer-btn">
+			<u-button class="handle-btn" size="medium" shape="circle" hover-class="none" @click="customerSubmit" :custom-style="customBtnStyle">保存</u-button>
+		</view>
+		<!-- 省市区 -->
+		<Address ref="applyAddress" @onConfirm="areaConfirm"></Address>
+		<!-- 选择收款方式 -->
+		<u-picker v-model="showSettle" title="收款方式"  @confirm="settleStyleChange" :range="settleTypeList" range-key="name" mode="selector" :default-selector="JSON.parse(JSON.stringify(defaultSettleIndex))"></u-picker>
+		<!-- 客户类型 -->
+		<u-picker v-model="showCust" title="客户类型" @confirm="custTypeChange" :range="custTypeList" range-key="name" mode="selector" :default-selector="JSON.parse(JSON.stringify(defaultCustIndex))"></u-picker>
+	</view>
+</template>
+
+<script>
+	import {settleStyleQueryAll} from '@/api/sales.js'
+	import {customerDetail,custType,custSave,employeeAllList} from '@/api/customer.js'
+	import Address from '@/components/address.vue'
+	import vSelect  from  '@/components/select/v-select.vue'
+	import { isvalidPhone } from '@/libs/validate.js'
+	export default{
+		components:{Address,vSelect},
+		data(){
+			return{
+				customerData:null, // 客户信息
+				customBtnStyle: {  //  自定义按钮样式
+					margin:0
+				},
+				// 客户form
+				form:{
+					id: null,
+					customerName: '', // 客户名称
+					contactTel: '', //  联系电话
+					contactMobile: '', //  联系手机
+					contactName: '', //  联系人
+					provinceSn: undefined, //  省
+					provinceName: '',
+					citySn: undefined, // 市
+					cityName: '',
+					countySn: undefined, // 区
+					countyName: '',
+					customerAddr: '', //  详细地址
+					fax: '', //  客户传真
+					dispatchType: undefined, //  配送方式
+					satelliteFlag: 0, //  是否卫星仓客户
+					customerTypeSn: undefined, //  客户类型
+					priceType: '', //  价格类型
+					settleStyleSn: undefined //  收款方式
+				},
+				showSettle:false,//结算方式初始值
+				settleTypeList:[],//收款方式列表
+				settleStyleName:'',//收款方式名称
+				custTypeList:[] ,// 客户类型数据
+				showCust:false, //客户类型下拉弹窗初始值
+				custTypeName:'', // 客户类型名称
+				areaInfo: {},  //  省市区
+				areaIdArr: [],  //  省市区id数组
+				defaultSettleIndex:[0] ,//选中收款方式的下标
+				defaultCustIndex:[0],//选中客户类型的下标
+			}
+		},
+		// 必须要在onReady生命周期,因为onLoad生命周期组件可能尚未创建完毕
+		onReady() {
+			this.$refs.uForm.setRules(this.rules);
+		},
+		onLoad(option) {
+			this.getSettleStyle()
+			this.getCustomerList()
+		},
+		methods:{
+			// 选择价格类型
+			chooseType(val){
+				console.log(val,'vai')
+				this.form.priceType=val
+			},
+			// 选择配送方式
+			choosedispatchType(val){
+				this.form.dispatchType=val
+			},
+			//  选择省区市
+			areaConfirm(e) {
+				console.log('已选择的省市区', e)
+				this.areaInfo = e
+				this.areaIdArr = [ e.provinceCode, e.cityCode, e.areaCode ]
+				this.form.provinceSn=e.provinceCode
+				this.form.citySn=e.cityCode
+				this.form.countySn=e.areaCode
+				this.form.provinceName=e.labelArr[0]
+				this.form.cityName=e.labelArr[1]
+				this.form.countyName=e.labelArr[2]
+			},
+			openAddress(){
+				//  省市区  回显     参数为省市区id数组
+				// console.log(this.areaIdArr,'this.areaIdArr')
+				this.$refs.applyAddress.open(this.areaIdArr)
+			},
+			brandClean(){
+				this.settleStyleName=''
+				this.form.settleStyleSn=undefined
+			},
+			// 获取客户类型列表
+			getCustomerList(){
+				custType({}).then(res=>{
+					if(res.status==200){
+						this.custTypeList=res.data
+					}else{
+						this.custTypeList=[]
+					}
+				})
+			},
+			// 获取结算方式列表
+			getSettleStyle(){
+				settleStyleQueryAll({}).then(res=>{
+					if(res.status==200){
+						this.settleTypeList=res.data
+					}else{
+						this.settleTypeList=null
+					}
+				})
+			},
+			// 收款方式change
+			settleStyleChange(e){
+				console.log(e,'data')
+				this.defaultSettleIndex=[e]
+				this.settleStyleName=this.settleTypeList[e].name
+				this.form.settleStyleSn=this.settleTypeList[e].settleStyleSn
+			},
+			// 客户类型change
+			custTypeChange(e){
+				this.defaultCustIndex=[e]
+				this.custTypeName=this.custTypeList[e].name
+				this.form.customerTypeSn=this.custTypeList[e].customerTypeSn
+			},
+			// 保存 (新增客户)
+			customerSubmit(){
+				console.log('保存===========')
+				this.$refs.uForm.validate(valid => {
+					if (valid) {
+						console.log('验证通过');
+						if (this.form.customerName ==='') {
+							uni.showToast({
+								title: '请输入客户名称',
+								icon: 'none'
+							})
+							return false
+						}
+						if(this.form.contactMobile){
+							if (!isvalidPhone(this.form.contactMobile)) {
+								uni.showToast({
+									title: '请输入正确的联系手机',
+									icon: 'none'
+								})
+								return false
+							}
+						}
+						//  省市区
+						if(this.areaIdArr.length == 0){
+							uni.showToast({icon: 'none',title: '请选择省市区'})
+							return
+						}
+						if (this.form.priceType ==undefined) {
+							uni.showToast({
+								title: '请选择价格类型',
+								icon: 'none'
+							})
+							return false
+						}
+						if (this.form.settleStyleSn ==undefined) {
+							uni.showToast({
+								title: '请选择收款方式',
+								icon: 'none'
+							})
+							return false
+						}
+						const params=Object.assign({},this.form,this.areaIdArr)
+						console.log(params,'params')
+						if(this.form.id) {
+							params.id = this.form.id
+						}
+						custSave(params).then(res=>{
+							if(res.status == 200) {
+								uni.showToast({
+									title: res.message,
+									icon: 'none'
+								})
+								setTimeout(()=>{
+									uni.redirectTo({
+										url:'/pages/sales/addSales?pageType=add&nowId='+res.data.id
+									})
+								},300)
+							} 
+						})
+					} else {
+						console.log('验证失败');
+					}
+				})
+			},
+		}
+	}
+</script>
+
+<style lang="scss">
+	.addCustomer-content{
+		width: 100%;
+		height: 100vh;
+		background-color: #fff;
+		padding:0 40upx;
+		display: flex;
+		flex-direction: column;
+		.content-customerName{
+			// padding: 10upx;
+			// border-radius: 10upx;
+			// border: 1upx solid #e5e5e5;
+		}
+		.content-form{
+			flex: 1;
+			// box-shadow:0 8upx 24upx rgba(0,0,0,.1);
+			// border: 1upx solid #e5e5e5;
+			.receiveAddress{
+				width: 100%;
+				line-height: 1.5em;
+				box-sizing: border-box;
+				font-style: normal;
+				text-align: end;
+			}
+		}
+		.content-form:not(:last-child){
+			border-bottom: none;
+		}
+		.form-footer-btn{
+			background-color: #fff;
+			position: fixed;
+			bottom: 0;
+			left: 0;
+			width: 100%;
+			padding: 16upx 20upx 12upx;
+			z-index: 999;
+			.handle-btn{
+				width: 100%;
+				background-color: rgb(51, 95, 182);
+				color: #fff;
+			}
+		}
+	}
+</style>

+ 472 - 0
pages/sales/addSales.vue

@@ -0,0 +1,472 @@
+<template>
+	<view class="addCustomer-content">
+		<view class="content-customerName">
+			<view class="flex justify_between align_center customerName">
+			<text>{{customerData?customerData.customerName:''}}</text>
+				<u-button size="mini" :hair-line="false" plain type="primary" hover-class="none" @click="goBack" :custom-style="customBtnStyle">重新选择</u-button>
+			</view>
+		</view>
+		<view class="flex_1 content-box">
+			<view class="content-form">
+				<u-form :model="form" ref="uForm"  label-width="180" :error-type="['toast']">
+					<u-form-item label="客户地址" required >
+						<u-input v-model="areaInfo.label" :disabled="true" input-align="right" placeholder="请选择客户地址" @click="openAddress"/>
+						<u-icon name="arrow-right" color="#C0C4CC" slot="right"  @click="openAddress"></u-icon>
+					</u-form-item>
+					<u-form-item label="详细地址">
+						<textarea :auto-height="true" input-align="right" placeholder="请输入详细地址(最多60个字符)" :maxlength="60" v-model="form.shippingAddress" class="receiveAddress" placeholder-style="color:#C0C4CC;font-size:28upx;"/>
+					</u-form-item>
+					<u-form-item label="联系人">
+						<u-input v-model="form.consigneeName" input-align="right" placeholder="请输入联系人(最多30个字符)" :maxlength="11"/>
+					</u-form-item>
+					<u-form-item label="联系电话">
+						<u-input v-model.trim="form.consigneeTel" placeholder="请输入联系电话(最多15个字符)" input-align="right" :maxlength="15"/>
+					</u-form-item>
+					<u-form-item label="联系手机"><u-input v-model.trim="form.contactMobile" placeholder="请输入联系手机(最多11位字符)" input-align="right" :maxlength="11"/>
+					</u-form-item>
+					<u-form-item label="价格类型" required >
+						<v-select ref="priceType" :disabled="true" placeholder="请选择价格类型" @itemChange="chooseType" code="PRICE_TYPE" style="width: 100%"></v-select>
+					</u-form-item>
+					<u-form-item label="收款方式" required prop="settleStyleSn">
+						<u-input v-model="settleStyleName" input-align="right" :disabled="true" placeholder="请选择收款方式" @click="showSettle=true"/>
+						<u-icon name="arrow-right" color="#C0C4CC" slot="right"></u-icon>
+					</u-form-item>
+					<u-form-item label="铺货出库" required v-if="itemId">
+						<view style="width: 100%;display:flex;justify-content: flex-end;">
+						<u-radio-group v-model="form.distributionFlag" @change="radioChange" >
+							<u-radio 
+								v-for="(item, index) in ckList" :key="index" 
+								:name="item.code"
+							>
+								{{item.dispName}}
+							</u-radio>
+						</u-radio-group>
+						</view>
+					</u-form-item>
+					<u-form-item label="配送方式" >
+						<v-select ref="dispatchType" :disabled="true" placeholder="请选择配送方式" @itemChange="choosedispatchType" code="DISPATCH_TYPE" style="width: 100%"></v-select>
+					</u-form-item>
+					<u-form-item label="业务员">
+						<u-input v-model="userName" input-align="right" :disabled="true" placeholder="请选择业务员"  @click="showUser=true"/>
+						<u-icon name="arrow-right" color="#C0C4CC" slot="right"  @click="showUser=true"></u-icon>
+					</u-form-item>
+					<u-form-item label="备注">
+						<textarea :auto-height="true" input-align="right" placeholder="请输入备注(最多100个字符)" :maxlength="100" v-model="form.remarks" class="receiveAddress" placeholder-style="color:#C0C4CC;font-size:28upx;"/>
+					</u-form-item>
+				</u-form>
+			</view>
+			<view class="form-footer-btn">
+				<u-button class="handle-btn" size="medium" shape="circle" hover-class="none" @click="handleSaveCust" :custom-style="customBtnStyle">新增销售单</u-button>
+			</view>
+		</view>
+		<!-- 省市区 -->
+		<Address ref="applyAddress" @onConfirm="areaConfirm"></Address>
+		<!-- 选择收款方式 -->
+		<u-picker v-model="showSettle" title="收款方式"  @confirm="settleStyleChange" :range="settleTypeList" range-key="name" mode="selector" :default-selector="JSON.parse(JSON.stringify(defaultSettleIndex))"></u-picker>
+		<!-- 客户类型 -->
+		<u-picker v-model="showCust" title="客户类型" @confirm="custTypeChange" :range="custTypeList" range-key="name" mode="selector" :default-selector="JSON.parse(JSON.stringify(defaultCustIndex))"></u-picker>
+		<!-- 业务员 -->
+		<u-picker v-model="showUser" title="业务员" @confirm="userChange" :range="userList" range-key="name" mode="selector"></u-picker>
+	</view>
+</template>
+
+<script>
+	import {settleStyleQueryAll,salesSave} from '@/api/sales.js'
+	import {customerDetail,custType,employeeAllList,updateByCustomerSn} from '@/api/customer.js'
+	import Address from '@/components/address.vue'
+	import vSelect  from  '@/components/select/v-select.vue'
+	export default{
+		components:{Address,vSelect},
+		data(){
+			return{
+				title:'',
+				customerData:null, // 客户信息
+				priceTypeName:'', //客户类型名称
+				customBtnStyle: {  //  自定义按钮样式
+					margin:0
+				},
+				showDispatch:false,// 配送方式下拉弹窗初始值
+				showSettle:false,//结算方式初始值
+				settleTypeList:[],//收款方式列表
+				settleStyleName:'',//收款方式名称
+				custTypeList:[] ,// 客户类型数据
+				showCust:false, //客户类型下拉弹窗初始值
+				custTypeName:'', // 客户类型名称
+				areaInfo: {},  //  省市区
+				areaIdArr: [],  //  省市区id数组
+				itemId:'',
+				ckList:[{dispName: "是",code:1,lookupCode: "FLAG"},{dispName: "否",code:0,lookupCode: "FLAG"}],
+				showUser:false,//业务员下拉框初始默认值
+				userList:[], //业务员数据
+				userName:'', //业务员姓名
+				salesManSn:'', //业务员sn
+				defaultSettleIndex:[0] ,//选中收款方式的下标
+				defaultIndex:[0] ,//选中收款方式的下标
+				defaultCustIndex:[0],//选中客户类型的下标
+				defaultUserIndex:[0],//选中业务员的下标
+				//销售单form
+				form:{
+					buyerName: '', // 客户名称
+					buyerSn: undefined, // 客户sn
+					consigneeTel: '', //  联系电话
+					contactMobile: '',
+					consigneeName: '', //  联系人
+					shippingAddressProvinceSn: undefined, //  省
+					shippingAddressProvinceName: '',
+					shippingAddressCitySn: undefined, // 市
+					shippingAddressCityName: '',
+					shippingAddressCountySn: undefined, // 区
+					shippingAddressCountyName: '',
+					shippingAddress: '', //  详细地址
+					fax: '', //  客户传真
+					dispatchType: undefined, //  配送方式
+					satelliteFlag: 0, //  是否卫星仓客户
+					priceType: undefined, //  价格类型
+					settleStyleSn: undefined, //  收款方式
+					salesManSn: undefined, //  业务员
+					salesManName: '',
+					distributionFlag: '0', // 铺货出库
+					salesTragetType: 'CUSTOMER',
+					remarks: '' ,//  备注
+					addrProvinceList:[],
+					addrDistrictList:[],
+					addrCityList:[]
+				}
+			}
+		},
+		// 必须要在onReady生命周期,因为onLoad生命周期组件可能尚未创建完毕
+		onReady() {
+			this.$refs.uForm.setRules(this.rules);
+		},
+		onLoad(option) {
+			console.log(option.nowId,'option')
+			if(option.nowId){
+				// if(option.pageType=='edit'){
+				// 	uni.setNavigationBarTitle({
+				// 	  title:'编辑销售单'
+				// 	})
+				// }else{
+				// 	uni.setNavigationBarTitle({
+				// 	  title:'新增销售单'
+				// 	})
+				// }
+				this.itemId=option.nowId
+				this.getCustomerData(this.itemId)
+				this.getUserAllList()
+				setTimeout(()=>{
+					// 回显收款方式并下拉数据默认高亮选中
+					const ind=this.settleTypeList.findIndex((item)=>{
+						return item.settleStyleSn==this.customerData.settleStyleSn
+					})
+					console.log(ind,'ind')
+					this.settleStyleName=this.settleTypeList[ind].name
+					this.defaultSettleIndex=[ind]
+					// 回显业务员并下拉数据默认高亮选中
+					if(this.customerData.salesManSn){
+						const userInd=this.userList.findIndex((item)=>{
+							return item.customerSn==this.customerData.salesManSn
+						})
+						this.defaultUserIndex=[userInd]
+						this.form.salesManName=this.userList[userInd].name
+						this.form.salesManSn=this.userList[userInd].salesManSn
+					}
+					console.log(ind,'a',JSON.parse(JSON.stringify(this.defaultSettleIndex)) )
+				},200)
+			}
+			this.getSettleStyle()
+			this.getCustomerList()
+		},
+		methods:{
+			getCustomerData(val){
+				uni.showLoading({title:'加载中...',mask:true})
+				customerDetail({id:val}).then(res=>{
+					if(res.status==200){
+						uni.hideLoading({})
+						this.customerData=res.data
+						this.areaIdArr=[this.customerData.provinceSn,this.customerData.citySn,this.customerData.countySn]
+						this.areaInfo={label:this.customerData.provinceName+'-'+this.customerData.cityName+'-'+this.customerData.countyName}
+						// this.setFun(res.data)
+						this.form = Object.assign(this.form, {
+						  buyerName: this.customerData.customerName, // 客户名称
+						  buyerSn: this.customerData.customerSn, // 客户sn
+						  consigneeTel: this.customerData.contactTel, //  联系电话
+						  contactMobile: this.customerData.contactMobile,
+						  consigneeName: this.customerData.contactName, //  联系人
+						  shippingAddressProvinceSn: this.customerData.provinceSn, //  省
+						  shippingAddressProvinceName: this.customerData.provinceName,
+						  shippingAddressCitySn: this.customerData.citySn, // 市
+						  shippingAddressCityName: this.customerData.cityName,
+						  shippingAddressCountySn: this.customerData.countySn, // 区
+						  shippingAddressCountyName: this.customerData.countyName,
+						  shippingAddress: this.customerData.customerAddr, //  详细地址
+						  fax: this.customerData.fax, //  客户传真
+						  dispatchType: this.customerData.dispatchType, //  配送方式
+						  satelliteFlag: this.customerData.satelliteFlag, //  是否卫星仓客户
+						  priceType: this.customerData.priceType, //  价格类型
+						  settleStyleSn: this.customerData.settleStyleSn //  收款方式
+						})
+						if(this.customerData.priceType || this.customerData.dispatchType){
+							setTimeout(()=>{
+								this.$refs.priceType.setVal(this.customerData.priceType)
+							},200)
+						}
+						if(this.customerData.dispatchType){
+							setTimeout(()=>{
+								this.$refs.dispatchType.setVal(this.customerData.dispatchType)
+							},200)
+						}
+						this.form=Object.assign(this.form,res.data)
+					}else{
+						this.customerData=null
+					}
+				})
+			},
+			// 客户信息信息更改后先保存
+			handleSaveCust () {
+			  const params = {
+			    customerName: this.form.buyerName,
+			    customerSn: this.form.buyerSn,
+			    contactTel: this.form.consigneeTel, //  联系电话
+			    contactMobile: this.form.contactMobile,
+			    contactName: this.form.consigneeName, //  联系人
+			    provinceSn: this.form.shippingAddressProvinceSn, //  省
+			    provinceName: this.form.shippingAddressProvinceName,
+			    citySn: this.form.shippingAddressCitySn, // 市
+			    cityName: this.form.shippingAddressCityName,
+			    countySn: this.form.shippingAddressCountySn, // 区
+			    countyName: this.form.shippingAddressCountyName,
+			    customerAddr: this.form.shippingAddress, //  详细地址
+			    dispatchType: this.form.dispatchType, //  配送方式
+			    priceType: this.form.priceType, //  价格类型
+			    settleStyleSn: this.form.settleStyleSn //  收款方式
+			  }
+			  updateByCustomerSn(params).then(res => {
+			    if (res.status == 200) {
+			      // 保存销售单
+			      this.salesSbmit()
+			    } 
+			  })
+			},
+			// 重新选择
+			goBack(){
+				uni.$emit('clear')
+				setTimeout(()=>{
+					uni.navigateBack({})
+				},500)
+				
+			},
+			radioChange(e) {
+				console.log(e);
+				this.form.distributionFlag=e
+			},
+			// 选择价格类型
+			chooseType(val){
+				console.log(val,'vai')
+				this.form.priceType=val
+			},
+			// 选择配送方式
+			choosedispatchType(val){
+				this.form.dispatchType=val
+			},
+			//  选择省区市
+			areaConfirm(e) {
+				console.log('已选择的省市区', e)
+				this.areaInfo = e
+				this.areaIdArr = [ e.provinceCode, e.cityCode, e.areaCode ]
+				this.form.shippingAddressProvinceSn=e.provinceCode
+				this.form.shippingAddressCitySn=e.cityCode
+				this.form.shippingAddressCountySn=e.areaCode
+				this.form.shippingAddressProvinceName=e.labelArr[0]
+				this.form.shippingAddressCityName=e.labelArr[1]
+				this.form.shippingAddressCountyName=e.labelArr[2]
+			},
+			openAddress(){
+				//  省市区  回显     参数为省市区id数组
+				// console.log(this.areaIdArr,'this.areaIdArr')
+				this.$refs.applyAddress.open(this.areaIdArr)
+			},
+			// 获取业务员列表数据
+			getUserAllList () {
+			  employeeAllList({}).then(res => {
+			    if (res.status == 200) {
+			      this.userList = res.data || []
+			    } else {
+			      this.userList = []
+			    }
+			  })
+			},
+			// 获取客户类型列表
+			getCustomerList(){
+				custType({}).then(res=>{
+					if(res.status==200){
+						this.custTypeList=res.data
+					}else{
+						this.custTypeList=[]
+					}
+				})
+			},
+			// 获取结算方式列表
+			getSettleStyle(){
+				settleStyleQueryAll({}).then(res=>{
+					if(res.status==200){
+						this.settleTypeList=res.data
+					}else{
+						this.settleTypeList=null
+					}
+				})
+			},
+			// 收款方式change
+			settleStyleChange(e){
+				console.log(e,'data')
+				this.defaultSettleIndex=[e]
+				this.settleStyleName=this.settleTypeList[e].name
+				this.form.settleStyleSn=this.settleTypeList[e].settleStyleSn
+			},
+			// 客户类型change
+			custTypeChange(e){
+				this.defaultCustIndex=[e]
+				this.custTypeName=this.custTypeList[e].name
+				this.form.customerTypeSn=this.custTypeList[e].customerTypeSn
+			},
+			// 业务员change
+			userChange(e){
+				this.defaultUserIndex=[e]
+				this.form.salesManName=this.userList[e].name
+				this.form.salesManSn=this.userList[e].salesManSn
+			},
+			// 保存 (新增销售单)
+			salesSbmit(){
+				console.log('保存===========')
+				this.$refs.uForm.validate(valid => {
+					if (valid) {
+						console.log('验证通过');
+						if (this.form.customerName ==='') {
+							uni.showToast({
+								title: '请输入客户名称',
+								icon: 'none'
+							})
+							return false
+						}
+						//  省市区
+						if(this.areaIdArr.length == 0){
+							uni.showToast({icon: 'none',title: '请选择省市区'})
+							return
+						}
+						if (this.form.priceType ==undefined) {
+							uni.showToast({
+								title: '请选择价格类型',
+								icon: 'none'
+							})
+							return false
+						}
+						if (this.form.settleStyleSn ==undefined) {
+							uni.showToast({
+								title: '请选择收款方式',
+								icon: 'none'
+							})
+							return false
+						}
+						const params={
+							buyerName:this.customerData.customerName , // 客户名称
+							buyerSn: this.customerData.customerSn, // 客户sn
+							consigneeTel: this.form.consigneeTel?this.form.consigneeTel: this.customerData.contactTel, //  联系电话
+							contactMobile:this.form.contactMobile?this.form.contactMobile: this.customerData.contactMobile, // 联系手机
+							consigneeName:this.form.consigneeName?this.form.consigneeName: this.customerData.contactName, //  联系人
+							shippingAddressProvinceSn:this.form.shippingAddressProvinceSn?this.form.shippingAddressProvinceSn: this.customerData.provinceSn, //  省
+							shippingAddressProvinceName:this.form.shippingAddressProvinceName?this.form.shippingAddressProvinceName: this.customerData.customerName,
+							shippingAddressCitySn:this.form.shippingAddressCitySn?this.form.shippingAddressCitySn: this.customerData.citySn, // 市
+							shippingAddressCityName:this.form.shippingAddressCityName?this.form.shippingAddressCityName: this.customerData.cityName,
+							shippingAddressCountySn:this.form.shippingAddressCountySn?this.form.shippingAddressCountySn: this.customerData.countySn, // 区
+							shippingAddressCountyName:this.form.shippingAddressCountyName?this.form.shippingAddressCountyName: this.customerData.countyName,
+							shippingAddress:this.form.customerAddr?this.form.customerAddr: this.customerData.customerAddr, //  详细地址
+							fax:this.form.fax?this.form.fax: this.customerData.fax, //  客户传真
+							dispatchType:this.form.dispatchType?this.form.dispatchType: this.customerData.dispatchType, //  配送方式
+							satelliteFlag: 0, //  是否卫星仓客户
+							priceType:this.form.priceType?this.form.priceType: this.customerData.priceType, //  价格类型
+							settleStyleSn:this.form.settleStyleSn?this.form.settleStyleSn: this.customerData.settleStyleSn, //  收款方式
+							salesManSn:this.form.salesManSn ||undefined, //  业务员
+							salesManName: '',
+							distributionFlag: this.form.distributionFlag, // 铺货出库
+							salesTragetType: 'CUSTOMER',
+							remarks: this.remarks //  备注
+						}
+						console.log(params,'params')
+						salesSave(params).then(res=>{
+							if(res.status == 200) {
+								uni.showToast({
+									title: res.message,
+									icon: 'none'
+								})
+								setTimeout(()=>{
+									uni.navigateTo({
+										url:'/pages/sales/edit?pageType=edit&data='+JSON.stringify(res.data)
+									})
+								},300)
+							} 
+						})
+					} else {
+						console.log('验证失败');
+					}
+				})
+			},
+		}
+	}
+</script>
+
+<style lang="scss">
+	.addCustomer-content{
+		width: 100%;
+		height: 100vh;
+		// background-color: #fff;
+		
+		display: flex;
+		flex-direction: column;
+		.content-customerName{
+			width: 100%;
+			.customerName{
+				// position: fixed;
+				width: 100%;
+				// z-index: 999;
+				color: #000000;
+				font-size: 30upx;
+				font-weight: 1000;
+				background-color: #fff;
+				padding:10upx 40upx 20upx;
+			}
+		}
+		.content-box{
+			display: flex;
+			flex-direction: column;
+			// margin-top: 100upx;
+			padding:0 40upx;
+			background-color: #fff;
+		}
+		.content-form{
+			flex: 1;
+			.receiveAddress{
+				width: 100%;
+				line-height: 1.5em;
+				box-sizing: border-box;
+				font-style: normal;
+				text-align: end;
+			}
+		}
+		.content-form:not(:last-child){
+			border-bottom: none;
+		}
+		.form-footer-btn{
+			background-color: #fff;
+			position: fixed;
+			bottom: 0;
+			left: 0;
+			width: 100%;
+			padding:0 30upx ;
+			z-index: 999;
+			.handle-btn{
+				width: 100%;
+				background-color: rgb(51, 95, 182);
+				color: #fff;
+			}
+		}
+	}
+</style>

+ 152 - 0
pages/sales/chooseCustomer.vue

@@ -0,0 +1,152 @@
+<template>
+	<view class="chooseCustomer-content">
+		<view class="search">
+			<view class="flex justify_between align_center search-title">
+				<text class="search-label">客户名称</text>
+				<view class="search-btn">
+					<text>没有搜索到?</text>
+					<text>点击</text>
+					<text @click="addCustomer">新增客户</text>
+				</view>
+			</view>
+			<u-search
+				placeholder="请输入客户名称搜索" 
+				v-model="queryWord" 
+				height="90"
+				@input="searchBrand"
+				@blur="searchBrand"
+				@search="searchBrand"
+				@clear="clearSearch"
+				:showAction="false">
+			</u-search>
+		</view>
+		<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;text-align: center;padding: 10upx;">最多显示前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/customer.js'
+	export default{
+		data(){
+			return{
+				listData:[],
+				queryWord:'',
+				pageSize:20,
+				pageNo:1,
+				scrollH:300,
+			}
+		},
+		onLoad() {
+			uni.$on('clear',this.clearSearch)
+		},
+		onShow() {
+			this.init()
+		},
+		onUnload() {
+			uni.$off('clear',this.clearSearch)
+		},
+		methods:{
+			// 初始数据
+			init(){
+				this.listData=[]
+				this.queryWord=''
+				this.pageSize=20
+				this.pageNo=1
+			},
+			// 新增客户
+			addCustomer(){
+				uni.navigateTo({
+					url:'/pages/sales/addCustomer'
+				})
+			},
+			getData(){
+				console.log('调用')
+				uni.showLoading({title:'加载中...',mask:true})
+				customerList({queryWord:this.queryWord,pageNo:this.pageNo,pageSize:this.pageSize}).then(res => {
+					if(res.status == 200 && res.data){
+						uni.hideLoading({})
+						this.listData = res.data.list
+					}else{
+						this.listData = []
+					}
+				})
+			},
+			// 搜索品牌
+			searchBrand(){
+				if(this.queryWord != ''){
+					this.getData()
+				}
+			},
+			clearSearch(){
+				this.queryWord = ''
+				this.listData = []
+			},
+			chooseItem(val){
+				console.log(val)
+				this.queryWord=this.listData[val].customerName
+				uni.navigateTo({
+					url:'/pages/sales/addSales?pageType=edit&nowId='+this.listData[val].id
+				})
+			}
+		},
+	}
+</script>
+
+<style lang="scss">
+	.chooseCustomer-content{
+		width: 100%;
+		height: 100vh;
+		background-color: #fff;
+		padding:0 30upx;
+		display: flex;
+		flex-direction: column;
+		.search{
+			.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
+					}
+				}
+			}
+		}
+		.picker-content{
+			padding: 6upx 0 20upx;
+			width: 100%;
+			height: calc(100vh-144upx);
+			flex: 1;
+			overflow-y: scroll;
+			.picker-main{
+				width: 100%;
+				.picker-main-item{
+					padding: 0 20upx;
+					.item-name{
+						padding: 30upx 0;
+						border-bottom: 1rpx solid #e5e6eb;
+					}
+					.item-name:not(:last-child){
+						border-bottom:none
+					}
+				}
+			}
+		}
+	}
+</style>

+ 514 - 0
pages/sales/chooseProduct.vue

@@ -0,0 +1,514 @@
+<template>
+	<view class="chooseProduct-wrap">
+		<!-- 产品列表 -->
+		<view class="product-list-box">
+			<scroll-view class="product-list-con" :style="{height: scrollH+'upx'}" scroll-y @scrolltolower="onreachBottom">
+				<view class="product-list-item font_13" v-for="(item, index) in listData" :key="item.id">
+					<view class="list-item-tit">
+						<view class="item-tit ellipsis-one" :style="{borderColor: $config('primaryColor')}">{{item.productName}}</view>
+					</view>
+					<view class="list-item-con flex align_center justify_between">
+						<view class="flex align_center justify_between flex_1">
+							<view class="pimgs">
+								<u-image :src="item.productMainImage?item.productMainImage:`../../static/${theme}/def_img@2x.png`" width="128" height="128" border-radius="10"></u-image>
+							</view>
+							<view class="flex_1">
+								<view>产品编码:{{item.productCode || '--'}}</view>
+								<view class="padding_3">原厂编码:{{item.productOrigCode || '--'}}</view>
+								<view v-if="item.warehouseName || item.warehouseLocationName">仓库仓位:{{item.warehouseName}} > {{item.warehouseLocationName}}</view>
+							</view>
+						</view>
+						<view class="list-item-btn">
+							<u-icon class="item-btn-add" name="plus-circle" :color="$config('primaryColor')" size="42" @click="handleAdd(item, 'add')"></u-icon>
+						</view>
+					</view>
+					<view class="list-item-footer flex align_center justify_between">
+						<view class="footer-item" v-if="searchParams && searchParams.cost">
+							<view>{{toThousands(item.putCost||0, 2)}}</view>
+							<view class="color_6">成本价</view>
+						</view>
+						<view class="footer-item" v-if="searchParams && searchParams.cityPrice">
+							<view>{{toThousands(item.dealerProduct && item.dealerProduct.cityPrice || 0, 2)}}</view>
+							<view class="color_6">市级价</view>
+						</view>
+						<view class="footer-item">
+							<view>{{toThousands(item.currentQty||0)}}{{item.unit}}</view>
+							<view class="color_6">库存数量</view>
+						</view>
+						<view class="footer-item">
+							<view>
+								<text :style="{color: $config('errorColor')}">¥{{toThousands(item.price||0, 2)}}</text>
+								<text v-if="item.origSalePriceFlag == 1">(原)</text>
+							</view>
+							<view class="color_6">参考售价</view>
+						</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>
+				<view style="padding-bottom: 20upx;">
+					<u-loadmore v-if="totalNum>listData.length || status=='loading'" :status="status" />
+				</view>
+			</scroll-view>
+		</view>
+		<!-- 合计 -->
+		<view ref="productTotal" class="selected-box flex align_center justify_between">
+			<view class="choose-info flex_1 flex align_center justify_between" @click="lookProduct">
+				<text>已选 {{detailData && (detailData.totalCategory || detailData.totalCategory==0) ? toThousands(detailData.totalCategory) : '--'}} 款,合计 ¥{{detailData && (detailData.totalAmount || detailData.totalAmount==0) ? toThousands(detailData.totalAmount, 2) : '--'}}</text>
+				<u-icon name="arrow-up" :color="$config('primaryColor')" size="34" class="close-circle"></u-icon>
+			</view>
+			<view class="choose-btn" @click="handleChoose" :style="{backgroundColor: $config('primaryColor')}">选好了</view>
+		</view>
+		<!-- 查询右侧弹框 -->
+		<productSearch :openModal="openModal" :defaultParams="searchParams" @refresh="refresh" @close="openModal=false" />
+		<!-- 添加/编辑产品 -->
+		<productModal :openModal="openProductModal" :infoData="productInfo" @confirm="productConfirm" @close="openProductModal=false" />
+		<!-- 已选产品 -->
+		<selectedProductsModal ref="selectedProducts" :openModal="openSelectedModal" :nowData="detailData" @edit="handleEdit" @confirm="handleChoose" @delete="handleDel" @close="openSelectedModal=false" />
+		<!-- 弹框 -->
+		<common-modal :openModal="commonModal" :content="modalText" @confirm="handleCommon" @cancel="handleCancel" @close="commonModal=false" />
+	</view>
+</template>
+
+<script>
+	import ProductSearch from './productSearch.vue'
+	import ProductModal from './productModal.vue'
+	import SelectedProductsModal from './selectedProductsModal.vue'
+	import commonModal from '@/pages/common/commonModal.vue'
+	import { toThousands } from '@/libs/tools'
+	import { querySumByProductLocation, stockByProductSn } from '@/api/stock'
+	import { salesDetail, supperCodeByVin, salesDetailInsert, salesDetailUpdate, salesDetailList } from '@/api/sales'
+	export default{
+		components: { ProductSearch, ProductModal, SelectedProductsModal, commonModal },
+		data(){
+			return{
+				toThousands,
+				listData: [],
+				pageNo: 1,
+				pageSize: 6,
+				totalNum: 0,
+				status: 'loadmore',
+				noDataText: '暂无数据',
+				searchParams: null,
+				openModal: false,
+				theme: '',
+				salesInfo: null,  // 销售单信息
+				scrollH: 0,
+				openProductModal: false,  // 编辑产品信息弹框是否显示
+				productData: null,  // 当前操作的产品信息
+				productInfo: null,  // 添加/编辑产品需要的参数
+				chooseType: 'add',  // 添加产品add,编辑产品edit
+				commonModal: false,  // 公共弹框是否显示
+				modalText: '',  // 公共弹框提示语
+				commonType: 1,  // 公共弹框类型  1为添加产品时库存不足,2为编辑产品时库存不足,3为售价低于定价,4为售价低于成本价
+				openSelectedModal: false,  // 已选产品弹框是否显示
+				detailData: null,  // 销售单详情数据
+				editInfo: null,  // 添加/编辑 提交的值
+			}
+		},
+		onNavigationBarButtonTap(e){  // 标题栏 按钮操作
+			this.openModal = true
+		},
+		onBackPress() {
+			uni.$emit("refreshEditBL")
+		},
+		onLoad(opt) {
+			this.theme = getApp().globalData.theme
+			if(opt){
+				this.salesInfo = opt.data ? JSON.parse(opt.data) : null
+			}
+			this.init()
+			
+			const _this = this
+			uni.getSystemInfo({
+				success: function (res) {
+					const winH = res.windowHeight * 2
+					_this.scrollH = winH - 180
+				}
+			})
+		},
+		methods: {
+			init(){
+				this.getList(1)  // 产品列表
+				this.selectedProductTotal()  // 已选产品合计
+			},
+			// 获取查询参数 刷新列表
+			refresh(params){
+				console.log('查询', params)
+				const _this = this
+				if(params.vinCode && params.vinCode.length == 17){
+					// 查询vin码
+					supperCodeByVin({ vin: params.vinCode }).then(res => {
+						if(res.status == 200){
+							params.productCodeList = res.data.partCodeList || []
+							this.searchParams = params
+							this.getList(1)
+						}
+					})
+				}else{
+					this.searchParams = params
+					this.getList(1)
+				}
+			},
+			// 列表
+			getList(pageNo){
+				const _this = this
+				if (pageNo) {
+					this.pageNo = pageNo
+				}
+				let params = {
+					pageNo: this.pageNo,
+					pageSize: this.pageSize
+				}
+				let searchParams = JSON.parse(JSON.stringify(this.searchParams))
+				console.log(searchParams)
+				if(searchParams){
+					searchParams.brandName = undefined
+					searchParams.nowData = undefined
+					searchParams.warehouseName = undefined
+					searchParams.cost = undefined
+					searchParams.cityPrice = undefined
+				}
+				this.status = "loading"
+				querySumByProductLocation(Object.assign(params, searchParams, { customerSn: this.salesInfo.buyerSn, salePriceType: this.salesInfo.priceType, salesBillSn: this.salesInfo.salesBillSn })).then(res => {
+					if (res.status == 200) {
+						if(res.data && res.data.list){
+							res.data.list.map(item => {
+								item.salesNums = 1
+								item.currentQty = item.currentQty || 0
+								item.price = item.lastSalePrice ? item.lastSalePrice : item.salePrice
+							})
+						}
+						if(this.pageNo>1){
+							this.listData = this.listData.concat(res.data.list || [])
+						}else{
+							this.listData = res.data.list || []
+						}
+						this.totalNum = res.data.count || 0
+					} else {
+						this.listData = []
+						this.totalNum = 0
+						this.noDataText = res.message
+					}
+					this.status = "loadmore"
+				})
+			},
+			// scroll-view到底部加载更多
+			onreachBottom() {
+				if(this.listData.length < this.totalNum){
+					this.pageNo += 1
+					this.getList()
+				}
+			},
+			// 添加/编辑产品
+			handleAdd(data, type){
+				if(type == 'add'){
+					this.productInfo = {
+						productName: data.productName,
+						productMainImage: data.productMainImage,
+						productCode: data.productCode,
+						productOrigCode: data.productOrigCode,
+						warehouseName: data.warehouseName,
+						warehouseLocationName: data.warehouseLocationName,
+						price: data.price,
+						qty: 1
+					}
+				}else if(type == 'edit'){
+					this.productInfo = {
+						productName: data.productName,
+						productMainImage: data.productMainImage,
+						productCode: data.productCode,
+						productOrigCode: data.productOrigCode,
+						warehouseName: data.warehouseEntity && data.warehouseEntity.name,
+						warehouseLocationName: data.warehouseLocationEntity && data.warehouseLocationEntity.name,
+						price: data.price,
+						qty: data.qty
+					}
+				}
+				this.openProductModal = true
+				this.chooseType = type
+				this.productData = data
+			},
+			// 已选产品  编辑
+			handleEdit(data){
+				this.handleAdd(data, 'edit')
+			},
+			// 选好了
+			handleChoose(){
+				// uni.redirectTo({ url: '/pages/sales/edit?pageType=edit&data='+JSON.stringify(this.detailData) })
+				uni.$emit("refreshEditBL")
+				uni.navigateBack()
+			},
+			// 查看已选产品
+			lookProduct(){
+				this.openSelectedModal = true
+			},
+			// 确认产品信息
+			productConfirm(data){
+				this.editInfo = data
+				if(this.chooseType == 'add'){
+					this.validatePrice()  //验证  售价是否低于定价
+				}else if(this.chooseType == 'edit'){
+					this.validateStock()  //验证  库存是否不足
+				}
+			},
+			// 售价低于定价
+			validatePrice(){
+				if (this.productData.lastSalePrice && (this.editInfo.price < this.productData.salePrice)) {  // 售价低于定价
+					this.commonType = 1
+					this.modalText = '售价低于定价,确认要添加吗?'
+					this.commonModal = true
+				}else{
+					this.validateStock()  //验证  库存是否不足
+				}
+			},
+			// 库存不足
+			validateStock(){
+				if(this.chooseType == 'add'){  // 添加产品
+					if (this.productData.currentQty < this.editInfo.qty) {
+						this.commonType = 2
+						this.modalText = '库存不足,将产生急件,确认要添加吗?'
+						this.commonModal = true
+					}else{
+						this.validateCost()  //验证  售价是否低于成本价
+					}
+				}else if(this.chooseType == 'edit'){  // 编辑产品
+					//  校验库存
+					stockByProductSn({ productSn: this.productData.productSn }).then(res => {
+						if (res.status == 200) {
+							if (res.data && (!res.data.currentStockQty || this.editInfo.qty <= res.data.currentStockQty)) {
+								this.editProduct()
+							} else {  // 库存不足
+								this.commonType = 3
+								this.modalText = '库存不足,将产生急件,确认修改吗?'
+								this.commonModal = true
+							}
+						}
+					})
+				}
+			},
+			// 售价低于成本价
+			validateCost(){
+				if (this.productData.putCost > this.editInfo.price) {
+					this.commonType = 4
+					this.modalText = '售价低于成本价,确认要添加吗?'
+					this.commonModal = true
+				}else{
+					this.addProduct()
+				}
+			},
+			// 添加产品
+			addProduct(){
+				let params = {
+					buyerSn: this.detailData.buyerSn,
+					productSn: this.productData.productSn,
+					cost: this.productData.putCost,
+					price: this.editInfo.price,
+					qty: this.editInfo.qty,
+					salesBillSn: this.detailData.salesBillSn,
+					salesBillNo: this.detailData.salesBillNo,
+					warehouseSn: this.productData.warehouseSn,
+					warehouseLocationSn: this.productData.warehouseLocationSn,
+					stockSn: this.productData.stockSn
+				}
+				salesDetailInsert(params).then(res => {
+					if(res.status == 200){
+						this.toashMsg(res.message)
+						this.changeList('add', params)  // 变更  列表产品可选状态
+						this.selectedProductTotal()  // 已选产品合计
+						this.commonModal = false
+						this.openProductModal = false
+					}
+				})
+			},
+			// 编辑产品
+			editProduct(){
+				let params = {
+					id: this.productData.id,
+					qty: this.editInfo.qty,
+					price: this.editInfo.price,
+					productSn: this.productData.productSn,
+					salesBillSn: this.detailData.salesBillSn,
+				}
+				salesDetailUpdate(params).then(res => {
+					if(res.status == 200){
+						this.toashMsg(res.message)
+						this.$refs.selectedProducts.getList(1)
+						this.changeList('add', params)  // 变更  列表产品可选状态
+						this.selectedProductTotal()  // 已选产品合计
+						this.commonModal = false
+						this.openProductModal = false
+					}
+				})
+			},
+			// 更改产品列表参数
+			changeList(type, obj){
+				const _this = this
+				// 查询已选产品列表中产品编码一致的产品,则为需要变更“已添加”状态的产品
+				let params = {
+					pageNo: 1,
+					pageSize: 100,
+					salesBillSn: this.detailData.salesBillSn,
+					productSn: obj.productSn
+				}
+				salesDetailList(params).then(res => {
+					if(res.status == 200){
+						if(res.data && res.data.list){
+							let listArr = []
+							let listInd = []
+							this.listData.filter(function(item, index){
+								if(item.productSn == obj.productSn){
+									listArr.push(item)
+									listInd.push(index)
+								}
+							})
+							let chooseList = res.data.list || []
+							if(type == 'add'){
+								console.log('添加', chooseList,'++',listArr)
+								listArr.map((subItem, subInd) => {
+									chooseList.map(item => {  // 已选产品 产品sn一致的数据
+										if(subItem.productSn == item.productSn && subItem.warehouseLocationSn == item.warehouseLocationSn){
+											_this.$nextTick(() => {
+												_this.listData[listInd[subInd]].saleQty = 1  // 非0即可,用于判断是否显示添加产品按钮
+											})
+										}
+									})
+								})
+								// 添加 产品总库存为0添加为急件时的情况
+								if(chooseList.length == 1 && chooseList[0].oosFlag==1){
+									_this.$nextTick(() => {
+										_this.listData[listInd[0]].saleQty = 1  // 非0即可,用于判断是否显示添加产品按钮
+									})
+								}
+							}else if(type == 'del'){
+								console.log('删除', chooseList,'++',listArr)
+								listArr.map((subItem, subInd) => {
+									_this.$nextTick(() => {
+										_this.listData[listInd[subInd]].saleQty = 0  // 非0即可,用于判断是否显示添加产品按钮
+									})
+								})
+								listArr.map((subItem, subInd) => {
+									chooseList.map(item => {  // 已选产品 产品sn一致的数据
+										if(subItem.productSn == item.productSn && subItem.warehouseLocationSn == item.warehouseLocationSn){
+											_this.$nextTick(() => {
+												_this.listData[listInd[subInd]].saleQty = 1  // 非0即可,用于判断是否显示添加产品按钮
+											})
+										}
+									})
+								})
+								this.selectedProductTotal()  // 更新产品款数
+							}
+						}
+					}
+				})
+			},
+			// 删除已选产品
+			handleDel(data){
+				this.changeList('del', data)  // 变更  列表产品可选状态
+			},
+			// 公共弹框  确定
+			handleCommon(){
+				if(this.commonType == 1){  // 添加产品时售价低于定价
+					this.validateStock()  //验证  库存是否不足
+				}else if(this.commonType == 2){  // 添加产品时库存不足
+					this.validateCost()  //验证  售价是否低于成本价
+				}else if(this.commonType == 3){  // 编辑产品时库存不足
+					this.editProduct()
+				}else if(this.commonType == 4){  // 添加产品时售价低于成本价
+					this.addProduct()
+				}
+			},
+			// 公共弹框  取消
+			handleCancel(){
+				this.openProductModal = false
+			},
+			// 已选产品合计
+			selectedProductTotal(){
+				salesDetail({ id: this.salesInfo.id }).then(res => {
+					if(res.status == 200){
+						this.detailData = res.data
+					}else{
+						this.detailData = null
+					}
+				})
+			},
+		}
+	}
+</script>
+
+<style lang="scss">
+	.chooseProduct-wrap{
+		width: 100%;
+		position: relative;
+		height: 100vh;
+		overflow: hidden;
+		.padding_3{
+			padding: 6upx 0;
+		}
+		.color_6{
+			color: #666;
+		}
+		.product-list-box{
+			padding: 14upx 20upx;
+			.product-list-con{
+				.product-list-item{
+					background: #ffffff;
+					padding: 20upx 20upx 0;
+					margin-bottom: 25upx;
+					border-radius: 25upx;
+					box-shadow: 1px 1px 3px #EEEEEE;
+					.list-item-tit{
+						padding-bottom: 12upx;
+						border-bottom: 1px solid #e4e7ed;
+						.item-tit{
+							font-weight: bold;
+							color: rgb(48, 49, 51);
+							font-size: 28upx;
+							padding-left: 10upx;
+							border-left: 6upx solid #000;
+							line-height: 1;
+						}
+					}
+					.list-item-con{
+						padding: 14upx 0 16upx;
+						font-size: 26upx;
+						.pimgs{
+							margin-right: 16upx;
+						}
+						.list-item-btn{
+							width: 10%;
+							text-align: center;
+						}
+					}
+					.list-item-footer{
+						border-top: 1px solid #e4e7ed;
+						.footer-item{
+							width: 50%;
+							text-align: center;
+							border-right: 1px solid #e4e7ed;
+							font-size: 26upx;
+							padding: 8upx 0 12upx;
+						}
+						.footer-item:last-child{
+							border: none;
+						}
+					}
+				}
+			}
+		}
+		.selected-box{
+			background-color: #fff;
+			box-shadow: 1px -1px 3px #EEEEEE;
+			.choose-info{
+				padding: 0 30upx;
+			}
+			.choose-btn{
+				color: #fff;
+				width: 28%;
+				padding: 26upx 0;
+				text-align: center;
+			}
+		}
+	}
+</style>

+ 128 - 0
pages/sales/discountModal.vue

@@ -0,0 +1,128 @@
+<template>
+	<u-mask class="discountModal" :show="isShow" :mask-click-able="false">
+		<view class="discount-con">
+			<view class="discount-main">
+				<view class="text-c">请输入折扣金额</view>
+				<view class="discount-price text-c">
+					<u-input class="price" v-model="formValidate.discountAmount" @input="numberToFixed('discountAmount',2,999999)" @focus="amountFocus" placeholder="请输入折扣金额" :clearable="false" type="digit" style="display: inline-block;vertical-align: middle;" />元
+				</view>
+			</view>
+			<view class="discount-footer">
+				<view class="button-cancel" @click="isShow=false">取消</view>
+				<view class="button-confirm" @click="handleConfirm">确定</view>
+			</view>
+		</view>
+	</u-mask>
+</template>
+
+<script>
+	import { numberToFixed } from '@/libs/tools'
+	export default {
+		props: {
+			openModal: { //  弹框显示状态
+				type: Boolean,
+				default: false
+			},
+			infoData: {
+				tyoe: Object,
+				default: ()=>{
+					return null
+				}
+			},
+			amount: {
+				type: [Number, String],
+				default: ''
+			}
+		},
+		data() {
+			return {
+				isShow: this.openModal, //  是否打开弹框
+				discountAmount: '',
+				formValidate: {
+					discountAmount: 0
+				}
+			}
+		},
+		methods: {
+			// 确认
+			handleConfirm(){
+				if(this.formValidate.discountAmount){
+					this.$emit('confirm', this.formValidate.discountAmount)
+				}else{
+					this.toashMsg('请输入折扣金额')
+				}
+			},
+			// 小数点后两位
+			numberToFixed: function (key, num, max) {
+			  let val = this.formValidate[key]
+			  let ret = numberToFixed(val, num, max)
+			  this.$nextTick(() => {
+			  	this.formValidate[key] = ret
+			  })
+			},
+			//  折扣金额  获取焦点
+			amountFocus(){
+				this.formValidate.discountAmount = this.formValidate.discountAmount == 0 ? '' : this.formValidate.discountAmount
+			}
+		},
+		watch: {
+			//  父页面传过来的弹框状态
+			openModal (newValue, oldValue) {
+				this.isShow = newValue
+			},
+			//  重定义的弹框状态
+			isShow (newValue, oldValue) {
+				if (!newValue) {
+					this.$emit('close')
+					this.formValidate.discountAmount = 0
+				}else{
+					this.formValidate.discountAmount = this.amount || ''
+				}
+			}
+		}
+	}
+</script>
+
+<style lang="scss" scoped>
+	.discountModal{
+		width: 100%;
+		height: 100%;
+		.text-c{
+			text-align: center;
+		}
+		.discount-con{
+			width: 78%;
+			margin: 55% auto 0;
+			background-color: #fff;
+			border-radius: 24upx;
+			.discount-main{
+				padding: 60upx 20upx 50upx;
+				.discount-price{
+					margin: 10upx 0;
+					.price{
+						border-bottom: 1upx solid #e4e7ed;
+					}
+				}
+			}
+			.discount-footer{
+				font-size: 30upx;
+				display: flex;
+				justify-content: space-between;
+				align-items: center;
+				text-align: center;
+				border-top: 1upx solid #E5E5E5;
+				.button-cancel{
+					color: #999;
+					border-right: 1upx solid #E5E5E5;
+					flex-grow: 1;
+					padding: 20upx 0;
+				}
+				.button-confirm{
+					color: #2A86F4;
+					flex-grow: 1;
+					padding: 20upx 0;
+				}
+			}
+		}
+	}
+</style>

+ 517 - 0
pages/sales/edit.vue

@@ -0,0 +1,517 @@
+<template>
+	<view class="sales-edit-wrap flex flex_column">
+		<!-- 基础信息 -->
+		<view class="sales-info-con">
+			<u-section @click="infoModal=true" title="基础信息" sub-title="查看更多" :line-color="$config('primaryColor')"></u-section>
+			<view class="info-item-box">
+				<text class="info-item-tit color_6">销售单号</text>
+				<text>{{detailData && detailData.salesBillNo || '--'}}</text>
+			</view>
+			<view class="info-item-box">
+				<text class="info-item-tit color_6">客户名称</text>
+				<text>{{detailData && detailData.buyerName || '--'}}</text>
+			</view>
+		</view>
+		<!-- 产品列表 -->
+		<view class="sales-product-con flex flex_column">
+			<view>
+			<!-- 标题 -->
+			<view class="sales-product-header border-b flex align_center justify_between">
+				<u-section title="产品列表" :right="pageData.type=='edit'" :line-color="$config('primaryColor')">
+					<template slot="right" v-if="pageData.type=='edit'">
+						<view class="sales-product-operation">
+							<u-button @click="discountModal=true" size="mini" :hair-line="false" shape="circle" plain type="primary" hover-class="none">
+								打折
+								<text v-if="detailData&&detailData.discountAmount">:¥{{detailData.discountAmount}}</text>
+							</u-button>
+							<u-button @click="handleProduct" size="mini" :hair-line="false" shape="circle" :custom-style="customBtnStyle" type="primary" hover-class="none">选择产品</u-button>
+						</view>
+					</template>
+				</u-section>
+			</view>
+			<!-- 合计 -->
+			<view ref="salesTotal" class="sales-total-box border-b font_13 flex justify_between">
+				<view class="sales-total-con flex_1" :style="{height: toggle ? 'auto' : '44upx'}">
+					<view>
+						总款数:<text class="sales-total-num" :style="{color: $config('warringColor')}">{{detailData && (detailData.totalCategory || detailData.totalCategory==0) ? toThousands(detailData.totalCategory) : '--'}}</text>;总数量:<text class="sales-total-num" :style="{color: $config('warringColor')}">{{detailData && (detailData.totalQty || detailData.totalQty==0) ? toThousands(detailData.totalQty) : '--'}}</text>;总售价:<text class="sales-total-num" :style="{color: $config('warringColor')}">¥{{detailData && (detailData.totalAmount || detailData.totalAmount==0) ? toThousands(detailData.totalAmount, 2) : '--'}}</text>;
+					</view>
+					<view>
+						折扣金额:<text class="sales-total-num" :style="{color: $config('warringColor')}">¥{{detailData && (detailData.discountAmount || detailData.discountAmount==0) ? toThousands(detailData.discountAmount, 2) : '--'}}</text>;折扣:<text class="sales-total-num" :style="{color: $config('warringColor')}">{{detailData && (detailData.discountRate || detailData.discountRate==0) ? detailData.discountRate+'%' : '--'}}</text>;折后总售价:<text class="sales-total-num" :style="{color: $config('warringColor')}">¥{{detailData && (detailData.discountedAmount || detailData.discountedAmount==0) ? toThousands(detailData.discountedAmount, 2) : '--'}}</text>;
+					</view>
+					<view>
+						急件总款数:<text class="sales-total-num" :style="{color: $config('warringColor')}">{{detailData && (detailData.oosCategory || detailData.oosCategory==0) ? toThousands(detailData.oosCategory) : '--'}}</text>;急件总数量:<text class="sales-total-num" :style="{color: $config('warringColor')}">{{detailData && (detailData.oosQty || detailData.oosQty==0) ? toThousands(detailData.oosQty) : '--'}}</text>;赠品总数量:<text class="sales-total-num" :style="{color: $config('warringColor')}">{{detailData && (detailData.giftQty || detailData.giftQty==0) ? toThousands(detailData.giftQty) : '--'}}</text>;
+					</view>
+					<view>
+						总成本:<text class="sales-total-num" :style="{color: $config('warringColor')}">¥{{detailData && (detailData.totalCost || detailData.totalCost==0) ? toThousands(detailData.totalCost, 2) : '--'}}</text>;总毛利:<text class="sales-total-num" :style="{color: $config('warringColor')}">¥{{detailData && (detailData.grossProfit || detailData.grossProfit==0) ? toThousands(detailData.grossProfit, 2) : '--'}}</text>;
+					</view>
+				</view>
+				<text class="sales-total-btn" @click="toggle=!toggle" :style="{color: $config('primaryColor')}">{{ toggle ? '收起' : '展开' }}</text>
+			</view>
+			</view>
+			<!-- 产品列表 -->
+			<view class="sales-list-box">
+				<scroll-view class="sales-list-con" :style="{height:scrollH+'upx'}" scroll-y @scrolltolower="onreachBottom">
+					<view class="sales-list-item border-b flex align_center justify_between" v-for="(item, index) in listData" :key="item.id">
+						<view class="font_13 flex_1 flex justify_between">
+							<view class="pimgs">
+								<u-image :src="item.productMainImage?item.productMainImage:`../../static/${theme}/def_img@2x.png`" width="128" height="128" border-radius="10"></u-image>
+								<view v-if="item.oosFlag == 1" class="sign" :style="{backgroundColor: $config('errorColor')}">急</view>
+								<view v-if="item.price < item.cost" class="sign" :style="{backgroundColor: $config('errorColor')}">亏</view>
+								<view v-if="item.price == 0" class="sign" :style="{backgroundColor: $config('errorColor')}">赠</view>
+							</view>
+							<view class="sales-item-main flex_1">
+								<view class="sales-item-name">{{item.productName || '--'}}</view>
+								<view class="sales-item-txt">{{item.productCode || '--'}}</view>
+								<view class="sales-item-txt color_6" style="font-size: 24upx;" v-if="item.warehouseEntity&&item.warehouseEntity.name || item.warehouseLocationEntity&&item.warehouseLocationEntity.name">{{item.warehouseEntity&&item.warehouseEntity.name}} > {{item.warehouseLocationEntity&&item.warehouseLocationEntity.name}}</view>
+								<view class="sales-item-txt flex align_center justify_between">
+									<view class="sales-item-priceInfo">
+										<view :style="{color: $config('errorColor'), display: 'inline-block'}">¥<text style="font-size: 30upx;">{{toThousands(item.price||0, 2)}}</text></view>
+										<text style="display: inline-block;margin: 0 10upx;">X</text> 
+										<text style="font-size: 30upx;">{{toThousands(item.qty||0)}}</text>
+										{{item.productUnit}}
+									</view>
+									<view class="sales-item-price">¥{{toThousands(item.totalAmount||0, 2)}}</view>
+								</view>
+								<view class="sales-item-price" v-if="detailData&&detailData.discountAmount">折后:¥{{toThousands(item.discountedAmount||0, 2)}}</view>
+							</view>
+						</view>
+						<!-- <view class="btn-box" style="padding-right: 0;">
+							<u-button v-if="pageData.type=='edit'" @click="handleDel(item)" size="mini" :hair-line="false" shape="circle" plain type="error" hover-class="none">删除</u-button>
+						</view> -->
+					</view>
+					<view v-if="listData && listData.length == 0">
+						<u-empty :text="noDataText" mode="list" :img-width="200" :margin-top="30"></u-empty>
+					</view>
+					<view style="padding: 20upx;">
+						<u-loadmore v-if="totalNum>listData.length || status=='loading'" :status="status" />
+					</view>
+				</scroll-view>
+			</view>
+		</view>
+		<!-- 操作按钮 -->
+		<!-- <view class="sales-btn-box" v-if="detailData&&detailData.billStatus!='FINISH'">
+			<view v-if="pageData.type=='edit'" class="flex align_center justify_between">
+				<u-button class="handle-btn" shape="circle" size="medium" hover-class="none" @click="handleDel()">整单删除</u-button>
+				<u-button class="handle-btn search-btn" shape="circle" @click="handleSubmit" size="medium" hover-class="none" :custom-style="customBtnStyle">提交</u-button>
+			</view>
+			<u-button v-if="pageData.type=='detail' && (detailData&&detailData.billStatus !== 'CANCEL' && detailData.billStatus !== 'FINISH' && detailData.billStatus != 'WAIT_OUT_WAREHOUSE')" class="edit-btn" shape="circle" @click="goPage" size="medium" hover-class="none" :custom-style="customBtnStyle">编辑</u-button>
+		</view> -->
+		<!-- 基础信息 -->
+		<orderInfoModal :openModal="infoModal" :infoData="detailData" @close="infoModal=false" />
+		<!-- 折扣 -->
+		<discountModal :openModal="discountModal" :infoData="detailData" :amount="detailData&&detailData.discountAmount" @confirm="discountConfirm" @close="discountModal=false" />
+		<!-- 删除产品/整单删除弹框 -->
+		<common-modal :openModal="commonModal" :content="modalText" @confirm="handleCommon" @cancel="handleCancel" @close="commonModal=false" />
+		<!-- 添加/编辑产品 -->
+		<productModal :openModal="openProductModal" :infoData="productInfo" @confirm="productConfirm" @close="openProductModal=false" />
+	</view>
+</template>
+
+<script>
+	import commonModal from '@/pages/common/commonModal.vue'
+	import OrderInfoModal from './orderInfoModal.vue'
+	import DiscountModal from './discountModal.vue'
+	import ProductModal from './productModal.vue'
+	import { toThousands } from '@/libs/tools'
+	import { stockByProductSn } from '@/api/stock'
+	import { salesDetailList, salesDetailDel, salesDel, salesDetailBySn, salesSubmit, salesDiscount, salesDetailUpdate } from '@/api/sales'
+	export default{
+		components: { OrderInfoModal, DiscountModal, commonModal, ProductModal },
+		data(){
+			return{
+				pageData: {
+					type: 'edit',
+					data: null
+				},
+				toggle: true,
+				toThousands,
+				customBtnStyle: {  //  自定义按钮样式
+					borderColor: this.$config('primaryColor'),
+					backgroundColor: this.$config('primaryColor'),
+					color: '#fff'
+				},
+				listData: [],
+				pageNo: 1,
+				pageSize: 6,
+				totalNum: 0,
+				status: 'loadmore',
+				noDataText: '暂无数据',
+				theme: '',
+				scrollH: 916,
+				infoModal: false,
+				discountModal: false,
+				commonModal: false,
+				modalText: '确认要删除吗?',
+				detailData: null,  // 销售单详情
+				openProductModal: false,  // 编辑产品信息弹框是否显示
+				productData: null,  // 当前操作的产品信息
+				productInfo: null,  // 编辑产品需要的参数
+				editInfo: null,  // 添加/编辑 提交的值
+				commonType: 1,  // 公共弹框类型  1删除产品,2删除销售单,3编辑产品时库存不足
+			}
+		},
+		onLoad(opt) {
+			this.theme = getApp().globalData.theme
+			if(opt){
+				this.pageData = {
+					type: opt.pageType || 'edit',
+					data: opt.data ? JSON.parse(opt.data) : null
+				}
+			}
+			this.init()
+			// 监听整改完成后刷新事件
+			uni.$on('refreshEditBL', this.init)
+		},
+		onUnload() {
+			uni.$off('refreshEditBL')
+		},
+		methods: {
+			init(){
+				this.getList(1)
+				this.getDetail()
+			},
+			// 列表
+			getList(pageNo){
+				const _this = this
+				if (pageNo) {
+					this.pageNo = pageNo
+				}
+				let params = {
+					pageNo: this.pageNo,
+					pageSize: this.pageSize,
+					salesBillSn: this.pageData.data && this.pageData.data.salesBillSn
+				}
+				this.status = "loading"
+				salesDetailList(params).then(res => {
+					if (res.status == 200) {
+						if(res.data && res.data.list){
+							res.data.list.map(item => {
+								item.productName = item.productEntity && item.productEntity.name || item.dealerProductEntity && item.dealerProductEntity.name
+								item.productCode = item.productEntity && item.productEntity.code || item.dealerProductEntity && item.dealerProductEntity.code
+								item.productUnit = item.productEntity && item.productEntity.unit || item.dealerProductEntity && item.dealerProductEntity.unit
+							})
+							if(this.pageNo>1){
+								this.listData = this.listData.concat(res.data && res.data.list || [])
+							}else{
+								this.listData = res.data.list || []
+							}
+						}else{
+							this.listData = []
+						}
+						this.totalNum = res.data && res.data.count || 0
+					} else {
+						this.listData = []
+						this.totalNum = 0
+						this.noDataText = res.message
+					}
+					this.status = "loadmore"
+				})
+			},
+			// scroll-view到底部加载更多
+			onreachBottom() {
+				if(this.listData.length < this.totalNum){
+					this.pageNo += 1
+					this.getList()
+				}
+			},
+			// 折扣金额
+			discountConfirm(amount){
+				let params = {
+					discountAmount: amount,
+					salesBillSn: this.detailData.salesBillSn,
+					id: this.detailData.id
+				}
+				salesDiscount(params).then(res => {
+					if(res.status == 200){
+						this.init()
+						this.discountModal = false
+					}
+				})
+			},
+			// 提交
+			handleSubmit(){
+				salesSubmit({ id: this.detailData.id }).then(res => {
+					if(res.status == 200){
+						this.toashMsg(res.message)
+						uni.$emit('refreshSalesBL')
+						uni.navigateBack()
+					}
+				})
+			},
+			// 编辑
+			handleEdit(data){
+				this.productInfo = {
+					productName: data.productName,
+					productMainImage: data.productMainImage,
+					productCode: data.productCode,
+					productOrigCode: data.productOrigCode,
+					warehouseName: data.warehouseEntity && data.warehouseEntity.name,
+					warehouseLocationName: data.warehouseLocationEntity && data.warehouseLocationEntity.name,
+					price: data.price,
+					qty: data.qty
+				}
+				this.openProductModal = true
+				this.productData = data
+			},
+			// 确认产品信息
+			productConfirm(data){
+				this.editInfo = data
+				this.validateStock()  //验证  库存是否不足
+			},
+			// 库存不足
+			validateStock(){
+				//  校验库存
+				stockByProductSn({ productSn: this.productData.productSn }).then(res => {
+					if (res.status == 200) {
+						if (res.data && (!res.data.currentStockQty || this.editInfo.qty <= res.data.currentStockQty)) {
+							this.editProduct()
+						} else {  // 库存不足
+							this.commonType = 3
+							this.modalText = '库存不足,将产生急件,确认修改吗?'
+							this.commonModal = true
+						}
+					}
+				})
+			},
+			// 编辑产品
+			editProduct(){
+				let params = {
+					id: this.productData.id,
+					qty: this.editInfo.qty,
+					price: this.editInfo.price,
+					productSn: this.productData.productSn,
+					salesBillSn: this.detailData.salesBillSn,
+				}
+				salesDetailUpdate(params).then(res => {
+					if(res.status == 200){
+						this.toashMsg(res.message)
+						this.init()
+						this.commonModal = false
+						this.openProductModal = false
+					}
+				})
+			},
+			// 删除
+			handleDel(item){
+				if(item){  // 删除产品
+					this.commonType = 1
+					this.productData = item
+					this.modalText = '确认要删除吗?'
+					this.commonModal = true
+				}else{  // 整单删除
+					this.commonType = 2
+					this.productData = null
+					this.modalText = '确认删除该销售单吗?'
+					this.commonModal = true
+				}
+			},
+			// 公共弹框  确定
+			handleCommon(){
+				if(this.commonType == 1){  // 删除产品
+					this.delFun()
+				}else if(this.commonType == 2){  // 整单删除
+					this.delFun()
+				}else if(this.commonType == 3){  // 编辑产品时库存不足
+					this.editProduct()
+				}
+			},
+			// 公共弹框  取消
+			handleCancel(){
+				this.openProductModal = false
+			},
+			// 删除
+			delFun(){
+				let url = salesDetailDel
+				let params = {}
+				console.log(this.commonType)
+				if(this.commonType == 1){  // 删除产品
+					url = salesDetailDel
+					params = { id: this.productData.id }
+				}else if(this.commonType == 2){  // 整单删除
+					console.log('整单删除', this.detailData)
+					url = salesDel
+					params = { id: this.detailData && this.detailData.id }
+				}
+				url(params).then(res => {
+					if (res.status == 200) {
+						if(this.productData){  // 删除产品
+							this.toashMsg(res.message)
+							this.init()
+						}else{  // 整单删除
+							this.toashMsg(res.message)
+							uni.$emit('refreshSalesBL')
+							uni.navigateBack()
+						}
+						this.commonModal = false
+					} else {
+						this.commonModal = false
+					}
+				})
+			},
+			// 选择产品
+			handleProduct(){
+				uni.navigateTo({ url: '/pages/sales/chooseProduct?data='+JSON.stringify(this.detailData) })
+			},
+			// 编辑
+			goPage(){
+				uni.redirectTo({ url: '/pages/sales/edit?pageType=edit&data='+JSON.stringify(this.detailData) })
+			},
+			// 销售单详情
+			getDetail(){
+				salesDetailBySn({ salesBillSn: this.pageData.data.salesBillSn }).then(res => {
+					console.log(res.data)
+					if(res.status == 200){
+						this.detailData = res.data
+					}else{
+						this.detailData = null
+					}
+					this.toggle = false
+				})
+			},
+			changeScrollH(){
+				const _this = this
+				uni.getSystemInfo({
+					success: function (res) {
+						const winH = res.windowHeight * 2
+						let totalH = _this.$refs.salesTotal && _this.$refs.salesTotal.$el && _this.$refs.salesTotal.$el.offsetHeight || 0
+						if(_this.toggle){
+							_this.scrollH = winH - 656 - totalH
+						}else{
+							_this.scrollH = winH - 522 - totalH
+						}
+						// if(_this.detailData&&_this.detailData.billStatus=='FINISH'){
+							_this.scrollH = _this.scrollH + 100
+						// }
+					}
+				})
+			}
+		},
+		watch: {
+			toggle (newValue, oldValue) {
+				this.changeScrollH()
+			}
+		}
+	}
+</script>
+
+<style lang="scss">
+	.sales-edit-wrap{
+		width: 100%;
+		.color_6{
+			color: #666;
+		}
+		.font_13{
+			font-size: 26upx;
+		}
+		.border-b{
+			border-bottom: 1px solid #e4e7ed;
+		}
+		.sales-info-con{
+			background-color: #fff;
+			margin-bottom: 6upx;
+			padding: 0 20upx;
+			>view{
+				padding: 14upx 0;
+				border-bottom: 1px solid #e4e7ed;
+			}
+			>view:last-child{
+				border-bottom: none;
+			}
+			.info-item-box{
+				.info-item-tit{
+					display: inline-block;
+					width: 20%;
+				}
+			}
+		}
+		.sales-product-con{
+			background-color: #fff;
+			padding: 0 20upx;
+			flex-grow: 1;
+			.sales-product-header{
+				padding: 14upx 0;
+				height: 80upx;
+				.sales-product-operation{
+					button{
+						margin: 0 0 0 10upx;
+					}
+				}
+			}
+			.sales-total-box{
+				align-items: flex-end;
+				padding: 16upx 0;
+				.sales-total-con{
+					color: #666;
+					overflow: hidden;
+					view{
+						padding: 4upx 0;
+						.sales-total-num{
+							font-size: 24upx;
+							color: rgb(48, 49, 51);
+						}
+					}
+				}
+				.sales-total-btn{
+					display: inline-block;
+					margin-bottom: 6upx;
+				}
+			}
+			.sales-list-box{
+				flex-grow: 1;
+				.sales-list-con{
+					.sales-list-item{
+						padding: 20upx 0;
+						.pimgs{
+							margin-right: 20upx;
+							position: relative;
+							.sign{
+								position: absolute;
+								right: -2upx;
+								top: -2upx;
+								color: #fff;
+								border-radius: 50%;
+								width: 40upx;
+								height: 40upx;
+								text-align: center;
+							}
+						}
+						.sales-item-main{
+							.sales-item-name{
+								font-size: 28upx;
+								color: rgb(48, 49, 51);
+								font-weight: bold;
+								overflow: hidden;
+								text-overflow: ellipsis;
+								display: -webkit-box;
+								-webkit-box-orient: vertical;
+								-webkit-line-clamp: 1;
+							}
+							.sales-item-txt{
+								margin: 8upx 0;
+							}
+							.sales-item-price{
+								text-align: right;
+							}
+						}
+						.btn-box{
+							padding: 30upx 30upx;
+						}
+					}
+					.sales-list-item:last-child{
+						border: none;
+					}
+				}
+			}
+		}
+		.sales-btn-box{
+			background-color: #fff;
+			padding: 12upx 50upx;
+			.handle-btn{
+				width: 47%;
+			}
+			.edit-btn{
+				width: 100%;
+			}
+		}
+	}
+</style>

+ 237 - 0
pages/sales/index.vue

@@ -0,0 +1,237 @@
+<template>
+	<view class="sales-warp">
+		<view id="tjCons">
+			<!--销售数据统计 -->
+			<view class="content-data">
+				<view class="date-type">
+					<text v-for="(item, index) in tabNav" :key="index" :class="[index == navInd ? 'active_day' : '']" @click="seleteTime(index)">{{item.name}}</text>
+				</view>
+				<view class="total">
+					<view class="item-box">
+						<u-count-to v-if="navInd==0" :end-val="bizData&&bizData.sales&&(bizData.sales.dayTotalQty || bizData.sales.dayTotalQty==0) ? bizData.sales.dayTotalQty : 0" separator=","></u-count-to>
+						<u-count-to v-if="navInd==1" :end-val="bizData&&bizData.sales&&(bizData.sales.weekSalesQty || bizData.sales.weekSalesQty==0) ? bizData.sales.weekSalesQty : 0" separator=","></u-count-to>
+						<u-count-to v-if="navInd==2" :end-val="bizData&&bizData.sales&&(bizData.sales.monthSalesQty || bizData.sales.monthSalesQty==0) ? bizData.sales.monthSalesQty : 0" separator=","></u-count-to>
+						<view>销售总单量(个)</view>
+					</view>
+					<view class="item-box">
+						<u-count-to v-if="navInd==0" :end-val="bizData&&bizData.sales&&(bizData.sales.dayTotalAmount || bizData.sales.dayTotalAmount==0) ? bizData.sales.dayTotalAmount : 0" separator="," :decimals="2"></u-count-to>
+						<u-count-to v-if="navInd==1" :end-val="bizData&&bizData.sales&&(bizData.sales.weekSalesAmount || bizData.sales.weekSalesAmount==0) ? bizData.sales.weekSalesAmount : 0" separator="," :decimals="2"></u-count-to>
+						<u-count-to v-if="navInd==2" :end-val="bizData&&bizData.sales&&(bizData.sales.monthSalesAmount || bizData.sales.monthSalesAmount==0) ? bizData.sales.monthSalesAmount : 0" separator="," :decimals="2"></u-count-to>
+						<view>销售总金额(¥)</view>
+					</view>
+				</view>
+			</view>
+			<!-- 产品报价及新增销售单 -->
+			<view class="nav-cont flex align_center justify_between">
+				<view class="nav-item" @click="toPage('/pages/sales/productPricing')">
+					<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('/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> -->
+				<view class="nav-item" @click="toPage('/pages/webviews/openview?title=产品查询&url=https://jgqp.51cjml.com/h5/#!/')">
+					<u-image class="nav-pic" :src="`../../static/${theme}/navIcon/pfind.png`" width="64" height="64"></u-image>
+					<text class="nav-txt">产品查询</text>
+				</view>
+			</view>
+			<!-- 销售单 -->
+			<view class="sales-list">
+				<view class="title">
+					<text class="title-name" @click="$refs.salesList.refash()">
+						销售单 
+						<u-icon name="reload" color="#2979ff" size="28"></u-icon>
+					</text>
+					<view class="title-all" @click="toPage('/pages/sales/list')">查看全部<u-icon name="arrow-right" color="rgb(144, 147, 153)" size="28"></u-icon></view>
+				</view>
+			</view>
+		</view>
+		<!-- 销售单列表 -->
+		<listComponent ref="salesList" :height="listHeight" />
+	</view>
+</template>
+
+<script>
+	import ListComponent from './listComponent.vue'
+	import { toThousands } from '@/libs/tools'
+	import { bizData } from '@/api/sales'
+	export default{
+		components: { ListComponent },
+		data(){
+			return{
+				tabNav: [
+					{ name: '今日', ind: 0 },
+					{ name: '本周', ind: 1 },
+					{ name: '本月', ind: 2 }
+				],
+				navInd: 0,
+				bizData: null, // 销售数据统计
+				theme: '',
+				listHeight: 400
+			}
+		},
+		onReady() {
+			const query = uni.createSelectorQuery().in(this);
+			query.select('#tjCons').boundingClientRect(data => {
+			  this.listHeight = Math.floor(data.height + 18)
+			}).exec();
+		},
+		onLoad() {
+			const _this = this
+			this.$nextTick(function(){
+				// 监听整改完成后刷新事件
+				uni.$on('refreshSalesHomeBL', function(data){
+					_this.$refs.salesList.refash()
+				})
+			})
+			
+			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)
+			  }
+			})
+		},
+		onUnload() {
+			uni.$off('refreshSalesHomeBL')
+		},
+		onShow() {
+			this.navInd = 0
+			this.getBizData()
+		},
+		methods:{
+			seleteTime(val){
+				this.navInd = val
+			},
+			toPage(url){
+				uni.navigateTo({ url: url })
+			},
+			getBizData () {
+				bizData({}).then(res => {
+					if (res.status == 200) {
+						this.bizData = res.data || null
+					} else {
+						this.bizData = null
+					}
+					uni.stopPullDownRefresh();
+				})
+			}
+		}
+	}
+</script>
+
+<style lang="scss">
+	.sales-warp{
+		width: 100%;
+		padding: 20rpx 20upx;
+		.color_6{
+			color: #666;
+		}
+		.font_13{
+			font-size: 26upx;
+		}
+		.content-data{
+			background-color: #fff;
+			padding: 20upx 20upx;
+			border-radius: 20upx;
+			box-shadow: 3upx 2upx 6upx #eee;
+			margin-bottom: 20upx;
+			.date-type{
+				margin: 0 120upx 20upx;
+				border-radius: 50upx;
+				border: 1upx solid #eee;
+				text{
+					display: inline-block;
+					padding: 10upx 0;
+					width: 33%;
+					text-align: center;
+				}
+				text:first-child{
+					border-top-left-radius: 50upx;
+					border-bottom-left-radius: 50upx;
+				}
+				text:last-child{
+					border-top-right-radius: 50upx;
+					border-bottom-right-radius: 50upx;
+				}
+				text:not(:last-child){
+					border-right: 1upx solid #eee;
+				}
+				.active_day {
+				  background: rgb(0, 122, 255);
+				  color: #fff;
+				}
+			}
+			.total{
+				display: flex;
+				.item-box{
+					text-align: center;
+					width: 50%;
+					color:#999;
+				}
+				.item-box:first-child{
+					border-right: 1px solid #e4e7ed;
+				}
+			}
+		}
+		.nav-cont{
+			.nav-item{
+				width: 49%;
+				border-radius: 25upx;
+				background-color: #ffffff;
+				padding: 14upx 0;
+				box-shadow: 3upx 2upx 6upx #eee;
+				margin-bottom: 20upx;
+				text-align: center;
+				.nav-pic{
+					margin: 0 auto;
+				}
+				.nav-txt{
+					font-size: 28upx;
+					color: #666666;
+				}
+			}
+		}
+		.sales-list{
+			.title{
+				margin-bottom: 14upx;
+				display: flex;
+				align-items: center;
+				justify-content: space-between;
+				.title-name{
+					font-size: 32upx;
+					color: #333;
+					font-weight: 1000;
+				}
+				.title-all{
+					color: rgb(144, 147, 153);
+				}
+			}
+		}
+	}
+</style>

+ 145 - 0
pages/sales/list.vue

@@ -0,0 +1,145 @@
+<template>
+	<view class="sales-list-wrap">
+		<u-dropdown class="search-top-box" id="tjCons">
+			<u-dropdown-item v-model="searchForm.billStatus" @change="handleChange('bill')" title="业务状态" :options="billStatusOpt"></u-dropdown-item>
+			<u-dropdown-item v-model="searchForm.financialStatus" @change="handleChange('financial')" title="财务状态" :options="financialStatusOpt"></u-dropdown-item>
+		</u-dropdown>
+		<!-- 销售单列表 -->
+		<view class="list-box">
+			<listComponent ref="salesList" :height="listHeight" :params="searchParams" />
+		</view>
+		<!-- 查询右侧弹框 -->
+		<salesSearch :openModal="openModal" :defaultParams="searchForm" @refresh="refresh" @close="openModal=false" />
+	</view>
+</template>
+
+<script>
+	import ListComponent from './listComponent.vue'
+	import SalesSearch from './salesSearch.vue'
+	import { getLookUpItem } from '@/api/data'
+	import { salesList } from '@/api/sales'
+	export default{
+		components: { ListComponent, SalesSearch },
+		data(){
+			return{
+				listData: [],
+				pageNo: 1,
+				pageSize: 6,
+				totalNum: 0,
+				noDataText: '暂无数据',
+				billStatusOpt: [],
+				financialStatusOpt: [],
+				searchForm: {
+					billStatus: null,
+					financialStatus: null
+				},
+				searchParams: {},
+				listHeight: 200,
+				openModal: false
+			}
+		},
+		onNavigationBarButtonTap(e){  // 标题栏 按钮操作
+			this.openModal = true
+		},
+		onReady() {
+			const query = uni.createSelectorQuery().in(this);
+			query.select('#tjCons').boundingClientRect(data => {
+			  this.listHeight = Math.floor(data.height + 10)
+			}).exec();
+		},
+		onLoad() {
+			const _this = this
+			this.getLookUpItem('SALES_BILL_STATUS')
+			this.getLookUpItem('FINANCIAL_RECEIVE_STATUS')
+			this.$nextTick(function(){
+				// 监听整改完成后刷新事件
+				uni.$on('refreshSalesBL', function(data){
+					_this.$refs.salesList.getList(1)
+				})
+			})
+		},
+		onUnload() {
+			uni.$off('refreshSalesBL')
+		},
+		methods: {
+			// 获取查询参数 刷新列表
+			refresh(params){
+				const _this = this
+				const data = {}
+				if(this.searchForm.billStatus){
+					data.billStatus = this.searchForm.billStatus
+				}
+				if(this.searchForm.financialStatus){
+					data.financialStatus = this.searchForm.financialStatus
+				}
+				if(params.beginDate){
+					data.beginDate = params.beginDate
+				}
+				if(params.endDate){
+					data.endDate = params.endDate
+				}
+				if(params.buyerName){
+					data.buyerName = params.buyerName
+				}
+				if(params.salesBillNo){
+					data.salesBillNo = params.salesBillNo
+				}
+				if(params.purchaseBillNo){
+					data.purchaseBillNo = params.purchaseBillNo
+				}
+				if(params.settleStyleSn){
+					data.settleStyleSn = params.settleStyleSn
+				}
+				this.searchParams = data
+				console.log(this.searchParams,'this.searchParams')
+				this.$nextTick(function(){
+					_this.$refs.salesList.refash()
+				})
+			},
+			// 状态  change
+			handleChange(type){
+				if(type == 'bill'){
+					this.searchParams.billStatus = this.searchForm.billStatus
+				}else if(type == 'financial'){
+					this.searchParams.financialStatus = this.searchForm.financialStatus
+				}
+				this.$refs.salesList.refash()
+			},
+			// 配送方式
+			getLookUpItem (type) {
+				getLookUpItem({ lookupCode: type, pageNo: 1, pageSize: 1000 }).then(res => {
+					if (res.status == 200 && res.data && res.data.list) {
+						res.data.list.map(item => {
+							item.label = item.dispName
+							item.value = item.code
+						})
+						res.data.list.splice(0, 0, { label: '全部', value: null })
+						if(type == 'SALES_BILL_STATUS'){
+							this.billStatusOpt = res.data.list
+						}else if(type == 'FINANCIAL_RECEIVE_STATUS'){
+							this.financialStatusOpt = res.data.list
+						}
+					} else {
+						if(type == 'SALES_BILL_STATUS'){
+							this.billStatusOpt = []
+						}else if(type == 'FINANCIAL_RECEIVE_STATUS'){
+							this.financialStatusOpt = []
+						}
+					}
+				})
+			}
+		}
+	}
+</script>
+
+<style lang="scss">
+	.sales-list-wrap{
+		width: 100%;
+		.search-top-box{
+			background-color: #fff;
+		}
+		.list-box{
+			padding: 0;
+		}
+	}
+</style>

+ 277 - 0
pages/sales/listComponent.vue

@@ -0,0 +1,277 @@
+<template>
+	<view class="sales-list-component">
+		<scroll-view class="sales-list-con" :style="{height: scrollH+'upx'}" scroll-y @scrolltolower="onreachBottom">
+			<view class="sales-list-main">
+				<view class="sales-list-item" v-for="(item, index) in listData" :key="item.id" @click="getDetail(item)">
+					<view class="list-item-tit flex align_center justify_between">
+						<!-- <u-section :title="item.buyerName" :sub-title="item.billStatusDictValue" :line-color="$config('primaryColor')"></u-section> -->
+						<view class="u-line" :style="{background: $config('primaryColor')}"></view>
+						<view class="buyer">{{item.buyerName}}</view>
+						<view>{{item.billStatusDictValue}} <u-icon name="arrow-right" color="#969da3" size="28"></u-icon></view>
+					</view>
+					<view class="list-item-con">
+						<view class="list-item-line flex align_center justify_between">
+							<view>
+								<view style="display: inline-block;margin-right: 6upx;">{{item.salesBillNo}}</view>
+								<u-tag v-if="item.oosFlag==1" text="急件" :bg-color="$config('errorColor')" mode="dark" shape="circle" size="mini" style="margin-right: 6upx;vertical-align: text-top;" />
+								<u-tag v-if="item.salesBillSourceDictValue" :text="item.salesBillSourceDictValue" :bg-color="$config('primaryColor')" mode="dark" shape="circle" size="mini" style="vertical-align: text-top;" />
+							</view>
+							<view class="color_6 font_13">{{item.createDate || '--'}}</view>
+						</view>
+						<view class="list-item-line flex align_center justify_between">
+							<view>总款数:<text>{{toThousands(item.totalCategory||0)}}</text></view>
+							<view>总数量:<text>{{toThousands(item.totalQty||0)}}</text></view>
+							<view>总售价:<text>¥{{toThousands(item.totalAmount||0, 2)}}</text></view>
+						</view>
+						<view class="list-item-line flex align_center justify_between">
+							<view class="flex_1">财务状态:<text>{{item.financialStatusDictValue||'--'}}</text></view>
+							<view class="flex_1">收款方式:<text>{{item.settleStyleEntity&&item.settleStyleEntity.name||'--'}}</text></view>
+						</view>
+					</view>
+					<!-- <view class="button-box">
+						<u-button @click="handleFun('audit', item)" size="mini" :hair-line="false" shape="circle" plain type="primary" hover-class="none" v-if="item.billStatus == 'WAIT_AUDIT'">审核</u-button>
+						<u-button @click="handleFun('out', item)" size="mini" :hair-line="false" shape="circle" plain type="primary" hover-class="none" v-if="item.billStatus == 'WAIT_OUT_WAREHOUSE'">出库</u-button>
+						<u-button @click="handleEdit(item)" size="mini" :hair-line="false" shape="circle" plain type="primary" hover-class="none" v-if="(item.salesBillSource == 'SATELLITE' || item.salesBillSource == 'SALES' || item.salesBillSource == 'TEMPORARY_DISPATCHING') && (item.billStatus == 'WAIT_AUDIT' || item.billStatus == 'WAIT_SUBMIT' || item.billStatus == 'AUDIT_REJECT')">编辑</u-button>
+						<u-button @click="handleFun('del', item)" size="mini" :hair-line="false" shape="circle" plain type="error" hover-class="none" v-if="((item.salesBillSource == 'SATELLITE' || item.salesBillSource == 'SALES' || item.salesBillSource == 'TEMPORARY_DISPATCHING') && item.billStatus != 'FINISH')">删除</u-button>
+						<u-button @click="handleEdit(item)" size="mini" :hair-line="false" shape="circle" plain type="primary" hover-class="none" v-if="item.salesBillSource == 'PURCHASE' && (item.billStatus == 'WAIT_AUDIT' || item.billStatus == 'SUPERIOR_CHANGE')">改单</u-button>
+						<u-button @click="handleFun('cancel', item)" size="mini" :hair-line="false" shape="circle" plain type="primary" hover-class="none" v-if="item.salesBillSource == 'PURCHASE' && (item.billStatus == 'WAIT_AUDIT' || item.billStatus == 'SUPERIOR_CHANGE')">取消</u-button>
+					</view> -->
+				</view>
+				<view v-if="listData && listData.length == 0 && status!='loading'">
+					<u-empty :text="noDataText" mode="list" :img-width="200" :margin-top="30"></u-empty>
+				</view>
+				<view style="padding-bottom: 20upx;">
+					<u-loadmore v-if="totalNum>listData.length || status=='loading'" :status="status" />
+				</view>
+			</view>
+		</scroll-view>
+		<!-- 审核弹框 -->
+		<common-modal :openModal="auditModal" content="请点击下方按钮确认操作" confirmText="审核通过" cancelText="审核不通过" :isClose="true" @confirm="handleAudit('WAIT_OUT_WAREHOUSE')" @cancel="handleAudit('AUDIT_REJECT')" @close="auditModal=false" />
+		<!-- 出库弹框 -->
+		<common-modal :openModal="outModal" content="确认要出库吗?" @confirm="handleOut" @close="outModal=false" />
+		<!-- 删除/取消弹框 -->
+		<common-modal :openModal="delModal" :content="delText" @confirm="handleDel" @close="delModal=false" />
+	</view>
+</template>
+
+<script>
+	import commonModal from '@/pages/common/commonModal.vue'
+	import { toThousands } from '@/libs/tools'
+	import copyText from '@/pages/common/copyText.vue'
+	import { salesList, salesWriteAudit, salesWriteStockOut, salesDel } from '@/api/sales'
+	export default{
+		components: { commonModal, copyText },
+		props: {
+			height: {  // 非滚动区域高度   upx
+				type: [String ,Number],
+				default: 300
+			},
+			params: {  // 列表查询条件
+				type: Object,
+				default: () => {
+					return {}
+				}
+			}
+		},
+		data(){
+			return{
+				listData: [],
+				pageNo: 1,
+				pageSize: 10,
+				totalNum: 0,
+				status: 'loadmore',
+				noDataText: '暂无数据',
+				toThousands,
+				auditModal: false,  // 审核弹框
+				dataInfo: null,
+				outModal: false,  // 出库弹框
+				delModal: false,  // 删除/取消弹框
+				delText: '确认要删除吗?',
+				scrollH: 300,
+			}
+		},
+		watch:{
+			height(a,b){
+				const sys = uni.getSystemInfoSync()
+				if(sys.platform == 'android'){
+					this.scrollH = (sys.windowHeight - sys.statusBarHeight - a) * 2
+				}else{
+					if(sys.safeArea.top){
+						this.scrollH = (sys.windowHeight - a) * 2 + sys.statusBarHeight - 34
+					}else{
+						this.scrollH = (sys.windowHeight - a) * 2 - 14
+					}
+				}
+			},
+		},
+		mounted() {
+			this.getList()
+		},
+		methods:{
+			refash(){
+				this.listData = []
+				this.totalNum = 0
+				this.getList(1)
+			},
+			// 列表
+			getList(pageNo){
+				const _this = this
+				if (pageNo) {
+					this.pageNo = pageNo
+				}
+				let params = {
+					pageNo: this.pageNo,
+					pageSize: this.pageSize
+				}
+				this.status = "loading"
+				console.log(Object.assign(params, this.params))
+				salesList(Object.assign(params, this.params)).then(res => {
+					if (res.status == 200) {
+						if(this.pageNo>1){
+							this.listData = this.listData.concat(res.data.list || [])
+						}else{
+							this.listData = res.data.list || []
+						}
+						this.totalNum = res.data.count || 0
+					} else {
+						this.listData = []
+						this.totalNum = 0
+						this.noDataText = res.message
+					}
+					this.status = "loadmore"
+				})
+			},
+			// scroll-view到底部加载更多
+			onreachBottom() {
+				if(this.listData.length < this.totalNum){
+					this.pageNo += 1
+					this.getList()
+				}
+			},
+			// 查看详情
+			getDetail(data){
+				uni.navigateTo({ url: '/pages/sales/edit?pageType=detail&data='+JSON.stringify(data) })
+			},
+			// 编辑
+			handleEdit(data){
+				uni.navigateTo({ url: '/pages/sales/edit?pageType=edit&data='+JSON.stringify(data) })
+			},
+			// 操作
+			handleFun(type, data){
+				this.dataInfo = data
+				if(type == 'audit'){  // 审核
+					this.auditModal = true
+				}else if(type == 'out'){  // 出库
+					this.outModal = true
+				}else if(type == 'del'){  // 删除
+					this.delText = '确认要删除吗?'
+					this.delModal = true
+				}else if(type == 'cancel'){  // 取消
+					this.delText = '确认要取消吗?'
+					this.delModal = true
+				}
+			},
+			// 审核通过或不通过
+			handleAudit(billStatus){
+				salesWriteAudit({
+					id: this.dataInfo.id,
+					billStatus: billStatus
+				}).then(res => {
+					if (res.status == 200) {
+						this.toashMsg(res.message)
+						this.getList(1)
+						this.auditModal = false
+					} else {
+						this.auditModal = false
+					}
+				})
+			},
+			// 出库
+			handleOut(){
+				salesWriteStockOut({ salesBillSn: this.dataInfo.salesBillSn }).then(res => {
+					if (res.status == 200) {
+						this.toashMsg(res.message)
+						this.getList(1)
+						this.outModal = false
+					} else {
+						this.outModal = false
+					}
+				})
+			},
+			// 删除
+			handleDel(){
+				salesDel({ id: this.dataInfo.id }).then(res => {
+					if (res.status == 200) {
+						this.toashMsg(res.message)
+						this.getList(1)
+						this.delModal = false
+					} else {
+						this.delModal = false
+					}
+				})
+			}
+		}
+	}
+</script>
+
+<style lang="less">
+	.sales-list-component{
+		.color_6{
+			color: #666;
+		}
+		.font_13{
+			font-size: 26upx;
+		}
+		.sales-list-con{
+			.sales-list-main{
+				.sales-list-item{
+					background: #ffffff;
+					padding: 20upx;
+					margin: 25upx;
+					border-radius: 25upx;
+					box-shadow: 1px 1px 3px #EEEEEE;
+					.list-item-tit{
+						padding-bottom: 18upx;
+						padding-top: 10upx;
+						border-bottom: 1px solid #e4e7ed;
+						.u-line{
+							display: inline-block;
+							width: 6upx;
+							height: 30upx;
+							vertical-align: bottom;
+							margin: 0 10upx;
+							border-radius: 5upx;
+						}
+						.buyer{
+							flex-grow: 1;
+							font-size: 30upx;
+							font-weight: bold;
+						}
+						>view{
+							&:last-child{
+								width: 150upx;
+								text-align: right;
+								color: #666;
+							}
+						}
+					}
+					.list-item-con{
+						padding: 10upx 0;
+						.list-item-line{
+							padding: 8upx 0;
+						}
+						text{
+							color: #666;
+						}
+					}
+					.button-box{
+						text-align: right;
+						button{
+							margin: 0 10upx;
+						}
+					}
+				}
+			}
+		}
+	}
+</style>

+ 121 - 0
pages/sales/orderInfoModal.vue

@@ -0,0 +1,121 @@
+<template>
+	<u-mask class="orderInfoModal" :show="isShow" :mask-click-able="false">
+		<view class="order-info-con">
+			<view class="order-info-main">
+				<view>
+					<text class="info-item-tit">销售单号:</text>
+					<text class="info-item-txt">{{infoData && infoData.salesBillNo || '--'}}</text>
+				</view>
+				<view>
+					<text class="info-item-tit">客户名称:</text>
+					<text class="info-item-txt">{{infoData && infoData.buyerName || '--'}}</text>
+				</view>
+				<view>
+					<text class="info-item-tit">客户地址:</text>
+					<text class="info-item-txt" v-if="infoData && (infoData.shippingAddressProvinceName || infoData.shippingAddressCityName || infoData.shippingAddressCountyName || infoData.shippingAddress)">
+						{{infoData.shippingAddressProvinceName || ''}}{{infoData.shippingAddressCityName || ''}}{{infoData.shippingAddressCountyName || ''}}{{infoData.shippingAddress || ''}}
+					</text>
+					<text class="info-item-txt" v-else>--</text>
+				</view>
+				<view>
+					<text class="info-item-tit">联系电话:</text>
+					<text class="info-item-txt">{{infoData && infoData.consigneeTel || '--'}}</text>
+				</view>
+				<view>
+					<text class="info-item-tit">收款方式:</text>
+					<text class="info-item-txt">{{infoData && infoData.settleStyleEntity && infoData.settleStyleEntity.name || '--'}}</text>
+				</view>
+				<view>
+					<text class="info-item-tit">制单人:</text>
+					<text class="info-item-txt">{{infoData && infoData.operatorName || '--'}}</text>
+				</view>
+				<view>
+					<text class="info-item-tit">业务员:</text>
+					<text class="info-item-txt">{{infoData && infoData.salesManName || '--'}}</text>
+				</view>
+				<view>
+					<text class="info-item-tit">来源:</text>
+					<text class="info-item-txt">{{infoData && infoData.salesBillSourceDictValue || '--'}}</text>
+				</view>
+				<view>
+					<text class="info-item-tit">业务状态:</text>
+					<text class="info-item-txt">{{infoData && infoData.billStatusDictValue || '--'}}</text>
+				</view>
+				<view>
+					<text class="info-item-tit">财务状态:</text>
+					<text class="info-item-txt">{{infoData && infoData.financialStatusDictValue || '--'}}</text>
+				</view>
+				<view>
+					<text class="info-item-tit">备注:</text>
+					<text class="info-item-txt">{{infoData && infoData.remarks || '--'}}</text>
+				</view>
+			</view>
+			<view class="order-info-footer">
+				<view class="button-cancel" @click="isShow=false">关闭</view>
+			</view>
+		</view>
+	</u-mask>
+</template>
+
+<script>
+	export default {
+		props: {
+			openModal: { //  弹框显示状态
+				type: Boolean,
+				default: false
+			},
+			infoData: {
+				tyoe: Object,
+				default: ()=>{
+					return null
+				}
+			}
+		},
+		data() {
+			return {
+				isShow: this.openModal, //  是否打开弹框
+			}
+		},
+		methods: {},
+		watch: {
+			//  父页面传过来的弹框状态
+			openModal (newValue, oldValue) {
+				this.isShow = newValue
+			},
+			//  重定义的弹框状态
+			isShow (newValue, oldValue) {
+			  if (!newValue) {
+			    this.$emit('close')
+			  }
+			}
+		}
+	}
+</script>
+
+<style lang="scss" scoped>
+	.orderInfoModal{
+		width: 100%;
+		height: 100%;
+		.order-info-con{
+			width: 78%;
+			margin: 30% auto 0;
+			background-color: #fff;
+			border-radius: 24upx;
+			.order-info-main{
+				padding: 20upx 20upx;
+				>view{
+					padding: 10upx 0;
+					border-bottom: 1upx solid #e4e7ed;
+					.info-item-tit{
+						color: #666;
+						display: inline-block;
+					}
+				}
+			}
+			.order-info-footer{
+				text-align: center;
+				padding-bottom: 20upx;
+			}
+		}
+	}
+</style>

+ 187 - 0
pages/sales/productModal.vue

@@ -0,0 +1,187 @@
+<template>
+	<u-mask class="productModal" :show="isShow" :mask-click-able="false">
+		<view class="product-con">
+			<view class="product-main">
+				<view class="list-item-tit">
+					<view class="item-tit ellipsis-one" :style="{borderColor: $config('primaryColor')}">{{infoData && infoData.productName}}</view>
+				</view>
+				<view class="list-item-con flex align_center justify_between">
+					<view class="pimgs">
+						<u-image :src="infoData && infoData.productMainImage?infoData.productMainImage:`../../static/${theme}/def_img@2x.png`" width="128" height="128" border-radius="10"></u-image>
+					</view>
+					<view class="flex_1">
+						<view>产品编码:{{infoData && infoData.productCode || '--'}}</view>
+						<view class="padding_3">原厂编码:{{infoData && infoData.productOrigCode || '--'}}</view>
+						<view v-if="infoData && (infoData.warehouseName || infoData.warehouseLocationName)">仓库仓位:{{infoData && infoData.warehouseName}} > {{infoData && infoData.warehouseLocationName}}</view>
+					</view>
+				</view>
+				<u-form class="form-content" :model="form" :error-type="['toast']" ref="uForm" label-width="180">
+					<u-form-item label="销售单价" required prop="price">
+						<u-input class="form-item" v-model="form.price" @input="numberToFixed('price',2,999999)" placeholder="请输入销售单价" :clearable="false" type="digit" input-align="right" style="margin-right: 8upx;" />元
+					</u-form-item>
+					<u-form-item label="销售数量" required prop="qty">
+						<view style="text-align: right;width: 100%;">
+							<u-number-box class="form-item" input-height="60" v-model="form.qty" :min="1" :max="999999" @change="numChange"></u-number-box>
+						</view>
+					</u-form-item>
+				</u-form>
+			</view>
+			<view class="product-footer">
+				<view class="button-cancel" @click="isShow=false">取消</view>
+				<view class="button-confirm" @click="handleConfirm">确定</view>
+			</view>
+		</view>
+	</u-mask>
+</template>
+
+<script>
+	import { numberToFixed } from '@/libs/tools'
+	export default {
+		props: {
+			openModal: { //  弹框显示状态
+				type: Boolean,
+				default: false
+			},
+			infoData: {
+				tyoe: Object,
+				default: ()=>{
+					return null
+				}
+			},
+		},
+		data() {
+			return {
+				isShow: this.openModal, //  是否打开弹框
+				theme: '',
+				form: {
+					price: null,
+					qty: 1,
+				},
+				rules: {
+					price: [ { required: true, type: 'number', message: '请输入销售单价', trigger: ['change','blur'] } ],
+					qty: [ { required: true, type: 'number', message: '请输入销售数量', trigger: 'blur' } ]
+				},
+			}
+		},
+		mounted() {
+			this.$refs.uForm.setRules(this.rules)
+			this.theme = getApp().globalData.theme
+		},
+		methods: {
+			// 确认
+			handleConfirm(){
+				console.log(this.form)
+				this.$refs.uForm.validate(valid => {
+					if (valid) {
+						console.log('验证通过')
+						this.$emit('confirm', this.form)
+					} else {
+						console.log('验证失败')
+					}
+				})
+			},
+			// 小数点后两位
+			numberToFixed: function (key, num, max) {
+				let val = this.form[key]
+				let ret = numberToFixed(val, num, max)
+				this.$nextTick(() => {
+					this.form[key] = ret
+				})
+			},
+			numChange(val){
+				if (val.value < 1){
+					this.$nextTick(() => {
+						this.form.qty = 0
+					})
+				} else if (val.value > 999999){
+					this.$nextTick(() => {
+						this.form.qty = 999999
+					})
+				}else{
+					this.form.qty = Number(val.value)
+				}
+			},
+		},
+		watch: {
+			//  父页面传过来的弹框状态
+			openModal (newValue, oldValue) {
+				this.isShow = newValue
+			},
+			//  重定义的弹框状态
+			isShow (newValue, oldValue) {
+				if (!newValue) {
+					this.$emit('close')
+				}else{
+					this.form.price = this.infoData && this.infoData.price || null
+					this.form.qty = this.infoData && this.infoData.qty || 1
+				}
+			}
+		}
+	}
+</script>
+
+<style lang="scss" scoped>
+	.productModal{
+		width: 100%;
+		height: 100%;
+		.text-c{
+			text-align: center;
+		}
+		.padding_3{
+			padding: 6upx 0;
+		}
+		.product-con{
+			width: 78%;
+			margin: 45% auto 0;
+			background-color: #fff;
+			border-radius: 24upx;
+			.product-main{
+				padding: 20upx 30upx 0;
+				.list-item-tit{
+					padding-bottom: 12upx;
+					border-bottom: 1px solid #e4e7ed;
+					.item-tit{
+						font-weight: bold;
+						color: rgb(48, 49, 51);
+						font-size: 28upx;
+						padding-left: 10upx;
+						border-left: 6upx solid #000;
+						line-height: 1;
+					}
+				}
+				.list-item-con{
+					padding: 14upx 0 16upx;
+					font-size: 26upx;
+					.pimgs{
+						margin-right: 16upx;
+					}
+				}
+				.form-content{
+					border-top: 1px dashed #e4e7ed;
+					.form-item{
+						text-align: right;
+					}
+				}
+			}
+			.product-footer{
+				font-size: 30upx;
+				display: flex;
+				justify-content: space-between;
+				align-items: center;
+				text-align: center;
+				border-top: 1upx solid #E5E5E5;
+				.button-cancel{
+					color: #999;
+					border-right: 1upx solid #E5E5E5;
+					flex-grow: 1;
+					padding: 20upx 0;
+				}
+				.button-confirm{
+					color: #2A86F4;
+					flex-grow: 1;
+					padding: 20upx 0;
+				}
+			}
+		}
+	}
+</style>

+ 234 - 0
pages/sales/productPricing.vue

@@ -0,0 +1,234 @@
+<template>
+	<view class="productPricing-content">
+		<view class="checkbox-price">
+			<u-checkbox-group  placement="row">
+				<u-checkbox v-model="item.checked" activeColor="rgb(4, 133, 246)" v-for="(item,index) in priceList" :key="index" :name="item.val">{{item.name}}</u-checkbox>
+			</u-checkbox-group>
+		</view>
+		<scroll-view class="product-list" scroll-y @scrolltolower="onreachBottom">
+			<view class="st-detailList-main">
+				<view class="st-detailList-main-item" v-for="(item, index) in listData" :key="item.id">
+					<view class="st-detailList-tit flex">
+						<!-- <view class="u-line" :style="{backgroundColor: $config('primaryColor')}"></view> -->
+						<view class="u-name">
+							{{item.name}}
+						</view>
+						<view class="u-last">
+							<copyText :text="item.name" label="产品名称"></copyText>
+						</view>
+					</view>
+					<view class="st-detailList-item-con flex align_center">
+						<view class="pimgs">
+							<u-image :src="item.productMainPic&&item.productMainPic.imageUrl?item.productMainPic.imageUrl:`../../static/${theme}/def_img@2x.png`" width="128" height="128" border-radius="10"></u-image>
+						</view>
+						<view class="flex_1">
+							<view class="padding_3">产品编码:{{item.code}} </view>
+							<view class="padding_3">原厂编码:{{(item.origCode&&item.origCode!=' ')?item.origCode:'--'}} </view>
+							<view class="padding_3">品牌:{{item.productBrandName || '--'}} </view>
+							<view class="flex align_center justify_between">
+								<view class="font_13">
+									库存数:<text>{{toThousands(item.stockQty|| 0)}} 个</text>
+								</view>
+								<view class="font_13">
+									车主价:<text class="red">¥{{toThousands(item.carOwnersPrice|| 0,2)}} </text>
+								</view>
+							</view>
+						</view>
+					</view>
+					<view class="price-all flex" v-if="selPriceShow">
+						<view class="price-item" v-if="priceList[0].checked">
+							<text>{{toThousands(item.offerCost|| 0,2)}} </text>
+							<view>成本价</view>
+						</view>
+						<view class="price-item" v-if="priceList[1].checked">
+							<text>{{toThousands(item.cityPrice|| 0,2)}} </text>
+							<view>市级价</view>
+						</view>
+						<view class="price-item" v-if="priceList[2].checked">
+							<text>{{toThousands(item.specialPrice|| 0,2)}} </text>
+							<view>特约价</view>
+						</view>
+						<view class="price-item" v-if="priceList[3].checked">
+							<text>{{toThousands(item.terminalPrice|| 0,2)}} </text>
+							<view>终端会员价</view>
+						</view>
+					</view>
+				</view>
+				<u-empty v-if="listData.length == 0 &&status!='loading'" :text="noDataText" mode="list" ></u-empty>
+				<view style="padding-bottom: 20upx;">
+					<u-loadmore v-if="totalNum>listData.length || status=='loading'" :status="status" />
+				</view>
+			</view>
+		</scroll-view>
+		<!-- 搜索弹窗 -->
+		<search :showModal="showModal" @refresh="refreshList" @close="showModal=false"/>
+	</view>
+</template>
+
+<script>
+	import { toThousands } from '@/libs/tools'
+	import { dealerProductList } from '@/api/sales'
+	import search from './search.vue'
+	import copyText from '@/pages/common/copyText.vue'
+	export default{
+		components:{search,copyText},
+		data(){
+			return{
+				toThousands,
+				listData:[],
+				totalNum:0,
+				priceList:[
+					{ name: '成本价', checked: false, val: 'offerCost' },
+					{ name: '市级价', checked: false, val: 'cityPrice' },
+					{ name: '特约价', checked: false, val: 'specialPrice' },
+					{ name: '终端会员价', checked: false, val: 'terminalPrice' },
+				],
+				pageNo:1,
+				pageSize:15,
+				noDataText: '暂无数据',
+				theme: '',
+				status: 'loadmore',
+				showModal:false,
+				params:{}
+			}
+		},
+		onNavigationBarButtonTap(e){
+			this.showModal=true
+		},
+		computed: {
+			selPriceShow() {
+				const a = this.priceList.filter(item => item.checked)
+				return a.length > 0
+			}
+		},
+		onLoad(option) {
+			this.theme = getApp().globalData.theme
+			this.getList()
+		},
+		methods:{
+			toPage(url){
+				uni.switchTab({
+					url:url
+				})
+			},
+			// 刷新列表
+			refreshList(val){
+				this.params =val ? val : {},
+				this.listData = []
+				this.totalNum = 0
+				this.getList(1)
+			},
+			// 列表
+			getList(pageNo){
+				const _this = this
+				if (pageNo) {
+					this.pageNo = pageNo
+				}
+				let params = Object.assign(this.params, { pageNo: this.pageNo, pageSize: this.pageSize })
+				this.status = "loading"
+				console.log(params)
+				dealerProductList(params).then(res => {
+					if (res.status == 200) {
+						if(this.pageNo>1){
+							this.listData = this.listData.concat(res.data.list || [])
+						}else{
+							this.listData = res.data.list || []
+						}
+						this.totalNum = res.data.count || 0
+					} else {
+						this.listData = []
+						this.totalNum = 0
+						this.noDataText = res.message
+					}
+					this.status = "loadmore"
+				})
+			},
+			// scroll-view到底部加载更多
+			onreachBottom() {
+				if(this.listData.length < this.totalNum){
+					this.pageNo += 1
+					this.getList()
+				}
+			},
+		}
+	}
+</script>
+
+<style lang="scss">
+	.productPricing-content{
+		width:100%;
+		height: 100vh;
+		.checkbox-price{
+			background-color: #fff;
+			display: flex;
+			justify-content: space-around;
+			padding: 20rpx 0;
+			margin-bottom: 15rpx;
+			color: #191919;
+		}
+		.product-list{
+			height: calc(100vh - 94upx);
+				.st-detailList-main{
+					padding: 20upx;
+					.st-detailList-main-item{
+						background: #ffffff;
+						padding: 20upx;
+						margin-bottom: 25upx;
+						border-radius: 25upx;
+						box-shadow: 1px 1px 3px #EEEEEE;
+						.st-detailList-tit{
+							padding-bottom: 20upx;
+							border-bottom: 1px solid #e4e7ed;
+							.u-name{
+								font-weight: bold;
+							}
+							.u-line{
+								display: inline-block;
+								width: 6upx;
+								height: 30upx;
+								background-color: red;
+								margin: 6upx 10upx 0 10upx;
+							}
+							.u-last{
+								width: 150upx;
+							}
+						}
+						.st-detailList-item-con{
+							padding: 20upx;
+							font-size: 26upx;
+							.red{
+								color: red;
+							}
+							.pimgs{
+								margin-right: 16upx;
+							}
+							.font_13{
+								font-size: 26upx;
+							}
+							.padding_3{
+								padding: 6upx 0;
+								word-break: break-all;
+							}
+						}
+						.price-all{
+							border-top: 1px solid #e4e7ed;
+							padding: 20upx 20upx 0;
+							.price-item{
+								width: 25%;
+								border-right:  1px solid #e4e7ed;
+								text-align: center;
+								>view{
+									color:#999;
+								}
+							}
+							.price-item:last-child{
+								border-right:  none;
+							}
+						}
+					}
+				}
+				
+				
+		}
+	}
+</style>

+ 294 - 0
pages/sales/productSearch.vue

@@ -0,0 +1,294 @@
+<template>
+	<view class="productSearch-wrap">
+		<u-popup v-model="isShow" class="search-popup" mode="right" @close="isShow=false" length="85%">
+			<u-form class="form-content" :model="form" ref="uForm" label-width="180">
+				<u-form-item label="车架号(VIN)" prop="vinCode" class="form-item">
+					<u-input v-model.trim="form.vinCode" :maxlength="17" placeholder="请输入车架号" input-align="right" />
+					<u-upload :custom-btn="true" ref="uUpload" :show-upload-list="false" :action="action" :form-data="{savePathType: 'local'}" @on-success="uploadSuccess" :max-size="2 * 1024 * 1024">
+						<view slot="addBtn" class="slot-btn" hover-class="slot-btn__hover" hover-stay-time="150">
+							<u-icon name="camera-fill" color="#c8c0cc" size="34" style="margin-left: 14upx;"></u-icon>
+						</view>
+					</u-upload>
+				</u-form-item>
+				<u-form-item label="产品编码1" prop="productCode" class="form-item">
+					<u-input v-model.trim="form.productCode" placeholder="请输入产品编码" input-align="right" />
+				</u-form-item>
+				<u-form-item label="原厂编码" prop="productOrigCode" class="form-item">
+					<u-input v-model.trim="form.productOrigCode" placeholder="请输入原厂编码" input-align="right" />
+				</u-form-item>
+				<u-form-item label="产品名称" prop="productName" class="form-item">
+					<u-input v-model.trim="form.productName" placeholder="请输入产品名称" input-align="right" />
+				</u-form-item>
+				<u-form-item label="产品品牌" prop="productBrandSn" class="form-item">
+					<u-input v-model="brandName" @click="brandModal=true" disabled placeholder="请选择产品品牌" input-align="right" />
+				</u-form-item>
+				<u-form-item label="产品分类" prop="productTypeSn" class="form-item">
+					<u-input v-model="productTypeNameArr" @click="showTypeModal=true" disabled placeholder="请选择产品分类" input-align="right" />
+				</u-form-item>
+				<u-form-item label="仓库" prop="warehouseSn" class="form-item">
+					<u-input v-model="warehouseName" @click="warehouseModal=true" disabled placeholder="请选择仓库" class="form-item-inp" input-align="right" />
+					<u-icon v-show="warehouseName.length != 0" name="close-circle-fill" color="#c8c0cc" size="32" class="close-circle" @click="clearWarehouse"></u-icon>
+				</u-form-item>
+				<u-form-item label="成本价">
+					<u-switch slot="right" v-model="form.cost"></u-switch>
+				</u-form-item>
+				<u-form-item label="市级价">
+					<u-switch slot="right" v-model="form.cityPrice"></u-switch>
+				</u-form-item>
+			</u-form>
+			<view class="uni-list-btns">
+				<u-button class="handle-btn" size="medium" hover-class="none" shape="circle" @click="resetForm">重置</u-button>
+				<u-button class="handle-btn search-btn" size="medium" shape="circle" hover-class="none" :custom-style="customBtnStyle" @click="handleSearch">查询</u-button>
+			</view>
+		</u-popup>
+		<!-- 产品品牌 -->
+		<productBrand :openModal="brandModal" :itemSn="form.productBrandSn" @choose="brandChoose" @clean="brandClean" @close="brandModal=false" />
+		<!-- 产品分类 -->
+		<productType :openModal="showTypeModal" :nowData="nowData" @choose="typeChoose" @clean="typeClean" @close="showTypeModal=false" />
+		<!-- 选择收款方式 -->
+		<u-picker v-model="warehouseModal" @confirm="warehouseChange" :range="warehouseList" range-key="name" mode="selector"></u-picker>
+	</view>
+</template>
+
+<script>
+	import productBrand from '@/pages/common/productBrand.vue'
+	import productType from '@/pages/common/productType.vue'
+	import { warehouseAllList, vinCodeParse } from '@/api/sales'
+	const baseUrl = getApp().globalData.baseUrl
+	export default{
+		components: { productBrand, productType },
+		props: {
+			openModal: { //  弹框显示状态
+				type: Boolean,
+				default: false
+			},
+			defaultParams: {  //  默认查询条件
+				type: Object,
+				default: () => {
+					return null
+				}
+			}
+		},
+		data(){
+			return{
+				isShow: this.openModal,
+				form: {
+					vinCode: '',
+					productCode: '', //  产品编码
+					productName: '', //  产品名称
+					productOrigCode: '', //  原厂编码
+					productBrandSn: undefined, //  产品品牌
+					productTypeSn1: undefined, //  产品分类1
+					productTypeSn2: undefined, //  产品分类2
+					productTypeSn3: undefined, //  产品分类3
+					warehouseSn: undefined, //  仓库
+					cost: false,  // 成本价
+					cityPrice: false,  // 市级价
+				},
+				customBtnStyle: {  //  自定义按钮样式
+					borderColor: this.$config('primaryColor'),
+					backgroundColor: this.$config('primaryColor'),
+					color: '#fff'
+				},
+				warehouseName: '',
+				warehouseModal: false,
+				warehouseList: [],
+				brandModal: false,
+				brandName: '',
+				showTypeModal: false,
+				nowData: {
+					data: [],
+					indArr: [],
+					nowInd: 0
+				},
+				action: baseUrl + 'vinIdentify/ocr',
+			}
+		},
+		computed: {
+			productTypeNameArr: function() {
+				let str = ''
+				this.nowData.data.map(item => {
+					str += item.productTypeName+' / '
+				})
+				return str ? str.substr(0, str.length-3) : ''
+			}
+		},
+		mounted() {
+			this.getWarehouse()
+		},
+		methods: {
+			//  初始化数据
+			init(){
+				console.log(this.defaultParams)
+				this.form.vinCode = this.defaultParams && this.defaultParams.vinCode || ''
+				this.form.productCode = this.defaultParams && this.defaultParams.productCode || ''
+				this.form.productName = this.defaultParams && this.defaultParams.productName || ''
+				this.form.productOrigCode = this.defaultParams && this.defaultParams.productOrigCode || ''
+				this.form.productBrandSn = this.defaultParams && this.defaultParams.productBrandSn || undefined
+				this.form.productTypeSn1 = this.defaultParams && this.defaultParams.productTypeSn1 || undefined
+				this.form.productTypeSn2 = this.defaultParams && this.defaultParams.productTypeSn2 || undefined
+				this.form.productTypeSn3 = this.defaultParams && this.defaultParams.productTypeSn3 || undefined
+				this.form.warehouseSn = this.defaultParams && this.defaultParams.warehouseSn || undefined
+				this.form.cost = this.defaultParams && this.defaultParams.cost || false
+				this.form.cityPrice = this.defaultParams && this.defaultParams.cityPrice || false
+				this.brandName = this.defaultParams && this.defaultParams.brandName || ''
+				if(this.defaultParams && this.defaultParams.nowData){
+					this.nowData = this.defaultParams.nowData
+				}else{
+					this.nowData = {
+						data: [],
+						indArr: [],
+						nowInd: 0
+					}
+				}
+				this.warehouseName = this.defaultParams && this.defaultParams.warehouseName || ''
+			},
+			// 查询
+			handleSearch() {
+				let params = JSON.parse(JSON.stringify(this.form))
+				let other = {
+					brandName: this.brandName,
+					nowData: this.nowData,
+					warehouseName: this.warehouseName
+				}
+				this.$emit('refresh', Object.assign(params, other))
+				this.isShow = false
+			},
+			// 重置
+			resetForm() {
+				this.warehouseName = ''
+				this.nowData = {
+					data: [],
+					indArr: [],
+					nowInd: 0
+				}
+				this.$refs.uForm.resetFields()
+				this.$emit('refresh', {})
+				this.isShow = false
+				this.brandClean()
+				this.typeClean()
+			},
+			uploadSuccess(res){
+				console.log(res)
+				if(res.status == 200){
+					this.form.vinCode = res.data
+				}else{
+					this.toashMsg(res.message)
+				}
+			},
+			// 选择品牌
+			brandChoose(data){
+				this.brandName = data.brandName
+				this.form.productBrandSn = data.brandSn
+			},
+			// 清空品牌
+			brandClean(){
+				this.brandName = ''
+				this.form.productBrandSn = undefined
+			},
+			// 选择分类
+			typeChoose(obj){
+				this.nowData = {
+					data: obj.data,
+					indArr: obj.indArr,
+					nowInd: obj.nowInd
+				}
+				this.form.productTypeSn1 = this.nowData.data[0]&&this.nowData.data[0].productTypeSn ? this.nowData.data[0].productTypeSn : undefined
+				this.form.productTypeSn2 = this.nowData.data[1]&&this.nowData.data[1].productTypeSn ? this.nowData.data[1].productTypeSn : undefined
+				this.form.productTypeSn3 = this.nowData.data[2]&&this.nowData.data[2].productTypeSn ? this.nowData.data[2].productTypeSn : undefined
+			},
+			// 清空分类
+			typeClean(){
+				this.nowData = {
+					data: [],
+					indArr: [],
+					nowInd: 0
+				}
+				this.form.productTypeSn1 = undefined
+				this.form.productTypeSn2 = undefined
+				this.form.productTypeSn3 = undefined
+			},
+			//  清空仓库
+			clearWarehouse(){
+				this.warehouseName = ''
+				this.form.warehouseSn = undefined
+			},
+			// 仓库  change
+			warehouseChange(ind){
+				this.form.warehouseSn = this.warehouseList[ind].warehouseSn || undefined
+				this.warehouseName = this.warehouseList[ind].name || ''
+			},
+			// 仓库列表
+			getWarehouse () {
+				warehouseAllList().then(res => {
+					if(res.status == 200 && res.data){
+						this.warehouseList = res.data
+						// 仓库有值时,匹配对应name
+						if(this.defaultParams && (this.defaultParams.warehouseSn || this.defaultParams.warehouseSn==0)){
+							this.warehouseList.map(item => {
+								if(item.warehouseSn == this.defaultParams.warehouseSn){
+									this.warehouseName = item.name
+								}
+							})
+						}
+					}else{
+						this.warehouseList = []
+					}
+				})
+			},
+		},
+		watch: {
+			//  父页面传过来的弹框状态
+			openModal (newValue, oldValue) {
+				this.isShow = newValue
+			},
+			//  重定义的弹框状态
+			isShow (newValue, oldValue) {
+				if (!newValue) {
+					this.$emit('close')
+				}else{
+					this.init()
+				}
+			}
+		}
+	}
+</script>
+
+<style lang="scss">
+	.productSearch-wrap{
+		.search-popup {
+			.form-content {
+				display: block;
+				padding: 0 20upx;
+				box-sizing: content-box;
+				.form-item{
+					.vin-box{
+						margin-left: 14upx;
+						position: relative;
+						.vin-upload{
+							position: absolute;
+							right: 0;
+							top: 0;
+						}
+					}
+				}
+				.form-item-inp{
+					display: inline-block;
+					width: 88%;
+					vertical-align: top;
+				}
+			}
+			.uni-list-btns {
+				display: flex;
+				padding: 20upx;
+				margin-top: 100upx;
+				.handle-btn {
+					font-size: 28upx;
+					margin: 0 30upx;
+					width: 100%;
+					flex: 1;
+				}
+			}
+		}
+	}
+</style>

+ 194 - 0
pages/sales/salesSearch.vue

@@ -0,0 +1,194 @@
+<template>
+	<view class="salesSearch-wrap">
+		<u-popup v-model="isShow" class="search-popup" mode="right" @close="isShow=false" length="85%">
+			<u-form class="form-content" :model="form" ref="uForm" label-width="150">
+				<u-form-item label="创建时间" prop="date" class="form-item">
+					<u-input clearable v-model="form.date" disabled placeholder="请选择创建时间区间" class="form-item-inp" @click="showDate=true" />
+					<u-icon v-show="form.date.length != 0" name="close-circle-fill" color="#c8c0cc" size="32" class="close-circle" @click="clearTime"></u-icon>
+				</u-form-item>
+				<u-form-item label="客户名称" prop="buyerName" class="form-item">
+					<u-input v-model="form.buyerName" :maxlength="30" placeholder="请输入客户名称" />
+				</u-form-item>
+				<u-form-item label="销售单号" prop="salesBillNo" class="form-item">
+					<u-input v-model="form.salesBillNo" :maxlength="30" placeholder="请输入销售单号" />
+				</u-form-item>
+				<u-form-item label="采购单号" prop="purchaseBillNo" class="form-item">
+					<u-input v-model="form.purchaseBillNo" :maxlength="30" placeholder="请输入采购单号" />
+				</u-form-item>
+				<u-form-item label="收款方式" prop="settleStyleSn" class="form-item">
+					<u-input v-model="settleStyleName" @click="settleStyleModal=true" disabled placeholder="请选择收款方式" class="form-item-inp" />
+					<u-icon v-show="settleStyleName.length != 0" name="close-circle-fill" color="#c8c0cc" size="32" class="close-circle" @click="clearSettleStyle"></u-icon>
+				</u-form-item>
+			</u-form>
+			<view class="uni-list-btns">
+				<u-button class="handle-btn" size="medium" shape="circle" hover-class="none" @click="resetForm">重置</u-button>
+				<u-button class="handle-btn search-btn" shape="circle" size="medium" hover-class="none" :custom-style="customBtnStyle" @click="handleSearch">查询</u-button>
+			</view>
+		</u-popup>
+		<!-- 选择日期范围 -->
+		<u-calendar v-model="showDate" @change="dateChange" mode="range"></u-calendar>
+		<!-- 选择收款方式 -->
+		<u-picker v-model="settleStyleModal" @confirm="settleStyleChange" :range="settleStyleList" range-key="name" mode="selector"></u-picker>
+	</view>
+</template>
+
+<script>
+	import { settleStyleQueryAll } from '@/api/sales'
+	import vSelect from '@/components/select/v-select'
+	export default{
+		components:{
+			vSelect
+		},
+		props: {
+			openModal: { //  弹框显示状态
+				type: Boolean,
+				default: false
+			},
+			defaultParams: {  //  默认查询条件
+				type: Object,
+				default: () => {
+					return {}
+				}
+			}
+		},
+		data(){
+			return{
+				isShow: this.openModal,
+				form: {
+					date: '',
+					beginDate: '',
+					endDate: '',
+					buyerName: '', //  客户名称
+					salesBillNo: '', //  销售单号
+					purchaseBillNo: '', //  采购单号
+					settleStyleSn: undefined //  收款方式
+				},
+				customBtnStyle: {  //  自定义按钮样式
+					borderColor: this.$config('primaryColor'),
+					backgroundColor: this.$config('primaryColor'),
+					color: '#fff'
+				},
+				showDate: false, // 是否显示时间弹窗
+				settleStyleName: '',
+				settleStyleModal: false,
+				settleStyleList: []
+			}
+		},
+		mounted() {
+			this.init()
+			this.getTypeList()
+		},
+		methods: {
+			//  初始化数据
+			init(){
+				if(this.defaultParams.beginDate && this.defaultParams.endDate){
+					this.form.date = this.defaultParams.beginDate + ' ~ ' + this.defaultParams.endDate
+				}else{
+					this.form.date = ''
+				}
+				this.beginDate = this.defaultParams.beginDate ? this.defaultParams.beginDate : ''
+				this.endDate = this.defaultParams.endDate ? this.defaultParams.endDate : ''
+				this.form.buyerName = this.defaultParams.buyerName ? this.defaultParams.buyerName : ''
+				this.form.salesBillNo = this.defaultParams.salesBillNo ? this.defaultParams.salesBillNo : ''
+				this.form.purchaseBillNo = this.defaultParams.purchaseBillNo ? this.defaultParams.purchaseBillNo : ''
+				this.form.settleStyleSn = this.defaultParams.settleStyleSn ? this.defaultParams.settleStyleSn : ''
+			},
+			// 查询
+			handleSearch() {
+				let params = JSON.parse(JSON.stringify(this.form))
+				delete params.date
+				this.$emit('refresh', params)
+				this.isShow = false
+			},
+			// 重置
+			resetForm() {
+				this.settleStyleName = ''
+				this.form.beginDate = ''
+				this.form.endDate = ''
+				this.$refs.uForm.resetFields()
+				this.$emit('refresh', {})
+				this.isShow = false
+			},
+			//  清空收款方式
+			clearSettleStyle(){
+				this.settleStyleName = ''
+				this.form.settleStyleSn = undefined
+			},
+			// 收款方式  change
+			settleStyleChange(ind){
+				this.form.settleStyleSn = this.settleStyleList[ind].settleStyleSn || undefined
+				this.settleStyleName = this.settleStyleList[ind].name || ''
+			},
+			// 收款方式
+			getTypeList () {
+				settleStyleQueryAll({}).then(res => {
+					if (res.status == 200 && res.data) {
+						this.settleStyleList = res.data
+						// 收款方式有值时,匹配对应name
+						if(this.defaultParams.settleStyleSn || this.defaultParams.settleStyleSn==0){
+							this.settleStyleList.map(item => {
+								if(item.settleStyleSn == this.defaultParams.settleStyleSn){
+									this.settleStyleName = item.name
+								}
+							})
+						}
+					} else {
+						this.settleStyleList = []
+					}
+				})
+			},
+			// 时间  change
+			dateChange(date){
+				this.form.date = date.startDate + ' ~ ' + date.endDate
+				this.form.beginDate = date.startDate
+				this.form.endDate = date.endDate
+			},
+			//  清空创建时间
+			clearTime(){
+				this.form.date = ''
+				this.form.beginDate = ''
+				this.form.endDate = ''
+			}
+		},
+		watch: {
+			//  父页面传过来的弹框状态
+			openModal (newValue, oldValue) {
+				this.isShow = newValue
+			},
+			//  重定义的弹框状态
+			isShow (newValue, oldValue) {
+				if (!newValue) {
+					this.$emit('close')
+				}
+			}
+		}
+	}
+</script>
+
+<style lang="scss">
+	.salesSearch-wrap{
+		.search-popup {
+			.form-content {
+				display: block;
+				padding: 0 20upx;
+				box-sizing: content-box;
+				.form-item-inp{
+					display: inline-block;
+					width: 88%;
+					vertical-align: top;
+				}
+			}
+			.uni-list-btns {
+				display: flex;
+				padding: 20upx;
+				margin-top: 200upx;
+				.handle-btn {
+					font-size: 28upx;
+					margin: 0 30upx;
+					width: 100%;
+					flex: 1;
+				}
+			}
+		}
+	}
+</style>

+ 172 - 0
pages/sales/search.vue

@@ -0,0 +1,172 @@
+<template>
+	<view class="modal-box">
+		<u-popup v-model="isShow"  @close="isShow=false" mode="right" length="85%" >
+			<u-form :model="form" ref="uForm" label-width="180" class="form-content">
+				<u-form-item label="产品编码"><u-input v-model.trim="form.code" placeholder="请输入产品编码" input-align="right" /></u-form-item>
+				<u-form-item label="原厂编码"><u-input v-model.trim="form.origCode" placeholder="请输入原厂编码" input-align="right" /></u-form-item>
+				<u-form-item label="产品名称"><u-input v-model.trim="form.name" placeholder="请输入产品名称" input-align="right" /></u-form-item>
+				<u-form-item label="产品品牌"><u-input v-model="brandName" @click="brandModal=true" disabled placeholder="请选择产品品牌" input-align="right" /></u-form-item>
+				<u-form-item label="产品分类"><u-input v-model="productTypeNameArr" @click="showTypeModal=true" disabled placeholder="请选择产品分类" input-align="right" /></u-form-item>
+			</u-form>
+			<view class="form-footer-btn">
+				<u-button class="handle-btn" shape="circle" size="medium" hover-class="none" @click="handleClean">重置</u-button>
+				<u-button class="handle-btn" shape="circle" size="medium" hover-class="none" :custom-style="customBtnStyle" @click="handleSearch">查询</u-button>
+			</view>
+		</u-popup>
+		<!-- 产品品牌 -->
+		<productBrand :openModal="brandModal" :itemSn="form.productBrandSn" @choose="brandChoose" @clean="brandClean" @close="brandModal=false" />
+		<!-- 产品分类 -->
+		<productType :openModal="showTypeModal" :nowData="nowData" @choose="typeChoose" @clean="typeClean" @close="showTypeModal=false" />
+	</view>
+</template>
+
+<script>
+	import productBrand from '@/pages/common/productBrand.vue'
+	import productType from '@/pages/common/productType.vue'
+	import { dealerProductTypeList } from '@/api/dealerProductType'
+	export default{
+		components: { productBrand, productType },
+		props:{
+			showModal:{
+				type: Boolean,
+				default: false
+			}
+			
+		},
+		computed: {
+			productTypeNameArr: function() {
+				let str = ''
+				this.nowData.data.map(item => {
+					str += item.productTypeName+' / '
+				})
+				return str ? str.substr(0, str.length-3) : ''
+			}
+		},
+		data(){
+			return{
+				form: {
+					code: '', //  产品编码
+					name: '', //  产品名称
+					origCode: '', //  原厂编码
+					productBrandSn: undefined, //  产品品牌
+					productTypeSn1: undefined, //  产品分类1
+					productTypeSn2: undefined, //  产品分类2
+					productTypeSn3: undefined, //  产品分类3
+				},
+				customBtnStyle: {  //  自定义按钮样式
+					borderColor: this.$config('primaryColor'),
+					backgroundColor: this.$config('primaryColor'),
+					color: '#fff'
+				},
+				nowData: {
+					data: [],
+					indArr: [],
+					nowInd: 0
+				},
+				brandName: '',
+				isShow:this.showModal,
+				showTypeModal: false,
+				brandModal:false
+			}
+		},
+		methods:{
+			// 表单清空
+			handleClean(){
+				this.form.code = ''
+				this.form.name = ''
+				this.form.origCode = ''
+				this.brandClean()
+				this.typeClean()
+				setTimeout(()=>{
+					this.handleSearch()
+				},300)
+			},
+			handleSearch(){
+				let data = JSON.parse(JSON.stringify(this.form))
+				console.log(data)
+				this.$emit('refresh', data)
+				this.isShow=false
+			},
+			// 选择品牌
+			brandChoose(data){
+				this.brandName = data.brandName
+				this.form.productBrandSn = data.brandSn
+			},
+			// 清空品牌
+			brandClean(){
+				this.brandName = ''
+				this.form.productBrandSn = undefined
+			},
+			// 选择分类
+			typeChoose(obj){
+				this.nowData = {
+					data: obj.data,
+					indArr: obj.indArr,
+					nowInd: obj.nowInd
+				}
+				this.form.productTypeSn1 = this.nowData.data[0]&&this.nowData.data[0].productTypeSn ? this.nowData.data[0].productTypeSn : undefined
+				this.form.productTypeSn2 = this.nowData.data[0]&&this.nowData.data[1].productTypeSn ? this.nowData.data[1].productTypeSn : undefined
+				this.form.productTypeSn3 = this.nowData.data[0]&&this.nowData.data[2].productTypeSn ? this.nowData.data[2].productTypeSn : undefined
+			},
+			// 清空分类
+			typeClean(){
+				this.nowData = {
+					data: [],
+					indArr: [],
+					nowInd: 0
+				}
+				this.form.productTypeSn1 = undefined
+				this.form.productTypeSn2 = undefined
+				this.form.productTypeSn3 = undefined
+			}
+		},
+		watch:{
+			//  父页面传过来的弹框状态
+			showModal (newValue, oldValue) {
+				this.isShow = newValue
+			},
+			//  重定义的弹框状态
+			isShow (newValue, oldValue) {
+				if (!newValue) {
+					this.$emit('close')
+				}
+			}
+		}
+	}
+</script>
+
+<style lang="scss">
+	.modal-box{
+		width: 100%;
+		.search-title {
+			text-align: center;
+			padding: 30upx 22upx;
+			color: #333;
+			border-bottom: 1px solid #eee;
+		}
+		.form-content{
+			display: block;
+			padding: 0 20upx;
+			box-sizing: content-box;
+		}
+		.u-form-item{
+			padding: 20upx 10upx;
+		}
+		.form-footer-btn{
+			margin: 60upx 30upx 30upx;
+			display: flex;
+			justify-content: space-between;
+		}
+		.form-footer-btn {
+			display: flex;
+			padding: 20upx;
+			margin-top: 200upx;
+			.handle-btn {
+				font-size: 28upx;
+				margin: 0 30upx;
+				width: 100%;
+				flex: 1;
+			}
+		}
+	}
+</style>

+ 227 - 0
pages/sales/selectedProductsModal.vue

@@ -0,0 +1,227 @@
+<template>
+	<view class="selectedProducts-modal">
+		<u-popup v-model="isShow" @close="isShow=false" height="790" mode="bottom" z-index="9999">
+			<!-- 已选产品 -->
+			<scroll-view class="product-list-con" scroll-y @scrolltolower="onreachBottom">
+				<view class="product-list-item flex align_center justify_between" v-for="(item, index) in listData" :key="item.id">
+					<view class="product-item-main font_13 flex_1" @click="handleEdit(item)">
+						<view class="product-item-name">{{item.productName || '--'}}</view>
+						<view class="flex align_center justify_between">
+							<view>{{item.productCode || '--'}}</view>
+							<view class="color_6" style="font-size: 24upx;" v-if="item.warehouseEntity&&item.warehouseEntity.name || item.warehouseLocationEntity&&item.warehouseLocationEntity.name">{{item.warehouseEntity&&item.warehouseEntity.name}} > {{item.warehouseLocationEntity&&item.warehouseLocationEntity.name}}</view>
+							<u-tag v-if="item.oosFlag==1" text="急件" type="error" mode="light" shape="circle" size="mini" style="vertical-align: text-top;" />
+						</view>
+						<view class="product-item-priceInfo">
+							<view :style="{color: $config('errorColor'), display: 'inline-block'}">¥<text style="font-size: 30upx;">{{toThousands(item.price||0, 2)}}</text></view>
+							<text style="display: inline-block;margin: 0 10upx;">X</text> 
+							<text style="font-size: 30upx;">{{toThousands(item.qty||0)}}</text>
+							{{item.productUnit}}
+						</view>
+					</view>
+					<view class="btn-box">
+						<u-icon @click="handleDel(item, index)" name="trash" :color="$config('errorColor')" size="34"></u-icon>
+					</view>
+				</view>
+				<view v-if="listData && listData.length == 0">
+					<u-empty :text="noDataText" mode="list" :img-width="200" :margin-top="30"></u-empty>
+				</view>
+				<view style="padding: 20upx;">
+					<u-loadmore v-if="totalNum>listData.length || status=='loading'" :status="status" />
+				</view>
+			</scroll-view>
+			<!-- 合计 -->
+			<view ref="productTotal" class="selected-box flex align_center justify_between">
+				<view class="choose-info flex_1 flex align_center justify_between" @click="isShow=false">
+					<text>已选 {{nowData && (nowData.totalCategory || nowData.totalCategory==0) ? toThousands(nowData.totalCategory) : '--'}} 款,合计 ¥{{nowData && (nowData.totalAmount || nowData.totalAmount==0) ? toThousands(nowData.totalAmount, 2) : '--'}}</text>
+					<u-icon name="arrow-down" :color="$config('primaryColor')" size="34" class="close-circle"></u-icon>
+				</view>
+				<view class="choose-btn" @click="handleChoose" :style="{backgroundColor: $config('primaryColor')}">选好了</view>
+			</view>
+		</u-popup>
+		<!-- 弹框 -->
+		<common-modal :openModal="commonModal" content="确认要删除吗?" @confirm="handleCommon" @close="commonModal=false" />
+	</view>
+</template>
+
+<script>
+	import commonModal from '@/pages/common/commonModal.vue'
+	import { toThousands } from '@/libs/tools'
+	import { salesDetailList, salesDetailDel } from '@/api/sales'
+	export default {
+		components: { commonModal },
+		props: {
+			openModal: { //  弹框显示状态
+				type: Boolean,
+				default: false
+			},
+			nowData: {
+				type: Object,
+				default: ()=>{
+					return null
+				}
+			}
+		},
+		data() {
+			return {
+				isShow: this.openModal, //  是否打开弹框
+				listData: [],
+				pageNo: 1,
+				pageSize: 6,
+				totalNum: 0,
+				noDataText: '暂无数据',
+				status: 'loadmore',
+				toThousands,
+				theme: '',
+				commonModal: false,
+				infoData: null,  // 
+				detailData: null
+			}
+		},
+		mounted() {
+			this.theme = getApp().globalData.theme
+		},
+		methods: {
+			// 列表
+			getList(pageNo){
+				const _this = this
+				if (pageNo) {
+					this.pageNo = pageNo
+				}
+				let params = {
+					pageNo: this.pageNo,
+					pageSize: this.pageSize,
+					salesBillSn: this.nowData && this.nowData.salesBillSn
+				}
+				this.status = "loading"
+				salesDetailList(params).then(res => {
+					if (res.status == 200) {
+						if(res.data && res.data.list){
+							res.data.list.map(item => {
+								item.productName = item.productEntity && item.productEntity.name || item.dealerProductEntity && item.dealerProductEntity.name
+								item.productCode = item.productEntity && item.productEntity.code || item.dealerProductEntity && item.dealerProductEntity.code
+								item.productUnit = item.productEntity && item.productEntity.unit || item.dealerProductEntity && item.dealerProductEntity.unit
+							})
+							if(this.pageNo>1){
+								this.listData = this.listData.concat(res.data && res.data.list || [])
+							}else{
+								this.listData = res.data.list || []
+							}
+						}else{
+							this.listData = []
+						}
+						this.totalNum = res.data && res.data.count || 0
+					} else {
+						this.listData = []
+						this.totalNum = 0
+						this.noDataText = res.message
+					}
+					this.status = "loadmore"
+				})
+			},
+			// scroll-view到底部加载更多
+			onreachBottom() {
+				if(this.listData.length < this.totalNum){
+					this.pageNo += 1
+					this.getList()
+				}
+			},
+			// 编辑产品
+			handleEdit(data){
+				this.$emit('edit', data)
+			},
+			// 已选产品  删除
+			handleDel(data, ind){
+				this.infoData = data
+				this.infoData.no = ind
+				this.commonModal = true
+			},
+			// 删除
+			handleCommon(){
+				salesDetailDel({ id: this.infoData.id }).then(res => {
+					if(res.status == 200){
+						this.getList(1)  // 已选产品列表
+						this.commonModal = false
+						this.$emit('delete', this.infoData)
+					}
+				})
+			},
+			// 选好了
+			handleChoose(){
+				this.$emit('confirm')
+			},
+			// 已选产品合计
+			selectedProductTotal(){
+				salesDetail({ id: this.infoData.id }).then(res => {
+					if(res.status == 200){
+						this.detailData = res.data
+					}else{
+						this.detailData = null
+					}
+				})
+			},
+		},
+		watch: {
+			//  父页面传过来的弹框状态
+			openModal (newValue, oldValue) {
+				this.isShow = newValue
+			},
+			//  重定义的弹框状态
+			isShow (newValue, oldValue) {
+				if (!newValue) {
+					this.$emit('close')
+				}else{
+					this.getList(1)  // 已选产品列表
+				}
+			}
+		}
+	}
+</script>
+
+<style lang="scss" scoped>
+	.selectedProducts-modal{
+		.product-list-con{
+			height: 700upx;
+			padding: 20upx 20upx 30upx;
+			box-sizing: border-box;
+			.product-list-item{
+				border-bottom: 1px solid #e4e7ed;
+				padding: 20upx 0;
+				.product-item-main{
+					.product-item-name{
+						padding: 6upx 0;
+						overflow: hidden;
+						text-overflow: ellipsis;
+						display: -webkit-box;
+						-webkit-line-clamp: 1;
+						line-clamp: 1;
+						-webkit-box-orient: vertical;
+						font-weight: bold;
+					}
+				}
+				.btn-box{
+					padding: 30upx 30upx;
+				}
+			}
+			.product-list-item:last-child{
+				border: none;
+			}
+		}
+		.selected-box{
+			position: fixed;
+			bottom: 0;
+			left: 0;
+			width: 100%;
+			background-color: #fff;
+			box-shadow: 1px -1px 3px #EEEEEE;
+			.choose-info{
+				padding: 0 30upx;
+			}
+			.choose-btn{
+				color: #fff;
+				width: 28%;
+				padding: 26upx 0;
+				text-align: center;
+			}
+		}
+	}
+</style>

+ 214 - 0
pages/shuntBackManage/cancellingStocks.vue

@@ -0,0 +1,214 @@
+<template>
+	<view class="cancelStockPages" :style="`backgroundImage:linear-gradient(180deg, ${$config('primaryColor')}, #F5F6F7 12%)`">
+		<view class="cancelStockPages-body">
+			<view class="head-info" v-if="basicInfoData">
+				<view class="states">
+					<view>
+						<u-icon name="icon_withdrawal" custom-prefix="iscm-icon" size="48"></u-icon>
+						<text>待退库</text>
+					</view>
+				</view>
+				<view>
+					<view class="label"><u-icon name="ison_shelf" custom-prefix="iscm-icon" size="32"></u-icon><text>货架名称</text></view>
+					<view class="info-txt">{{basicInfoData.shelfInfo&&basicInfoData.shelfInfo.shelfName || '--'}}</view>
+				</view>
+				<view>
+					<view class="label"><u-icon name="icon_position" custom-prefix="iscm-icon" size="32"></u-icon><text>客户地址</text></view>
+					<view class="info-txt">{{basicInfoData.customerAddr || '--'}}</view>
+				</view>
+			</view>
+			<view class="part-list">
+				<!-- 配件列表 -->
+				<partList title="配件列表" fromPage="recall" ref="partList" :list="partList" @allChecked="allCheckedCallback"></partList>
+			</view>
+		</view>
+		<view class="cancelStockPages-footer">
+			<view>
+				<u-checkbox size="40" @change="allCheckeChange" v-model="allChecked" shape="circle">{{allChecked?'取消全选':'全选'}}</u-checkbox>
+			</view>
+			<view>
+				<u-button @click="submit" shape="circle" :custom-style="{background:$config('primaryColor')}" type="primary">确定退库</u-button>
+			</view>
+		</view>
+		<!-- 确认弹框 -->
+		<common-modal :openModal="confirmModal" content="调回产品将退回至经销商仓库,确认退库吗?" confirmText="确认退库" @confirm="modalConfirm" @close="confirmModal=false" />
+	</view>
+</template>
+
+<script>
+	import commonModal from '@/pages/common/commonModal.vue'
+	import partList from '@/pages/common/partList.vue'
+	import { shelfRecallFindBySn, shelfRecallDetail, shelfRecallConfirm } from '@/api/shelfRecall.js'
+	export default {
+		components: { commonModal, partList },
+		data() {
+			return {
+				allChecked: false,
+				recallBillSn: '',
+				basicInfoData: null,
+				partList: [],
+				confirmModal: false,
+			}
+		},
+		onReady() {
+			uni.setNavigationBarColor({
+				frontColor: '#ffffff',
+				backgroundColor: this.$config('primaryColor')
+			})
+		},
+		onLoad(option) {
+			this.recallBillSn = option.sn
+			this.getDetail()
+			this.getPartList()
+		},
+		methods: {
+			// 全选
+			allCheckeChange(e){
+				this.$refs.partList.allSelect(e.value)
+			},
+			allCheckedCallback(val){
+				this.allChecked = val
+			},
+			// 查询详情
+			getDetail(){
+				shelfRecallFindBySn({sn: this.recallBillSn}).then(res => {
+					if(res.status == 200){
+						this.basicInfoData = res.data || null
+					}else{
+						this.basicInfoData = null
+					}
+				})
+			},
+			// 查询配件列表
+			getPartList(){
+				shelfRecallDetail({ recallBillSn: this.recallBillSn }).then(res => {
+					if(res.status == 200 && res.data){
+						res.data.map(item =>{
+							item.confirmQty = item.qty ? Number(item.qty) : 0
+						})
+						this.partList = res.data || []
+						console.log(res.data)
+					}else{
+						this.partList = []
+					}
+				})
+			},
+			// 确定退货
+			submit(){
+				const result =this.$refs.partList.getAllChecked()
+				if(result.length){
+					this.confirmModal = true
+				}else{
+					this.toashMsg("请选择配件!")
+				}
+			},
+			// 确认退库 confirm
+			modalConfirm(){
+				const result =this.$refs.partList.getAllChecked()
+				const arr = []
+				result.map((item, index) => {
+					if (item.confirmQty || item.confirmQty == 0) {
+						arr.push({
+							productSn: item.productSn,
+							confirmQty: item.confirmQty,
+							recallBillDetailSn: item.recallBillDetailSn
+						})
+					}
+				})
+				const params = {
+					shelfSn: result[0].shelfSn,
+					recallBillSn: this.recallBillSn,
+					recallBillNo: result[0].recallBillNo,
+					detailList: arr
+				}
+				shelfRecallConfirm(params).then(res => {
+					if(res.status == 200){
+						uni.$emit("refreshBL")
+						uni.navigateBack()
+					}
+					this.toashMsg(res.message)
+				})
+			}
+		}
+	}
+</script>
+
+<style lang="less">
+	page {
+		height: 100vh;
+	}
+.cancelStockPages{
+	position: relative;
+	width: 100%;
+	height: 100%;
+	overflow: hidden;
+	padding-bottom: 136upx;
+	.cancelStockPages-body{
+		padding: 0 30rpx;
+		height: 100%;
+		overflow: auto;
+		> view{
+			padding: 10rpx 25rpx;
+			background-color: #fff;
+			margin-bottom: 20rpx;
+			border-radius: 25rpx;
+			box-shadow: 2rpx 3rpx 5rpx #eee;
+		}
+		.head-info{
+			.states{
+				border: 0;
+				padding: 20rpx 0;
+				> view{
+					color: #191919;
+					text-align: center;
+					font-size: 40rpx;
+					text{
+						margin-left: 20rpx;
+					}
+				}
+			}
+			.info-txt{
+				word-break: break-word;
+			}
+			font-size: 30rpx;
+			> view{
+				display: flex;
+				border-bottom: 2rpx solid #f5f5f5;
+				padding: 20rpx 0;
+				> view:last-child{
+					flex-grow: 1;
+					width: 80%;
+				}
+				&:last-child{
+					border:0;
+				}
+			}
+			.label{
+				display: flex;
+				align-items: center;
+				width: 220rpx;
+				height: 44rpx;
+				color: #7C7D7E;
+				text{
+					margin-left: 10rpx;
+				}
+			}
+		}
+	}
+	.cancelStockPages-footer{
+		padding: 26upx 32upx 30upx;
+		background-color: #fff;
+		position: fixed;
+		left: 0;
+		bottom: 0;
+		width: 100%;
+		box-shadow: 3px 1px 7px #eee;
+		display: flex;
+		justify-content: space-between;
+		align-items: center;
+		.button{
+			width: 45%;
+		}
+	}
+}
+</style>

+ 156 - 0
pages/shuntBackManage/detail.vue

@@ -0,0 +1,156 @@
+<template>
+	<view class="shuntBack-detail-wrap" :style="`backgroundImage:linear-gradient(180deg, ${$config('primaryColor')}, #F5F6F7 12%)`">
+		<view class="shuntBack-detail-body">
+			<view class="head-info" v-if="basicInfoData">
+				<view class="states">
+					<view>
+						<u-icon :name="pageType=='success'?'icon_complete':'icon_cancel'" custom-prefix="iscm-icon" size="48"></u-icon>
+						<text>{{pageType=='success'?'已完成':'已取消'}}</text>
+					</view>
+				</view>
+				<view>
+					<view class="label"><u-icon name="icon_order" custom-prefix="iscm-icon" size="32"></u-icon><text>调回单号</text></view>
+					<view class="info-txt">{{basicInfoData.recallBillNo || '--'}}</view>
+				</view>
+				<view>
+					<view class="label"><u-icon name="ison_shelf" custom-prefix="iscm-icon" size="32"></u-icon><text>货架名称</text></view>
+					<view class="info-txt">{{basicInfoData.shelfInfo&&basicInfoData.shelfInfo.shelfName || '--'}}</view>
+				</view>
+			</view>
+			<view class="part-list">
+				<!-- 调回产品 -->
+				<partList :list="partList" title="调回产品" model="view" :fromPage="pageType=='success'?'shuntBackDetail':'shuntBackDetailc'" ref="partList" noDataText="暂无产品"></partList>
+			</view>
+		</view>
+	</view>
+</template>
+
+<script>
+	import { shelfRecallFindBySn, shelfRecallDetail } from '@/api/shelfRecall'
+	import partList from '@/pages/common/partList.vue'
+	export default {
+		components: { partList },
+		data() {
+			return {
+				recallBillSn: '',
+				basicInfoData:null,
+				partList: [],
+				customStyle: {
+					borderRadius:'100rpx',
+					fontSize:'30rpx',
+					background: this.$config('primaryColor')
+				},
+				pageType: ''
+			}
+		},
+		onReady() {
+			uni.setNavigationBarColor({
+				frontColor: '#ffffff',
+				backgroundColor: this.$config('primaryColor')
+			})
+		},
+		onLoad(option) {
+			this.recallBillSn = option.sn
+			this.pageType = option.type
+			this.getDetail()
+			this.getPartList()
+		},
+		methods: {
+			// 查询详情
+			getDetail(){
+				shelfRecallFindBySn({ sn: this.recallBillSn }).then(res => {
+					if(res.status == 200){
+						this.basicInfoData = res.data || null
+					}else{
+						this.basicInfoData = null
+					}
+				})
+			},
+			// 查询列表
+			getPartList(){
+				const _this = this
+				shelfRecallDetail({ recallBillSn: this.recallBillSn }).then(res => {
+					if(res.status == 200 && res.data){
+						res.data.map(item =>{
+							item.confirmQty = item.confirmQty ? Number(item.confirmQty) : 0
+							item.putQty = item.confirmQty ? Number(item.confirmQty) : 0
+						})
+						this.partList = res.data || []
+					}else{
+						this.partList = []
+					}
+				})
+			}
+		}
+	}
+</script>
+
+<style lang="less">
+.shuntBack-detail-wrap{
+	position: relative;
+	width: 100%;
+	height: 100%;
+	overflow: hidden;
+	.shuntBack-detail-body{
+		padding: 0 30rpx;
+		height: 100%;
+		overflow: auto;
+		> view{
+			padding: 10rpx 25rpx;
+			background-color: #fff;
+			margin-bottom: 20rpx;
+			border-radius: 25rpx;
+			box-shadow: 2rpx 3rpx 5rpx #eee;
+		}
+		.head-info{
+			.states{
+				border: 0;
+				padding: 20rpx 0;
+				> view{
+					color: #191919;
+					text-align: center;
+					font-size: 40rpx;
+					text{
+						margin-left: 20rpx;
+					}
+				}
+			}
+			.info-txt{
+				word-break: break-word;
+			}
+			font-size: 30rpx;
+			> view{
+				display: flex;
+				border-bottom: 2rpx solid #f5f5f5;
+				padding: 20rpx 0;
+				> view:last-child{
+					flex-grow: 1;
+					width: 80%;
+				}
+				&:last-child{
+					border:0;
+				}
+			}
+			.label{
+				display: flex;
+				align-items: center;
+				width: 220rpx;
+				height: 44rpx;
+				color: #7C7D7E;
+				text{
+					margin-left: 10rpx;
+				}
+			}
+		}
+	}
+	.shuntBack-detail-footer{
+		padding: 26upx 32upx 30upx;
+		background-color: #fff;
+		position: fixed;
+		left: 0;
+		bottom: 0;
+		width: 100%;
+		box-shadow: 3px 1px 7px #eee;
+	}
+}
+</style>

Algúns arquivos non se mostraron porque demasiados arquivos cambiaron neste cambio