inexpress.vue 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672
  1. <template>
  2. <div class="content">
  3. <div class="jjinfo">
  4. <van-field ref="searchRef" :value="recipientsName" @focus="onFocus" name="phone" label="收件人姓名"
  5. placeholder="请输入收件人姓名" :rules="[{ required: true }]" />
  6. <van-field :value="recipientsPhone" @focus="onFocusPhone" name="phone" label="收件人手机号"
  7. placeholder="请输入手机号后四位" :rules="[{ required: true }]" />
  8. <van-field :value="groupValue.departmentName" readonly name="phone" label="收件人部门" placeholder="自动填充" />
  9. <van-field :value="groupValue.seatNo" readonly name="phone" label="收件人座位" placeholder="自动填充" />
  10. </div>
  11. <!-- 寄件属性 -->
  12. <div class="choose">
  13. <div>
  14. <div class="type_wp">
  15. <div>
  16. <p>物品类型</p>
  17. <p v-if="wptype == ''" @click="wpshow = true">请选择</p>
  18. <p v-else @click="wpshow = true">{{ wptype }}</p>
  19. </div>
  20. <div>
  21. <p>
  22. <template>重量(公斤)</template>
  23. </p>
  24. <p>
  25. <van-field name="Kilogram" style="padding: 0px;">
  26. <template #input>
  27. <van-stepper v-model="Kilogram" :max="100"></van-stepper>
  28. </template>
  29. </van-field>
  30. </p>
  31. </div>
  32. <div>
  33. <p>
  34. <template>数量(件数)</template>
  35. </p>
  36. <p>
  37. <van-field name="stepper" style="padding: 0px;">
  38. <template #input>
  39. <van-stepper v-model="stepper" :max="100"></van-stepper>
  40. </template>
  41. </van-field>
  42. </p>
  43. </div>
  44. </div>
  45. </div>
  46. </div>
  47. <!--商品订单编号-->
  48. <div class="bz" style="padding-bottom: 0;" v-show="this.accountType == 1">
  49. <div>
  50. <van-field maxlength="50" v-model="goodOrderNo" name="调拨单号" label="调拨单号" placeholder="请输入调拨单号" />
  51. </div>
  52. </div>
  53. <!-- 备注 -->
  54. <div class="bz">
  55. <div>
  56. <van-field v-model="bz" name="备注" label="备注" placeholder="包装运输等要求" />
  57. </div>
  58. </div>
  59. <!-- 我同意 -->
  60. <div class="check">
  61. <van-checkbox icon-size=".24rem" v-model="check" shape="">我同意《电子运单契约条款》</van-checkbox>
  62. </div>
  63. <!-- 寄件 -->
  64. <div class="btn-jj">
  65. <van-button type="info" color="#00c4b8" @click="printer()">立即寄件</van-button>
  66. </div>
  67. <!-- 弹窗物品类型 -->
  68. <van-popup v-model="wpshow" position="bottom">
  69. <van-picker title="物品类型" show-toolbar :columns="wplist" @confirm="onConfirm1" @cancel="wpshow = false" />
  70. </van-popup>
  71. <!-- 姓名输入后弹出 -->
  72. <van-popup v-model="nameShowA" :style="{ height: '100%', width: '100%', }">
  73. <div style="display: flex; justify-content: space-between;">
  74. <van-search ref="searchNameRef" style="width: 100%;" @search="searchCrux" v-model="searchKey"
  75. placeholder="请输入搜索关键词" />
  76. </div>
  77. <div style="height: calc(100vh - 105px); overflow-y: auto; padding: 0 20px;">
  78. <van-cell-group class="vanPopup" @click="onGroup(item)" v-for="(item, index) in searchNameList"
  79. :key="index" inset>
  80. <van-cell :value="item.departmentName">{{ item.name }}- {{ item.departmentName }} - {{ item.seatNo
  81. }}</van-cell>
  82. </van-cell-group>
  83. </div>
  84. <van-button class="goback" @click="nameShowA = false" type="info">
  85. 退出
  86. </van-button>
  87. </van-popup>
  88. <!-- 手机号输入后弹出 -->
  89. <van-popup v-model="nameShowB" :style="{ height: '100%', width: '100%', }">
  90. <div style="display: flex; justify-content: space-between;">
  91. <van-search ref="searchPhoneRef" style="width: 100%;" @search="searchCruxPhone" v-model="searchKeyPhone"
  92. placeholder="请输入手机后四位" />
  93. </div>
  94. <div style="height: calc(100vh - 105px); overflow-y: auto; padding: 0 20px;">
  95. <van-cell-group class="vanPopup" @click="onGroupPhone(item)"
  96. v-for="(item, index) in searchNameListPhone" :key="index" inset>
  97. <van-cell :value="item.departmentName">{{ item.name }}- {{ item.phone }} - {{ item.departmentName
  98. }}</van-cell>
  99. </van-cell-group>
  100. </div>
  101. <van-button class="goback" @click="nameShowB = false" type="info">
  102. 退出
  103. </van-button>
  104. </van-popup>
  105. <!-- 打印机选择器 -->
  106. <van-popup v-model="printerShow" position="bottom">
  107. <van-picker show-toolbar :columns="getPrintersList" @confirm="onPrinter" @cancel="printerShow = false">
  108. <template v-slot:option="value">
  109. {{ value.printerName }}
  110. </template>
  111. </van-picker>
  112. </van-popup>
  113. </div>
  114. </template>
  115. <script>
  116. import areaList from "@/script/areas.js"
  117. import { Stepper, Toast } from 'vant';
  118. import { saveInternal, getUserByName, getListOfPrinters } from '../api/index'
  119. export default {
  120. data() {
  121. return {
  122. titlename: "内部件",
  123. wptype: "产品",//物品类型
  124. wpshow: false,//物品类型弹窗显示
  125. wplist: ["产品", "文件"],
  126. pricetype: "",//付款类型
  127. stepper: '',//件数
  128. Kilogram: '',//重量
  129. max: '',
  130. name: "",
  131. phone: "",
  132. index: "",
  133. jjadd: "",
  134. sjname: "",
  135. sjadd: "",
  136. bz: "",
  137. check: false,
  138. showPicker: false,//快递
  139. value: "",
  140. columns: [],
  141. columns2: ["个人件", "公司件"],
  142. user: {},
  143. expressInfoShow: "",//快递公司展示
  144. expressPhone: "",//快递公司电话传值
  145. expressInfo: "",//快递公司传值
  146. showPicker2: false,
  147. mainType: '',
  148. jjaddress: '',//寄件个人地址
  149. dsList: [],//代收人列表
  150. userId: "",
  151. sjInfo: {},
  152. declaredValue: '',
  153. innerType: '可销品',//内部调拨
  154. wpshow2: false,//内部类型弹窗显示
  155. innerlist: ['可销品', '非卖品'],
  156. addresstype: "办公室",//地址类型
  157. addressTypeSend: '',//上传地址类型字段
  158. addressshow: false,//地址类型弹窗显示
  159. addlist: ['办公室', '仓库', '店铺调拨'],//
  160. goodOrderNo: '',
  161. accountType: '',//账号类型
  162. // searchQuery: '',
  163. // showDropdown: false,
  164. // vanListLoading: false,
  165. // finished: false,
  166. // searchResults: [],
  167. searchKey: '',//姓名搜索结果
  168. searchKeyPhone: '',//手机搜索结果
  169. recipientsName: '',//收件人姓名
  170. recipientsPhone: '',//收件人手机号
  171. recipientsDoor: '',//部门
  172. recipientsSet: '',//座位
  173. nameShowA: false, // 姓名点击聚焦
  174. nameShowB: false, // 手机号点击聚焦
  175. searchNameList: [],//搜索后的数据
  176. searchNameListPhone: [],//手机号搜索后的数据
  177. groupValue: {},//点击后的数据
  178. getPrintersList: [],// 打印机列表
  179. printerShow: false
  180. }
  181. },
  182. created: function () {
  183. this.userId = localStorage.getItem("userId");
  184. this.accountType = localStorage.getItem("accountType")
  185. },
  186. mounted() {
  187. // this.$refs.searchRef.focus();
  188. },
  189. methods: {
  190. //姓名点击聚焦
  191. onFocus() {
  192. this.nameShowA = true
  193. this.$nextTick(() => {
  194. if (this.$refs.searchNameRef) {
  195. const inputEle = this.$refs.searchNameRef.querySelector("input")
  196. inputEle.focus()
  197. }
  198. })
  199. },
  200. // 手机号点击聚焦
  201. onFocusPhone() {
  202. this.nameShowB = true
  203. this.$nextTick(() => {
  204. if (this.$refs.searchPhoneRef) {
  205. const inputEle = this.$refs.searchPhoneRef.querySelector("input")
  206. inputEle.focus()
  207. }
  208. })
  209. },
  210. // 搜索关键
  211. async searchCrux() {
  212. const res = await getUserByName({ NAME: this.searchKey }, { loading: true })
  213. if (res.userByName != '' && res.userByName != undefined && res.userByName != null) {
  214. if (res.msg == 'success') {
  215. this.searchNameList = res.userByName
  216. }
  217. } else {
  218. Toast('没有此数据')
  219. }
  220. },
  221. // 手机号搜索关键
  222. async searchCruxPhone() {
  223. if (!/^\d{4}$/.test(this.searchKeyPhone)) {
  224. return Toast('请输入手机号后四位')
  225. }
  226. const res = await getUserByName({ PHONE: this.searchKeyPhone }, { loading: true })
  227. if (res.userByName != '' && res.userByName != undefined && res.userByName != null) {
  228. if (res.msg == 'success') {
  229. this.searchNameListPhone = res.userByName
  230. }
  231. } else {
  232. Toast('没有此数据')
  233. }
  234. },
  235. // 点击回显
  236. onGroup(value) {
  237. this.groupValue = value
  238. this.recipientsName = value.name
  239. this.recipientsPhone = value.phone
  240. this.nameShowA = false
  241. },
  242. // 手机号点击回显
  243. onGroupPhone(value) {
  244. this.groupValue = value
  245. this.recipientsName = value.name
  246. this.recipientsPhone = value.phone
  247. this.nameShowB = false
  248. },
  249. // 选择快递公司
  250. onConfirm(e) {
  251. this.expressInfoShow = e.text
  252. this.expressInfo = e.id
  253. this.expressPhone = e.phone
  254. this.showPicker = false
  255. },
  256. onConfirm0(e) {
  257. this.mainType = e
  258. this.showPicker2 = false
  259. },
  260. // 选择物品确定
  261. onConfirm1(e) {//确定
  262. if (e == '产品') {
  263. this.innerlist = ['可销品', '非卖品']
  264. this.innerType = '可销品'
  265. } else {
  266. this.innerlist = ["小样", "物料"]
  267. this.innerType = '小样'
  268. }
  269. this.wptype = e
  270. this.wpshow = false
  271. },
  272. // 选择内部确定
  273. onConfirm11(e) {//确定
  274. this.innerType = e
  275. this.wpshow2 = false
  276. },
  277. // 地址簿跳转
  278. link(obj) {
  279. this.$router.push({ path: '/Inaddressbook', query: { active: obj } })
  280. },
  281. async printer() {
  282. const getPrinters = await getListOfPrinters({})
  283. if (getPrinters.code == 0) {
  284. this.getPrintersList = getPrinters.data.map((item) => {
  285. return { printerName: item.printerName, id: item.id }
  286. })
  287. if (this.getPrintersList.length === 1) {
  288. this.save(this.getPrintersList[0].id)
  289. return
  290. }
  291. this.printerShow = true
  292. } else {
  293. Toast('系统异常')
  294. }
  295. return
  296. },
  297. async onPrinter(e) {
  298. const printerId = e.id;
  299. this.save(printerId)
  300. },
  301. //立即寄件交互
  302. async save(printerId) {
  303. if (this.recipientsName == '' || this.recipientsName == undefined) {
  304. return Toast('请输入收件人姓名')
  305. }
  306. if (this.wptype == '' || this.wptype == undefined) {
  307. Toast('请选择物品类型')
  308. return
  309. }
  310. if (this.stepper == '' || this.stepper == undefined) {
  311. Toast('请选择数量')
  312. return
  313. }
  314. if (this.check == false) {
  315. Toast('请点击同意《电子运单契约条款》')
  316. return
  317. }
  318. const toast = Toast.loading({
  319. message: '保存中...',
  320. forbidClick: true,
  321. duration: 0
  322. });
  323. let wptypeValue = ''
  324. if (this.wptype == "产品") {
  325. wptypeValue = 2
  326. } else {
  327. wptypeValue = 1
  328. }
  329. let parmas = {
  330. addresseeId: this.groupValue.userId,
  331. expressType: wptypeValue, //快件类型 1-文件 2-物品
  332. expressNum: this.stepper, //快递数量
  333. expressRemark: this.bz,//快递备注
  334. expressWeight: this.Kilogram,//公斤
  335. printId: printerId
  336. }
  337. const res = await saveInternal({ ...parmas })
  338. if (res.msg == 'success') {
  339. this.$router.push('/')
  340. Toast('寄件成功')
  341. } else {
  342. Toast(res.error)
  343. }
  344. toast.clear()
  345. }
  346. },
  347. computed: {
  348. areaList() {
  349. return areaList
  350. }
  351. }
  352. }
  353. </script>
  354. <style scoped lang="less">
  355. .vanPopup {
  356. border-bottom: 1px solid #eaeaea;
  357. padding: 12px 0;
  358. border-radius: 0px;
  359. .van-cell {
  360. padding: 0;
  361. }
  362. .van-cell::after {
  363. border: none;
  364. }
  365. }
  366. .content {
  367. .jjinfo {
  368. font-size: .24rem;
  369. color: #999999;
  370. padding: .33rem;
  371. word-break: break-word;
  372. // >div {
  373. // background: white;
  374. // border-radius: .05rem;
  375. // padding: .1rem .3rem;
  376. // .jj {
  377. // display: flex;
  378. // justify-content: space-between;
  379. // padding: .2rem 0rem;
  380. // .jjaddress {
  381. // display: flex;
  382. // padding: .1rem 0rem;
  383. // >p {
  384. // font-size: .24rem;
  385. // font-weight: bold;
  386. // display: inline-block;
  387. // width: .5rem;
  388. // height: .5rem;
  389. // background: #00c4b8;
  390. // text-align: center;
  391. // line-height: .5rem;
  392. // color: white;
  393. // border-radius: 50%;
  394. // margin-right: .3rem;
  395. // }
  396. // div {
  397. // //font-weight: bold;
  398. // max-width: 4.2rem;
  399. // p:nth-of-type(1) {
  400. // font-size: .24rem;
  401. // color: #333;
  402. // margin-bottom: .2rem;
  403. // }
  404. // p:nth-of-type(2) {
  405. // font-size: .3rem;
  406. // }
  407. // }
  408. // }
  409. // .dzb {
  410. // text-align: center;
  411. // border-left: .01rem solid #ededed;
  412. // padding-left: .3rem;
  413. // img {
  414. // width: .39rem;
  415. // height: .42rem;
  416. // padding-top: .2rem;
  417. // }
  418. // p {
  419. // font-size: .2rem;
  420. // }
  421. // }
  422. // }
  423. // }
  424. }
  425. .kdshow {
  426. font-size: .3rem;
  427. padding: .3rem 0px;
  428. width: 6.84rem;
  429. background: white;
  430. // border-radius: .05rem;
  431. margin: 0rem auto .2rem;
  432. /deep/.van-cell {
  433. padding: 0px .3rem;
  434. overflow: unset;
  435. input {
  436. text-align: right;
  437. height: .5rem;
  438. padding-right: .25rem;
  439. }
  440. }
  441. /deep/.van-cell::after {
  442. content: "";
  443. display: inline-block;
  444. border-right: .01rem solid #b0b0b0;
  445. border-bottom: .01rem solid #b0b0b0;
  446. transform: rotate(-45deg);
  447. left: unset;
  448. position: absolute;
  449. right: .3rem;
  450. bottom: .15rem;
  451. width: .2rem;
  452. height: .2rem;
  453. }
  454. }
  455. .choose {
  456. font-size: .3rem;
  457. color: #999999;
  458. font-weight: bold;
  459. padding: 0rem .33rem;
  460. >div {
  461. background: white;
  462. padding: .3rem .3rem;
  463. // border-radius: .05rem;
  464. .type_wp {
  465. display: flex;
  466. justify-content: center;
  467. div {
  468. flex: 1;
  469. text-align: center;
  470. p:nth-of-type(2) {
  471. color: #333;
  472. margin-top: .2rem;
  473. font-size: .36rem;
  474. //position: relative;
  475. }
  476. }
  477. div:nth-of-type(1) {
  478. border-right: .01rem solid #ededed;
  479. p:nth-of-type(2):after {
  480. content: "";
  481. display: inline-block;
  482. width: .15rem;
  483. height: .15rem;
  484. border-bottom: .01rem solid #999;
  485. border-right: .01rem solid #999;
  486. transform: rotate(45deg);
  487. margin-left: .15rem;
  488. position: relative;
  489. top: -.08rem;
  490. }
  491. }
  492. }
  493. .type_inner {
  494. display: flex;
  495. justify-content: center;
  496. div {
  497. flex: 1;
  498. text-align: center;
  499. p:nth-of-type(2) {
  500. color: #333;
  501. margin-top: .2rem;
  502. font-size: .36rem;
  503. //position: relative;
  504. }
  505. p:nth-of-type(2):after {
  506. content: "";
  507. display: inline-block;
  508. width: .15rem;
  509. height: .15rem;
  510. border-bottom: .01rem solid #999;
  511. border-right: .01rem solid #999;
  512. transform: rotate(45deg);
  513. margin-left: .15rem;
  514. position: relative;
  515. top: -.08rem;
  516. }
  517. /* .inner_p{
  518. color: black;
  519. margin-top: .2rem;
  520. font-size: .36rem;
  521. } */
  522. }
  523. div:nth-of-type(2) {
  524. border-right: .01rem solid #ededed;
  525. p:nth-of-type(2):after {
  526. content: "";
  527. display: inline-block;
  528. width: .15rem;
  529. height: .15rem;
  530. border-bottom: .01rem solid #999;
  531. border-right: .01rem solid #999;
  532. transform: rotate(45deg);
  533. margin-left: .15rem;
  534. position: relative;
  535. top: -.08rem;
  536. }
  537. }
  538. }
  539. }
  540. }
  541. .bz {
  542. padding: .33rem;
  543. font-size: .3rem;
  544. /deep/.van-field__value {
  545. input {
  546. text-align: right;
  547. }
  548. }
  549. }
  550. .check {
  551. font-size: .24rem;
  552. text-align: center;
  553. /deep/.van-checkbox {
  554. justify-content: center;
  555. .van-checkbox__label {
  556. color: #999;
  557. }
  558. }
  559. }
  560. .btn-jj {
  561. padding: .33rem;
  562. button {
  563. width: 100%;
  564. }
  565. }
  566. }
  567. .goback {
  568. position: fixed;
  569. height: 50px;
  570. width: 100%;
  571. bottom: 0;
  572. left: 0;
  573. }
  574. .whrite_add {
  575. width: 6.6rem;
  576. padding: .4rem .2rem;
  577. /deep/.van-field__value {
  578. input {
  579. text-align: right;
  580. }
  581. }
  582. /deep/.van-popup__close-icon--top-right {
  583. top: 5px;
  584. right: 10px;
  585. }
  586. }
  587. </style>