express.vue 27 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047
  1. <template>
  2. <div class="content">
  3. <!--运单号-->
  4. <div v-show="wayShow" class="sm" style="padding-top: 10px;height: 50px;">
  5. <div>
  6. <van-field maxlength="50" v-model="waybillNo" name="运单号" label="运单号" placeholder="运单号" />
  7. <img @click="wxScanCode(1)" src="../assets/images/sm.png" alt="">
  8. </div>
  9. </div>
  10. <!-- 寄件地址 -->
  11. <div class="jjinfo">
  12. <div>
  13. <div class="jj">
  14. <div class="jjaddress" style="width: 100vw;">
  15. <p style="flex: none;">寄</p>
  16. <div>
  17. <van-field class="font-heigth" v-model="SendInfoValue.name" label="姓名" name="pattern"
  18. placeholder="自动填充" />
  19. <van-field class="font-heigth" v-model="SendInfoValue.phone" label="手机号" name="pattern"
  20. placeholder="自动填充" />
  21. <div class="address font-heigth">
  22. <div class="address_label">地址</div>
  23. <div class="address_text">{{ SendInfoValue.address }}</div>
  24. </div>
  25. </div>
  26. </div>
  27. <!-- <div class="dzb" @click="link(1)">
  28. <img src="../assets/images/addlist.png" alt="">
  29. <p>地址簿</p>
  30. </div> -->
  31. </div>
  32. <div class="jj" style="border-top:.01rem solid #ededed">
  33. <div class="jjaddress">
  34. <p style="background: #fa9c22; flex:none;">收</p>
  35. <div>
  36. <van-field class="font-heigth" @click="changeAdderInfo"
  37. v-model="transmitMessageVlaue.addresseeName" name="" label="姓名" placeholder="自动填充" />
  38. <van-field class="font-heigth" @click="changeAdderInfo"
  39. v-model="transmitMessageVlaue.addresseePhone" label="手机号" name="pattern"
  40. placeholder="自动填充" />
  41. <div class="address font-heigth" @click="changeAdderInfo">
  42. <div class="address_label">地址</div>
  43. <div class="address_label" style="color: #ccc;"
  44. v-if="transmitMessageVlaue.addresseeProvince == undefined">自动填充
  45. </div>
  46. <div class="address_text" v-else>{{ transmitMessageVlaue.addresseeProvince }}{{
  47. transmitMessageVlaue.addresseeCity }}{{ transmitMessageVlaue.addresseeCounty }}{{
  48. transmitMessageVlaue.addresseeTown }}{{
  49. transmitMessageVlaue.addresseeAddrInfo }}
  50. </div>
  51. </div>
  52. </div>
  53. </div>
  54. <div class="dzb" @click="link(2)">
  55. <img src="../assets/images/addlist.png" alt="">
  56. <p>地址簿</p>
  57. </div>
  58. </div>
  59. </div>
  60. </div>
  61. <!-- 快递公司 -->
  62. <div class="kdshow">
  63. <van-field readonly clickable name="picker" :value="expressInfoShow" label="快递公司" placeholder="请选择快递公司"
  64. @click="showPicker = true" />
  65. <van-popup v-model="showPicker" position="bottom">
  66. <van-picker show-toolbar :columns="columns" @confirm="onConfirm" @cancel="showPicker = false">
  67. <template v-slot:option="slotProps">
  68. {{ slotProps.expresCompanyName }}
  69. </template>
  70. </van-picker>
  71. </van-popup>
  72. </div>
  73. <!-- 寄件属性 -->
  74. <div class="choose">
  75. <div>
  76. <div class="type_wp">
  77. <div>
  78. <p>物品类型</p>
  79. <p v-if="wptype == ''" @click="wpshow = true">请选择</p>
  80. <p v-else @click="wpshow = true">{{ wptype }}</p>
  81. </div>
  82. <div>
  83. <p>
  84. <template>重量(公斤)</template>
  85. </p>
  86. <p>
  87. <van-field name="Kilogram" style="padding: 0px;">
  88. <template #input>
  89. <van-stepper v-model="Kilogram" max="100"></van-stepper>
  90. </template>
  91. </van-field>
  92. </p>
  93. </div>
  94. <div>
  95. <p>
  96. <template>数量(件数)</template>
  97. </p>
  98. <p>
  99. <van-field name="stepper" style="padding: 0px;">
  100. <template #input>
  101. <van-stepper v-model="stepper" max="100"></van-stepper>
  102. </template>
  103. </van-field>
  104. </p>
  105. </div>
  106. </div>
  107. <div class="type_price">
  108. <div>
  109. <p>付款方式</p>
  110. <p v-if="pricetype == ''" @click="priceshow = true">请选择</p>
  111. <p v-else @click="priceshow = true">{{ pricetype }}</p>
  112. </div>
  113. <div>
  114. <p>声明价值</p>
  115. <p style="display: flex;justify-content: center;"><input
  116. style="width: 1rem;border: none;text-align: center;" v-model="declaredValue"
  117. type="number" />元
  118. </p>
  119. </div>
  120. </div>
  121. <div class="type_price" v-show="this.accountType == 1">
  122. <div>
  123. <p>邮购类型</p>
  124. <p v-if="addresstype == ''" @click="addressshow = true">请选择</p>
  125. <p v-else @click="addressshow = true">{{ addresstype }}</p>
  126. </div>
  127. </div>
  128. </div>
  129. </div>
  130. <!-- 备注 -->
  131. <div class="bz">
  132. <div>
  133. <van-field style="font-size: 16px;" v-model="bz" name="备注" label="备注" placeholder="包装运输等要求" />
  134. </div>
  135. </div>
  136. <!-- 财务核销码 -->
  137. <div class="az" v-if="SendInfoValue.isVerification == 1">
  138. <van-field style="font-size: 16px;" v-model="authorization" name="authorization" label="财务核销码"
  139. placeholder="请输入财务核销码" />
  140. <img @click="vxSearchIcon" src="../assets/images/sm.png" alt="">
  141. </div>
  142. <!-- 我同意 -->
  143. <div class="check">
  144. <van-checkbox icon-size=".24rem" v-model="check" shape="">我同意《电子运单契约条款》</van-checkbox>
  145. </div>
  146. <!-- 寄件 -->
  147. <div class="btn-jj">
  148. <van-button type="info" color="#00c4b8" @click="save()">立即寄件</van-button>
  149. </div>
  150. <!-- 填写地址 -->
  151. <van-popup position="bottom" :style="{ height: '85%' }" v-model="adderInfoShow" class="whrite_add">
  152. <div class="recognition">
  153. <van-cell-group inset>
  154. <van-field style="height: auto;" v-model="discernMessage" rows="1" label="识别" type="textarea"
  155. placeholder="请粘贴,点击识别(姓名、手机号、省、市、区、详细地址间请输入空格)" />
  156. </van-cell-group>
  157. <div style="background-color: white;width: 100%;height: .8rem;padding-top: .2rem;">
  158. <van-button @click="shibie()" style="width: 15%;height: .6rem;float: right; margin-right: .2rem;"
  159. color="#00c4b8" block type="info" size="small">识别</van-button>
  160. </div>
  161. </div>
  162. <div class="adderMessage">
  163. <van-form @submit="onSubmit">
  164. <van-field v-model="discern.name" name="姓名" label="姓名" placeholder="自动填充"
  165. :rules="[{ required: false }]" />
  166. <van-field v-model="discern.phone" maxlength="11" type="number" name="手机" label="手机"
  167. placeholder="自动填充" :rules="[{ required: false }]" />
  168. <van-field name="area" v-model="discern.province" label="省" placeholder="自动填充" />
  169. <van-field name="area" v-model="discern.city" label="市" placeholder="自动填充" />
  170. <van-field name="area" v-model="discern.district" label="区" placeholder="自动填充" />
  171. <van-field name="area" v-model="discern.town" label="镇" placeholder="自动填充" />
  172. <van-field v-model="discern.address" maxlength="50" name="详细地址" label="详细地址" placeholder="自动填充"
  173. :rules="[{ required: false }]" />
  174. <div style="margin-top: 16px;">
  175. <van-button :disabled="disabled" color="#00c4b8" block type="info"
  176. native-type="submit">保存</van-button>
  177. </div>
  178. </van-form>
  179. </div>
  180. </van-popup>
  181. <!-- 弹窗物品类型 -->
  182. <van-popup v-model="wpshow" position="bottom">
  183. <van-picker title="物品类型" show-toolbar :columns="wplist" @confirm="onConfirm1" @cancel="wpshow = false" />
  184. </van-popup>
  185. <!-- 弹窗付款方式 -->
  186. <van-popup v-model="priceshow" position="bottom">
  187. <van-picker title="付款方式" show-toolbar :columns="pricelist" @confirm="onConfirm2"
  188. @cancel="priceshow = false" />
  189. </van-popup>
  190. <!-- 打印机选择器 -->
  191. <van-popup v-model="printerShow" position="bottom">
  192. <van-picker show-toolbar :columns="getPrintersList" @confirm="onPrinter" @cancel="printerShow = false">
  193. <template v-slot:option="value">
  194. {{ value.printerName }}
  195. </template>
  196. </van-picker>
  197. </van-popup>
  198. </div>
  199. </template>
  200. <script>
  201. import areaList from "@/script/areas.js"
  202. import { Toast } from 'vant';
  203. import { saveMailDo, getSendInfo, geLogisticsList, getListOfPrinters, } from '../api/index'
  204. import { spiltAddress } from '../api/addressBoook'
  205. export default {
  206. data() {
  207. return {
  208. wptype: "物品",//物品类型
  209. addresstype: "顾客邮购",//地址类型
  210. youGouType: "",//邮购类型
  211. addressshow: false,//地址类型弹窗显示
  212. addlist: ['顾客邮购', '非顾客邮购'],//
  213. wpshow: false,//物品类型弹窗显示
  214. wplist: ["物品", "文件"],
  215. pricetype: "月结(公司件)",//付款类型
  216. stepper: '',//件数
  217. Kilogram: '',//公斤
  218. max: '',//最大数
  219. priceshow: false,//付款类型弹窗显示
  220. pricelist: ["到付", "自费(个人件)", "月结(公司件)",],
  221. check: false,//契约条款
  222. bz: '',//快递备注
  223. showPicker: false,//快递
  224. expressInfoShow: "顺丰快递",//快递公司展示
  225. expressPhone: "",//快递公司电话传值
  226. expressInfo: "1",//快递公司传值
  227. columns: [],//快递公司列表
  228. columns2: ["个人件", "公司件"],
  229. declaredValue: '0', //声明价值
  230. showPicker2: false,
  231. goodOrderNo: '',//商品订单编号
  232. waybillNo: '',//运单号
  233. wayShow: true,
  234. accountType: '',//账号类型
  235. costCenterList: [],//成本中心列表
  236. costCenterName: "",//成本中心展示
  237. costCenterId: "",//成本中心展示
  238. elvenPhone: '',//收件人输入的手机号
  239. pattern: /^\d{11}$/,
  240. SendInfoValue: {},//寄件人信息
  241. authorization: '',//财务核销码
  242. getPrintersList: [],//打印机获取数据
  243. printerShow: false,//打印机出现
  244. printerName: '',//选中的打印机名称
  245. printerId: '',//选中的打印机id
  246. adderInfoShow: false,//收件人信息弹框
  247. discernMessage: '',//识别信息
  248. discern: {
  249. name: '',
  250. phone: '',
  251. province: '',
  252. city: '',
  253. district: '',
  254. town: '',
  255. address: '',
  256. proDisTown: '',
  257. },//识别后的信息
  258. disabled: false,//确定按钮的使用
  259. isAddressIdTransfer: false,//是否传送地址铺的Id
  260. }
  261. },
  262. created: function () {
  263. this.accountType = localStorage.getItem("accountType")
  264. this.geLogisticsListAPIList()
  265. },
  266. async mounted() {
  267. const res = await getSendInfo({ userId: localStorage.getItem("userId") }, { emulateJSON: true, loading: true, message: '获取寄件人信息...' })
  268. if (res.code == 444) {
  269. Toast(res.error)
  270. } else {
  271. this.SendInfoValue = res
  272. }
  273. // 当从地址铺回来时将this.isAddressIdTransfer状态改变
  274. if (this.transmitMessageVlaue.isAddressIdTransfer) {
  275. this.isAddressIdTransfer = this.transmitMessageVlaue.isAddressIdTransfer
  276. }
  277. console.log(this.isAddressIdTransfer, 'this.isAddressIdTransfer')
  278. },
  279. methods: {
  280. // 运单号扫描
  281. wxScanCode(type) {
  282. let wx = this.$wx;
  283. this.$http.post(this.$store.state.host + "/weixin/getWxConfig", {
  284. url: window.location.href.split('#')[0]
  285. }, {
  286. emulateJSON: true
  287. })
  288. .then(res => {
  289. //发送成功
  290. var timestamp = res.wxConfig.timestamp;
  291. var noncestr = res.wxConfig.nonceStr;
  292. var signature = res.wxConfig.signature;
  293. var appId = res.wxConfig.appId;
  294. wx.config({
  295. debug: false, // 开启调试模式,调用的所有api的返回值会在客户端alert出来,若要查看传入的参数,可以在pc端打开,参数信息会通过log打出,仅在pc端时才会打印。
  296. // debug : true, // 开启调试模式,调用的所有api的返回值会在客户端alert出来,若要查看传入的参数,可以在pc端打开,参数信息会通过log打出,仅在pc端时才会打印。
  297. appId: appId, // 必填,公众号的唯一标识
  298. timestamp: timestamp, // 必填,生成签名的时间戳
  299. nonceStr: noncestr, // 必填,生成签名的随机串
  300. signature: signature, // 必填,签名,见附录1
  301. jsApiList: [
  302. "scanQRCode",
  303. ] // 必填,需要使用的JS接口列表,所有JS接口列表见附录2
  304. });
  305. wx.ready(() => {
  306. wx.scanQRCode({
  307. needResult: 1, // 默认为0,扫描结果由微信处理,1则直接返回扫描结果,
  308. scanType: ["qrCode", "barCode"], // 可以指定扫二维码还是一维码,默认二者都有
  309. success: (res) => {
  310. var result = res.resultStr; // 当needResult 为 1 时,扫码返回的结果
  311. if (result.indexOf(",") != -1) {
  312. let result1 = res.resultStr.split(",");
  313. result = result1[result1.length - 1];
  314. }
  315. if (type == 1) {
  316. this.waybillNo = result;
  317. } else {
  318. this.goodOrderNo = result;
  319. }
  320. },
  321. error: function (res) {
  322. console.log(res);
  323. }
  324. });
  325. });
  326. }, res => {
  327. //发送失败
  328. Toast("网络错误!")
  329. })
  330. },
  331. // 收件人信息弹框
  332. changeAdderInfo() {
  333. this.adderInfoShow = true
  334. // 回显
  335. this.discern.province = this.transmitMessageVlaue.addresseeProvince
  336. this.discern.city = this.transmitMessageVlaue.addresseeCity
  337. this.discern.district = this.transmitMessageVlaue.addresseeCounty
  338. this.discern.name = this.transmitMessageVlaue.addresseeName
  339. this.discern.phone = this.transmitMessageVlaue.addresseePhone
  340. this.discern.town = this.transmitMessageVlaue.addresseeTown
  341. this.discern.address = this.transmitMessageVlaue.addresseeAddrInfo
  342. },
  343. async shibie() {
  344. if (this.discernMessage == '') {
  345. Toast('请粘贴地址')
  346. return
  347. }
  348. const res = await spiltAddress({ address: this.discernMessage })
  349. if (res.prov) {
  350. this.discern.name = res.per
  351. this.discern.phone = res.tel
  352. this.discern.province = res.prov
  353. this.discern.city = res.city
  354. this.discern.district = res.district
  355. this.discern.town = res.town
  356. this.discern.address = res.addr_info
  357. } else {
  358. Toast('请求失败')
  359. }
  360. console.log(res, 'res')
  361. },
  362. // 保存修改收件人信息
  363. async onSubmit() {
  364. if (this.discern.name == '' || this.discern.name == undefined) {
  365. Toast('请输入姓名')
  366. return
  367. }
  368. if (this.discern.phone == '' || this.discern.phone == undefined) {
  369. Toast('请填写手机号')
  370. return
  371. }
  372. if (this.discern.phone != '' && this.discern.phone != undefined) {
  373. let regPhone = new RegExp(this.$store.state.regPhone)
  374. if (!regPhone.test(this.discern.phone)) {
  375. Toast('手机号格式不正确')
  376. return
  377. }
  378. }
  379. if (this.discern.province == '' || this.discern.province == undefined) {
  380. Toast('请输入省')
  381. return
  382. }
  383. if (this.discern.city == '' || this.discern.city == undefined) {
  384. Toast('请输入市')
  385. return
  386. }
  387. if (this.discern.district == '' || this.discern.district == undefined) {
  388. Toast('请输入区')
  389. return
  390. }
  391. if (this.discern.town == '' || this.discern.town == undefined) {
  392. Toast('请输入镇')
  393. return
  394. }
  395. if (this.discern.address == '' || this.discern.address == undefined) {
  396. Toast('请输入详细地址')
  397. return
  398. }
  399. // 关闭弹窗
  400. this.adderInfoShow = false
  401. function equal(key1, key2) {
  402. return key1 === key2
  403. }
  404. // 如果发生修改 false , 没有修改 true
  405. this.isAddressIdTransfer = equal(this.transmitMessageVlaue.addresseeProvince, this.discern.province) &&
  406. equal(this.transmitMessageVlaue.addresseeCity, this.discern.city) &&
  407. equal(this.transmitMessageVlaue.addresseeCounty, this.discern.district) &&
  408. equal(this.transmitMessageVlaue.addresseeName, this.discern.name) &&
  409. equal(this.transmitMessageVlaue.addresseePhone, this.discern.phone) &&
  410. equal(this.transmitMessageVlaue.addresseeTown, this.discern.town) &&
  411. equal(this.transmitMessageVlaue.addresseeAddrInfo, this.discern.address)
  412. console.log("4444", this.isAddressIdTransfer)
  413. this.transmitMessageVlaue.addresseeProvince = this.discern.province
  414. this.transmitMessageVlaue.addresseeCity = this.discern.city
  415. this.transmitMessageVlaue.addresseeCounty = this.discern.district
  416. this.transmitMessageVlaue.addresseeName = this.discern.name
  417. this.transmitMessageVlaue.addresseePhone = this.discern.phone
  418. this.transmitMessageVlaue.addresseeTown = this.discern.town
  419. this.transmitMessageVlaue.addresseeAddrInfo = this.discern.address
  420. this.discern = {
  421. name: '',
  422. phone: '',
  423. province: '',
  424. city: '',
  425. district: '',
  426. town: '',
  427. address: '',
  428. proDisTown: '',
  429. }
  430. this.discernMessage = ''
  431. },
  432. // 财务核销码哦icon扫描
  433. async vxSearchIcon() {
  434. console.log('123')
  435. wx.scanQRCode({
  436. needResult: 1, // 默认为0,扫描结果由微信处理,1则直接返回扫描结果,
  437. scanType: ["qrCode", "barCode"], // 可以指定扫二维码还是一维码,默认二者都有
  438. success: (res) => {
  439. var result = res.resultStr; // 当needResult 为 1 时,扫码返回的结果
  440. if (result.indexOf(",") != -1) {
  441. let result1 = res.resultStr.split(",");
  442. result = result1[result1.length - 1];
  443. }
  444. console.log(result, '======财务核销码返回结果')
  445. this.authorization = result
  446. },
  447. error: function (res) {
  448. console.log(res, 'error++++++++++');
  449. }
  450. });
  451. },
  452. // 快递公司
  453. async geLogisticsListAPIList() {
  454. const res = await geLogisticsList({})
  455. this.columns = res.list.map((item) => {
  456. return {
  457. id: item.id,
  458. expresCompanyName: item.expresCompanyName
  459. }
  460. })
  461. },
  462. // 选择快递公司
  463. onConfirm(e) {
  464. this.expressInfoShow = e.expresCompanyName
  465. this.expressInfo = e.id
  466. this.showPicker = false
  467. },
  468. // 选择物品确定
  469. onConfirm1(e) {//确定
  470. this.wptype = e
  471. this.wpshow = false
  472. },
  473. // 选择付款方式确定
  474. onConfirm2(e) {//确定
  475. this.pricetype = e
  476. this.priceshow = false
  477. },
  478. // 地址簿跳转
  479. link(obj) {
  480. this.$router.push({ path: '/Myaddressbook', query: { active: obj } })
  481. // this.isAddressIdTransfer = true //进入地址铺了,传递
  482. },
  483. //立即寄件交互
  484. async save() {
  485. if (this.SendInfoValue.name == '' || this.SendInfoValue.name == undefined) {
  486. Toast('寄件人姓名不能为空')
  487. return
  488. }
  489. if (this.SendInfoValue.phone == '' || this.SendInfoValue.phone == undefined) {
  490. Toast('寄件人手机号不能为空')
  491. return
  492. }
  493. if (!this.pattern.test(this.SendInfoValue.phone)) {
  494. Toast('寄件人手机号码不正确')
  495. return
  496. }
  497. if (this.transmitMessageVlaue.addresseeName == '' || this.transmitMessageVlaue.addresseeName == undefined) {
  498. Toast('收件人姓名不能为空')
  499. return
  500. }
  501. if (this.transmitMessageVlaue.addresseePhone == '' || this.transmitMessageVlaue.addresseePhone == undefined) {
  502. Toast('手机号码不能为空')
  503. return
  504. }
  505. if (!this.pattern.test(this.transmitMessageVlaue.addresseePhone)) {
  506. Toast('收件人手机号码不正确')
  507. return
  508. }
  509. if (this.expressInfo == '' || this.expressInfo == undefined) {
  510. Toast('请选择快递公司')
  511. return
  512. }
  513. if (this.wptype == '' || this.wptype == undefined) {
  514. Toast('请选择物品类型')
  515. return
  516. }
  517. if (this.stepper == '' || this.stepper == undefined) {
  518. Toast('请选择重量')
  519. return
  520. }
  521. if (this.pricetype == '' || this.pricetype == undefined) {
  522. Toast('请选择付款方式')
  523. return
  524. }
  525. let payWay = ''
  526. let mainType = ''
  527. if (this.pricetype == "自费(个人件)") {
  528. payWay = '自费'
  529. mainType = '个人件'
  530. }
  531. if (this.pricetype == "月结(公司件)") {
  532. payWay = '月结'
  533. mainType = '公司件'
  534. }
  535. if (this.check == false) {
  536. Toast('请点击同意《电子运单契约条款》')
  537. return
  538. }
  539. const getPrinters = await getListOfPrinters({})
  540. if (getPrinters.code == 0) {
  541. if (getPrinters.data.length == []) {
  542. if (getPrinters.data.length == []) {
  543. this.shipServe()
  544. Toast('没有打印机')
  545. }
  546. } else {
  547. if (getPrinters.data.length != []) {
  548. this.getPrintersList = getPrinters.data.map((item) => {
  549. return { printerName: item.printerName, id: item.id }
  550. })
  551. }
  552. if (this.getPrintersList.length === 1) {
  553. this.shipServe(this.getPrintersList[0].id)
  554. } else {
  555. this.printerShow = true
  556. }
  557. }
  558. } else {
  559. Toast('系统异常')
  560. }
  561. return
  562. },
  563. // 打印机确认
  564. async onPrinter(e) {
  565. this.printerName = e.printerName;
  566. this.printerId = e.id;
  567. await this.shipServe(e.id)
  568. },
  569. // 寄件
  570. async shipServe(printId) {
  571. const $toast = Toast.loading({
  572. message: '保存中...',
  573. forbidClick: true,
  574. duration: 0
  575. });
  576. let pricetypeValue = ''
  577. if (this.pricetype == '月结(公司件)') {
  578. pricetypeValue = 3
  579. } else if (this.pricetype == '自费(个人件)') {
  580. pricetypeValue = 2
  581. } else if (this.pricetype == '到付') {
  582. pricetypeValue = 1
  583. }
  584. let wptypeValue = ''
  585. if (this.wptype == "物品") {
  586. wptypeValue = 2
  587. } else {
  588. wptypeValue = 1
  589. }
  590. // 去掉金额前的0
  591. if (this.declaredValue != 0) {
  592. this.declaredValue = this.declaredValue.replace(/^0+/, '')
  593. }
  594. let parmas = {
  595. expressInfo: this.expressInfo,//快递公司1-顺丰
  596. userAddressId: this.isAddressIdTransfer == false ? '' : this.transmitMessageVlaue.id,//收发室ID
  597. // userAddressId: 'ede4f065286a406dbb82064ec7524b4e',
  598. expressType: wptypeValue,//快件类型 1-文件 2-物品
  599. expressNum: this.stepper, //快递数量
  600. payInfo: pricetypeValue,//付费信息 1-到付 2-自付 3-月付
  601. expressRemark: this.bz,//快递备注
  602. expressWeight: this.Kilogram,//公斤
  603. expressPrice: this.declaredValue,//价值
  604. name: this.SendInfoValue.name,//寄件人姓名
  605. phone: this.SendInfoValue.phone,//寄件人手机号
  606. addresseeName: this.transmitMessageVlaue.addresseeName,//收件人姓名
  607. addresseePhone: this.transmitMessageVlaue.addresseePhone,//收件人手机号
  608. addresseeProvince: this.transmitMessageVlaue.addresseeProvince,//省
  609. addresseeCity: this.transmitMessageVlaue.addresseeCity,//s市
  610. addresseeCounty: this.transmitMessageVlaue.addresseeCounty,//区
  611. addresseeTown: this.transmitMessageVlaue.addresseeTown,//镇
  612. addresseeAddrInfo: this.transmitMessageVlaue.addresseeAddrInfo,//详细地址
  613. verificationCode: this.authorization, //财务核销码
  614. printId: printId,//打印机ID
  615. }
  616. const res = await saveMailDo({ ...parmas })
  617. if (res.msg == 'success') {
  618. Toast('寄件成功')
  619. this.$router.push('/')
  620. } else {
  621. this.$toast(res.error)
  622. }
  623. $toast.clear()
  624. }
  625. },
  626. computed: {
  627. areaList() {
  628. return areaList
  629. },
  630. transmitMessageVlaue() {
  631. return this.$store.state.transmitMessageVlaue;
  632. },
  633. }
  634. }
  635. </script>
  636. <style scoped lang="less">
  637. .content {
  638. .sm {
  639. display: flex;
  640. padding: .33rem;
  641. padding-bottom: 0;
  642. font-size: .3rem;
  643. justify-content: space-between;
  644. /deep/.van-field {
  645. width: 6.2rem;
  646. height: .76rem;
  647. .van-search__content {
  648. background-color: white;
  649. }
  650. input {
  651. text-align: right;
  652. }
  653. }
  654. img {
  655. width: .4rem;
  656. height: .4rem;
  657. position: relative;
  658. top: -.58rem;
  659. right: -6.38rem;
  660. }
  661. }
  662. .jjinfo {
  663. font-size: .24rem;
  664. color: #999999;
  665. padding: .33rem;
  666. padding-top: 0;
  667. word-break: break-word;
  668. >div {
  669. background: white;
  670. border-radius: .05rem;
  671. padding: 0rem .3rem;
  672. .jj {
  673. display: flex;
  674. align-items: center;
  675. // justify-content: space-between;
  676. padding: .2rem 0rem;
  677. .jjaddress {
  678. display: flex;
  679. padding: .1rem 0rem;
  680. .van-cell {
  681. padding: 0;
  682. margin: 0;
  683. .van-field__label.van-cell__title {
  684. width: 0.2em !important;
  685. }
  686. }
  687. .van-cell::after {
  688. margin-left: -16px;
  689. width: 100%;
  690. }
  691. >p {
  692. font-size: .24rem;
  693. font-weight: bold;
  694. display: inline-block;
  695. width: .5rem;
  696. height: .5rem;
  697. background: #00c4b8;
  698. text-align: center;
  699. line-height: .5rem;
  700. color: white;
  701. border-radius: 50%;
  702. margin-right: .3rem;
  703. }
  704. div {
  705. .font-heigth {
  706. padding: 4px 0;
  707. }
  708. }
  709. }
  710. .dzb {
  711. text-align: center;
  712. border-left: .01rem solid #ededed;
  713. padding-left: .2rem;
  714. width: 50px;
  715. img {
  716. width: .39rem;
  717. height: .42rem;
  718. }
  719. p {
  720. font-size: .2rem;
  721. }
  722. }
  723. }
  724. }
  725. }
  726. .kdshow {
  727. font-size: .3rem;
  728. padding: .3rem 0px;
  729. width: 6.84rem;
  730. background: white;
  731. border-radius: .05rem;
  732. margin: 0rem auto .2rem;
  733. /deep/.van-cell {
  734. padding: 0px .3rem;
  735. overflow: unset;
  736. input {
  737. text-align: right;
  738. height: .5rem;
  739. padding-right: .25rem;
  740. }
  741. }
  742. /deep/.van-cell::after {
  743. content: "";
  744. display: inline-block;
  745. border-right: .01rem solid #b0b0b0;
  746. border-bottom: .01rem solid #b0b0b0;
  747. transform: rotate(-45deg);
  748. left: unset;
  749. position: absolute;
  750. right: .3rem;
  751. bottom: .15rem;
  752. width: .2rem;
  753. height: .2rem;
  754. }
  755. }
  756. .choose {
  757. font-size: .3rem;
  758. color: #999999;
  759. font-weight: bold;
  760. padding: 0rem .33rem;
  761. >div {
  762. background: white;
  763. padding: .3rem .3rem;
  764. border-radius: .05rem;
  765. .type_wp {
  766. display: flex;
  767. justify-content: center;
  768. div {
  769. flex: 1;
  770. text-align: center;
  771. p:nth-of-type(2) {
  772. color: #333;
  773. margin-top: .2rem;
  774. font-size: .36rem;
  775. //position: relative;
  776. }
  777. }
  778. div:nth-of-type(1) {
  779. border-right: .01rem solid #ededed;
  780. p:nth-of-type(2):after {
  781. content: "";
  782. display: inline-block;
  783. width: .15rem;
  784. height: .15rem;
  785. border-bottom: .01rem solid #999;
  786. border-right: .01rem solid #999;
  787. transform: rotate(45deg);
  788. margin-left: .15rem;
  789. position: relative;
  790. top: -.08rem;
  791. }
  792. }
  793. }
  794. .type_price {
  795. display: flex;
  796. justify-content: center;
  797. border-top: .01rem solid #ededed;
  798. margin-top: .3rem;
  799. padding-top: .3rem;
  800. div {
  801. flex: 1;
  802. text-align: center;
  803. p:nth-of-type(2) {
  804. color: #333;
  805. margin-top: .2rem;
  806. font-size: .36rem;
  807. }
  808. }
  809. div:nth-of-type(1) {
  810. border-right: .01rem solid #ededed;
  811. p:nth-of-type(2):after {
  812. content: "";
  813. display: inline-block;
  814. width: .15rem;
  815. height: .15rem;
  816. border-bottom: .01rem solid #999;
  817. border-right: .01rem solid #999;
  818. transform: rotate(45deg);
  819. margin-left: .15rem;
  820. position: relative;
  821. top: -.08rem;
  822. }
  823. }
  824. }
  825. }
  826. }
  827. .bz {
  828. // margin-top: -0.53rem;
  829. padding: 0 .33rem;
  830. font-size: 16px;
  831. /deep/.van-field__value {
  832. input {
  833. text-align: right;
  834. }
  835. }
  836. }
  837. .az {
  838. margin: 0px .33rem;
  839. font-size: 16px;
  840. display: flex;
  841. align-items: center;
  842. background-color: #fff;
  843. // position: absolute;
  844. /deep/.van-field__value {
  845. input {
  846. text-align: right;
  847. }
  848. }
  849. img {
  850. width: .4rem;
  851. height: .4rem;
  852. margin-right: 6px;
  853. }
  854. }
  855. .check {
  856. font-size: .24rem;
  857. margin-top: 6px;
  858. text-align: center;
  859. /deep/.van-checkbox {
  860. justify-content: center;
  861. .van-checkbox__label {
  862. color: #999;
  863. }
  864. }
  865. }
  866. .btn-jj {
  867. padding: 0 .33rem .33rem;
  868. button {
  869. width: 100%;
  870. }
  871. }
  872. }
  873. .address {
  874. display: flex;
  875. font-size: 14px;
  876. line-height: 24px;
  877. position: relative;
  878. .address_label {
  879. flex: none;
  880. width: 6.2em;
  881. margin-right: 12px;
  882. color: #646566;
  883. text-align: left;
  884. word-wrap: break-word;
  885. }
  886. .address_text {
  887. color: #323233;
  888. }
  889. &::after {
  890. position: absolute;
  891. box-sizing: border-box;
  892. content: ' ';
  893. pointer-events: none;
  894. right: 16px;
  895. bottom: 0;
  896. left: 16px;
  897. border-bottom: 1px solid #ebedf0;
  898. -webkit-transform: scaleY(0.5);
  899. transform: scaleY(0.5);
  900. margin-left: -16px;
  901. width: 100%;
  902. }
  903. }
  904. .whrite_add {
  905. width: 100vw;
  906. background-color: #f8f8f8;
  907. .recognition {
  908. padding: .3rem;
  909. /deep/.van-field__value {
  910. input {
  911. text-align: right;
  912. }
  913. }
  914. }
  915. .adderMessage {
  916. padding: 0rem .3rem;
  917. }
  918. /deep/.van-field__value {
  919. input {
  920. text-align: right;
  921. }
  922. }
  923. /deep/ .van-field--min-height .van-field__control {
  924. min-height: 72px;
  925. }
  926. /deep/.van-popup__close-icon--top-right {
  927. top: 5px;
  928. right: 10px;
  929. }
  930. }
  931. </style>