transferGoods.vue 40 KB

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