kjsearch.vue 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445
  1. <template>
  2. <div>
  3. <div class="content">
  4. <div class="sm">
  5. <van-search v-model="value" @search="onSearch" placeholder="点击搜索单号" />
  6. <img src="../assets/user/sm.png" alt="" @click="wxScanCode()" >
  7. </div>
  8. <!-- 快件查询列表 -->
  9. <van-checkbox-group v-model="result">
  10. <van-cell-group>
  11. <div class="jjlist" v-for="item in resultList">
  12. <div class="listinfo">
  13. <!-- <div class="list_top" @click="goInfo(item.expressNo)"> -->
  14. <div class="list_top">
  15. <div class="checked">
  16. <van-checkbox :disabled="item.signinStatus == 0" checked-color="#00c4b8" :name="item.expressNo" ref="checkboxes" />
  17. </div>
  18. <div class="list_top_left" @click="goInfo(item.expressNo)">
  19. <!-- <img src="../assets/images/ad_icon1.png" alt=""> -->
  20. <div>
  21. <p>{{item.expressNo}}</p>
  22. <p>{{item.mailRoom}} {{item.recipient}} {{item.build}} {{item.sendSeat}} {{item.floor}}</p>
  23. </div>
  24. <span style="margin-top: 30%;">{{item.recordDate2}}</span>
  25. </div>
  26. <div class="closed">
  27. <van-icon name="cross" @click="deleteInfo(item)"/>
  28. </div>
  29. </div>
  30. </div>
  31. </div>
  32. </van-cell-group>
  33. </van-checkbox-group>
  34. <div style="margin-top: 16px;">
  35. <van-field readonly clickable name="picker" :value="phone" label="收件人手机" placeholder="输入手机号后四位查询" @click="addshow1=true"/>
  36. <van-field readonly type="text" v-model="recipient" label="收件人" />
  37. <van-button style="margin-top: 16px;" color="#00c4b8" block type="info" @click="signSave">合并签收</van-button>
  38. </div>
  39. <!-- 填写手机号码 -->
  40. <van-popup round v-model="addshow1" class="whrite_add2" closeable @closed="close" :close-on-click-overlay="false">
  41. <div>
  42. <p style="font-size: 16px;text-align: center;margin-bottom: 16px;">填写号码</p>
  43. <van-form @submit="onSubmit">
  44. <van-field v-model="phone" name="收件人手机" label="收件人手机" type="number" maxlength="20" placeholder="输入手机号后四位" @change="searchList()"/>
  45. <ul>
  46. <li v-for="(item,i) in employeeList" @click="choose(i,item)">
  47. <p>{{item.name}}</p>
  48. <p>{{item.department}}</p>
  49. <van-icon v-if="index == i" name="passed" />
  50. </li>
  51. </ul>
  52. <div style="margin-top: 16px;">
  53. <van-button color="#00c4b8" block type="info" native-type="submit">确定</van-button>
  54. </div>
  55. </van-form>
  56. </div>
  57. </van-popup>
  58. </div>
  59. </div>
  60. </template>
  61. <script>
  62. import {Toast,Dialog,Checkbox,CheckboxGroup} from 'vant'
  63. import Swiper from 'swiper'
  64. export default{
  65. inject: ['reload'],
  66. data(){
  67. return{
  68. result:[],
  69. titlename:"快件查询",
  70. value:"",
  71. expressNo:"",//快递单号
  72. resultList:[],
  73. addshow1:false,
  74. name:"",
  75. box:"",
  76. phone:'',//手机号
  77. recipient:'',//收件人
  78. employeeList:[],//收件人列表
  79. index:'-1',
  80. searchType:"2"//1.搜索全部 2.搜索快件 3.搜索寄件
  81. }
  82. },
  83. created:function(){
  84. //
  85. },
  86. methods:{
  87. //微信扫码
  88. wxScanCode() {
  89. this.$http.post(this.$store.state.host + "/weixin/getWxConfig", {
  90. url: window.location.href.split("#")[0]
  91. }, {
  92. emulateJSON: true
  93. })
  94. .then(res => {
  95. //发送成功
  96. var timestamp = res.body.wxConfig.timestamp;
  97. var noncestr = res.body.wxConfig.nonceStr;
  98. var signature = res.body.wxConfig.signature;
  99. var appId = res.body.wxConfig.appId;
  100. wx.config({
  101. debug: false, // 开启调试模式,调用的所有api的返回值会在客户端alert出来,若要查看传入的参数,可以在pc端打开,参数信息会通过log打出,仅在pc端时才会打印。
  102. // debug : true, // 开启调试模式,调用的所有api的返回值会在客户端alert出来,若要查看传入的参数,可以在pc端打开,参数信息会通过log打出,仅在pc端时才会打印。
  103. appId: appId, // 必填,公众号的唯一标识
  104. timestamp: timestamp, // 必填,生成签名的时间戳
  105. nonceStr: noncestr, // 必填,生成签名的随机串
  106. signature: signature, // 必填,签名,见附录1
  107. jsApiList: [
  108. "scanQRCode",
  109. ] // 必填,需要使用的JS接口列表,所有JS接口列表见附录2
  110. });
  111. wx.ready(()=> {
  112. wx.scanQRCode({
  113. needResult: 1, // 默认为0,扫描结果由微信处理,1则直接返回扫描结果,
  114. scanType: ["qrCode", "barCode"], // 可以指定扫二维码还是一维码,默认二者都有
  115. success:(res)=> {
  116. var result = res.resultStr; // 当needResult 为 1 时,扫码返回的结果
  117. if(result.indexOf(",") != -1){
  118. let result1 = res.resultStr.split(",");
  119. this.value = result1[result1.length-1];
  120. }
  121. this.onSearch(this.value)
  122. // this.getData()
  123. },
  124. error: function(res) {
  125. console.log(res);
  126. }
  127. });
  128. });
  129. }, res => {
  130. //发送失败
  131. Toast("网络错误!")
  132. })
  133. },
  134. //选择员工
  135. choose(val,item){
  136. this.index = val
  137. this.recipient = item.name
  138. this.phone = item.phone
  139. },
  140. //手机号后四位搜索
  141. searchList(){
  142. this.$http.post(this.$store.state.host+"/solic/getEmployeeInfoByPhone",{
  143. phone:this.phone,
  144. },{
  145. emulateJSON:true,
  146. })
  147. .then(res=>{
  148. //发送成功
  149. if(res.body.msg=='success'){
  150. this.employeeList = res.body.employeeList
  151. }
  152. },res=>{
  153. //发送失败
  154. Toast("网络错误!")
  155. })
  156. },
  157. //跳转详情
  158. goInfo(expressNo){
  159. //收件查询
  160. this.$router.push({path:'/Kjsearchinfo',query:{expressNo:expressNo,type:1}})
  161. },
  162. deleteInfo(e){
  163. console.log("E:" + JSON.stringify(e))
  164. this.resultList.splice(this.resultList.indexOf(e), 1) // ['b']
  165. },
  166. //搜索
  167. onSearch(val){
  168. this.expressNo = val
  169. this.getData()
  170. },
  171. toggle(index) {
  172. this.$refs.checkboxes[index].toggle();
  173. },
  174. onSubmit(){
  175. if(this.recipient == ''){
  176. Toast('请选择收件人')
  177. return
  178. }
  179. this.addshow1=false
  180. //this.tjshow=true
  181. },
  182. close(){
  183. //this.phone = ''
  184. //this.name = ''
  185. //this.department = ''
  186. this.index = ''
  187. },
  188. //后端获取数据
  189. getData(){
  190. localStorage.getItem("userId")
  191. Toast.loading({
  192. message: '加载中...',
  193. forbidClick: true,
  194. duration:0
  195. });
  196. console.log("后端获取数据:expressNo = " + this.expressNo);
  197. this.$http.post(this.$store.state.host+"/solic/getExpressListByNo",{
  198. expressNo:this.expressNo,
  199. searchType:"2",
  200. mailRoomId:localStorage.getItem('roomId'),
  201. userId:localStorage.getItem('userId'),
  202. },{emulateJSON:true})
  203. .then(res=>{
  204. if(res.body.msg == "success"){
  205. var list = res.body.resultList;
  206. var oldlist = this.resultList;
  207. //发送成功
  208. if(oldlist == ''){
  209. for (var i = 0; i < list.length; i++) {
  210. this.resultList.push(list[i])
  211. }
  212. }else{
  213. for (var i1 = 0; i1 < list.length; i1++) {
  214. if(JSON.stringify(oldlist).indexOf(JSON.stringify(list[i1])) == -1){
  215. this.resultList.push(list[i1])
  216. }else{
  217. console.log('存在重复快递单号!')
  218. Toast("存在重复快递单号!")
  219. }
  220. }
  221. }
  222. }else if(res.body.msg == "查无此单号"){
  223. Toast("查无此快递单号!")
  224. }
  225. },res=>{
  226. //发送失败
  227. Toast("网络错误!")
  228. })
  229. Toast.clear()
  230. },
  231. //合并签收
  232. signSave(){
  233. if(this.result.length == 0){
  234. Toast('请选择需要合并的快递!');
  235. return;
  236. }
  237. if(this.recipient == ''){
  238. Toast('请选择收件人!');
  239. return;
  240. }
  241. this.$http.post(this.$store.state.host+"/solic/marginSignExpress",
  242. {expressNoList:this.result.join(','),
  243. collectAgent:this.recipient},{emulateJSON:true})
  244. .then(res=>{
  245. //发送成功
  246. if(res.body.msg=='success'){
  247. Toast("合并签收成功!");
  248. // setTimeout(()=>{
  249. // this.reload();
  250. // },1200)
  251. setTimeout(() => {
  252. this.$router.push({path:'/Sign2',query:{expressNoList:this.result.join(',')}});
  253. this.buttonDis = false
  254. }, 2000)
  255. }else{
  256. Toast("合并签收失败!");
  257. }
  258. },res=>{
  259. //发送失败
  260. Toast("网络错误!")
  261. })
  262. },
  263. //选择员工
  264. choose(val,item){
  265. this.index = val
  266. this.recipient = item.name
  267. this.phone = item.phone
  268. },
  269. //手机号后四位搜索
  270. searchList(){
  271. this.$http.post(this.$store.state.host+"/solic/getEmployeeInfoByPhone",{
  272. phone:this.phone,
  273. },{
  274. emulateJSON:true,
  275. })
  276. .then(res=>{
  277. //发送成功
  278. if(res.body.msg=='success'){
  279. this.employeeList = res.body.employeeList
  280. }
  281. },res=>{
  282. //发送失败
  283. Toast("网络错误!")
  284. })
  285. },
  286. },
  287. mounted:function(){
  288. }
  289. }
  290. </script>
  291. <style scoped lang="less">
  292. .content{
  293. padding: 0.25rem .37rem;
  294. .sm{
  295. display: flex;
  296. margin-bottom: .2rem;
  297. justify-content: space-between;
  298. /deep/.van-search{
  299. width: 6.2rem;
  300. height: .76rem;
  301. border-radius: 25px;
  302. overflow: hidden;
  303. padding: 0rem;
  304. background-color: white;
  305. .van-search__content{
  306. background-color: white;
  307. }
  308. input{
  309. background-color: white;
  310. }
  311. }
  312. img{
  313. width:.4rem;
  314. height: .4rem;
  315. position: relative;
  316. top: .18rem;
  317. }
  318. }
  319. .whrite_add2{
  320. width: 6.6rem;
  321. padding: .4rem .2rem;
  322. font-size: .3rem;
  323. /deep/.van-field__value{
  324. input{
  325. text-align: right;
  326. }
  327. }
  328. /deep/.van-popup__close-icon--top-right{
  329. top: 5px;
  330. right: 10px;
  331. }
  332. ul{
  333. li{
  334. padding: 10px 36px 10px 16px;
  335. display: flex;
  336. justify-content: space-between;
  337. position: relative;
  338. i{
  339. position: absolute;
  340. right: 0px;
  341. top:.25rem
  342. }
  343. i:before{
  344. background: #00c4b8;
  345. color: white;
  346. border-radius: 50%;
  347. }
  348. }
  349. }
  350. }
  351. .van-checkbox-group{
  352. .van-cell-group{
  353. background-color: unset;
  354. }
  355. }
  356. .jjlist {
  357. font-size: .3rem;
  358. color: #999999;
  359. .listinfo {
  360. background: white;
  361. padding: .3rem .3rem .3rem;
  362. border-radius: .05rem;
  363. margin-bottom: .2rem;
  364. position: relative;
  365. .list_top {
  366. display: flex;
  367. justify-content: space-between;
  368. align-items: center;
  369. position: relative;
  370. .closed{
  371. position: absolute;
  372. right: -0.4rem;
  373. top: -0.4rem;
  374. z-index: 3;
  375. i{
  376. background: #ed1919;
  377. border-radius: 50%;
  378. color: white;
  379. padding: 0.03rem;
  380. }
  381. }
  382. .list_top_left {
  383. img {
  384. display: inline-block;
  385. width: .87rem;
  386. height: .87rem;
  387. position: relative;
  388. }
  389. div {
  390. width: 4rem;
  391. margin-left: .2rem;
  392. display: inline-block;
  393. line-height: 150%;
  394. position: relative;
  395. top: -.1rem;
  396. p:nth-of-type(1) {
  397. font-size: .28rem;
  398. color: #333;
  399. font-weight: bold;
  400. }
  401. p:nth-of-type(2) {
  402. font-size: .22rem;
  403. }
  404. }
  405. }
  406. >p {
  407. font-size: .23rem;
  408. font-weight: bold;
  409. display: flex;
  410. align-items: center;
  411. }
  412. .staus1{
  413. color: #f5693d;
  414. }
  415. .staus2{
  416. color: #3d82f5;
  417. }
  418. }
  419. }
  420. }
  421. }
  422. </style>