write-logistics-info.vue 9.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324
  1. <template>
  2. <div class="addr-pop-con">
  3. <!-- 弹窗 -->
  4. <div class="popup-mask"></div>
  5. <div class="fix-transform-blur">
  6. <div class="popup-box">
  7. <!-- 新增地址 -->
  8. <div class="tit">
  9. <div class="text" v-if="this.returnMoneySts != 3">{{$t('applyReturn.fillLogisticsInformation')}}</div>
  10. <div class="text" v-if="this.returnMoneySts == 3">{{$t('applyReturn.modifyLogisticsInformation')}}</div>
  11. <div class="close" @click="hidePop"></div>
  12. </div>
  13. <div class="con">
  14. <div class="edit logistics-msg">
  15. <div class="item">
  16. <div class="label">{{$t('applyReturn.logisticsCompany')}}:</div>
  17. <div class="select-box">
  18. <!-- 物流公司 -->
  19. <el-select :placeholder="$t('applyReturn.select')" class="area" v-model="dvyName" @change="selectCompany">
  20. <el-option
  21. v-for="company in deliveryList"
  22. :key="company.dvyId"
  23. :label="company.dvyName"
  24. :value="company"
  25. ></el-option>
  26. </el-select>
  27. <!-- <div v-if="errTip==1" class="error-text">请选择物流公司</div> -->
  28. </div>
  29. </div>
  30. <div :class="['item', (errLnTip || errLnTip1)? 'error':'']">
  31. <div class="label">{{$t('applyReturn.shipmentNumber')}}:</div>
  32. <div class="text-box">
  33. <input type="text" maxlength="30" v-model="LogisticsNumber" :placeholder="$t('applyReturn.fillLogisticsBillNumber')" class="input" />
  34. <div v-if="errLnTip" class="error-text">{{$t('applyReturn.logisticsCannotBeEmpty')}}</div>
  35. <div v-if="errLnTip1" class="error-text">{{$t('applyReturn.logisticsOrderNoSucced')}}</div>
  36. </div>
  37. </div>
  38. <!-- <div :class="['item', errMobileTip? 'error':'']">
  39. <div class="label">{{$t('applyReturn.mobileNumber')}}:</div>
  40. <div class="text-box">
  41. <input
  42. type="text"
  43. maxlength="11"
  44. v-model="mobile"
  45. :placeholder="$t('applyReturn.mobileNumberTips')"
  46. class="input"
  47. />
  48. <div v-if="errMobileTip" class="error-text">{{$t('applyReturn.correctPhoneNumber')}}</div>
  49. </div>
  50. </div> -->
  51. <div :class="['item', errLnReMark? 'error':'']">
  52. <div class="label">{{$t('applyReturn.notes')}}:</div>
  53. <div class="text-box">
  54. <input type="text" maxlength="200" class="input" v-model="remarks" :placeholder="$t('submitOrder.numberLength200')" />
  55. <div v-if="errLnReMark" class="error-text">{{$t('inputAllSpace')}}</div>
  56. <!-- <div v-if="errTip==4" class="error-text">请您填写详细地址</div> -->
  57. </div>
  58. </div>
  59. <div class="item">
  60. <div class="label">{{$t('applyReturn.logisticsVouchers')}}:</div>
  61. <div class="text-box">
  62. <mul-pic-upload class="img-upload" v-model="imgs" :limit="5" :isLogist="true" :fileList="fileList" @imgPreview="imgPreview"/>
  63. <div class="img-des">( {{$t('applyReturn.uploadFiveVouchers')}} )</div>
  64. </div>
  65. </div>
  66. <div class="item">
  67. <div class="label-btn">&nbsp;</div>
  68. <a href="javascript:void(0)" class="btn-r" @click="writeLogisticsMsg">{{$t('submit')}}</a>
  69. </div>
  70. </div>
  71. </div>
  72. <!-- /新增地址 -->
  73. </div>
  74. </div>
  75. <!-- /弹窗 -->
  76. <!-- 图片预览 -->
  77. <el-dialog :visible.sync="dialogVisible">
  78. <img class="dialog-img" :src="dialogImageUrl" alt />
  79. </el-dialog>
  80. </div>
  81. </template>
  82. <script>
  83. import util from '../plugins/util'
  84. import MulPicUpload from '~/components/mul-pic-upload'
  85. import config from '../plugins/config'
  86. export default {
  87. components: {
  88. MulPicUpload
  89. },
  90. props: ['refundSn', 'orderNumber', 'refundDelivery', 'returnMoneySts'],
  91. data () {
  92. return {
  93. dialogVisible: false,
  94. dialogImageUrl: '',
  95. deliveryList: [], //物流公司
  96. dvyName: '', //快递公司名字
  97. dvyId: 0, //物流公司id
  98. LogisticsNumber: '', //物流单号
  99. // mobile: '', //手机号码
  100. remarks: '', //备注
  101. imgs: '',
  102. errLnTip: false,
  103. errLnTip1: false,
  104. errLnReMark: false,
  105. errMobileTip: false,
  106. fileList: [], // 已上传的凭证图片列表(用于回显)
  107. }
  108. },
  109. created () {
  110. this.loadDeliveryData()
  111. //根据物流单号判断回填信息
  112. if (this.refundDelivery.deyNu) {
  113. this.dvyName = this.refundDelivery.deyName
  114. this.LogisticsNumber = this.refundDelivery.deyNu
  115. // this.mobile = this.refundDelivery.receiverMobile
  116. this.remarks = this.refundDelivery.senderRemarks
  117. this.imgs = this.refundDelivery.imgs
  118. if (this.refundDelivery.imgs) {
  119. let temp = this.refundDelivery.imgs.split(',')
  120. temp.forEach(el => {
  121. this.fileList.push({url: config.picDomain + el})
  122. });
  123. }
  124. }
  125. },
  126. methods: {
  127. /**
  128. * 图片预览弹窗
  129. */
  130. imgPreview(url) {
  131. this.dialogImageUrl = url
  132. this.dialogVisible = true
  133. },
  134. /**
  135. * 加载物流公司
  136. */
  137. loadDeliveryData () {
  138. this.$axios.get('/p/delivery/list')
  139. .then(({ data }) => {
  140. this.deliveryList = data
  141. })
  142. },
  143. /**
  144. * 选择物流公司
  145. */
  146. selectCompany (val) {
  147. this.dvyName = val.dvyName
  148. this.dvyId = val.dvyId
  149. },
  150. /**
  151. * 提交 || 修改物流信息
  152. */
  153. writeLogisticsMsg () {
  154. // var myreg = /^1(3|4|5|6|7|8|9)\d{9}$/; //手机号验证正则
  155. if (this.LogisticsNumber.length == 0 || /^\s+$/g.test(this.LogisticsNumber)) {
  156. this.errLnTip = true
  157. // } else if (this.mobile.length !== 11 || !myreg.test(this.mobile)) {
  158. // this.errMobileTip = true
  159. return
  160. }
  161. if ( !/^[0-9a-zA-Z]+$/.test(this.LogisticsNumber) ) {
  162. this.errLnTip1 = true
  163. return
  164. }
  165. if (/^\s+$/g.test(this.remarks)) {
  166. this.errLnReMark = true
  167. return
  168. }
  169. let orderRefundExpressParam = {
  170. expressId: this.dvyId,
  171. expressName: this.dvyName,
  172. expressNo: this.LogisticsNumber,
  173. imgs: this.imgs,
  174. senderRemarks: this.remarks,
  175. mobile: this.mobile,
  176. refundSn: this.refundSn,
  177. }
  178. //当物流单号长度为0时,请求添加物流信息的接口
  179. if (this.returnMoneySts != 3) {
  180. this.$axios.post('/p/orderRefund/submitExpress', orderRefundExpressParam)
  181. .then(({ data }) => {
  182. this.$message({
  183. message: this.$t('applyReturn.fillInSuccessfully')+'!',
  184. duration: 1000,
  185. type: 'success'
  186. });
  187. this.$router.push({ path: '/order-detail?orderNumber=' + this.orderNumber })
  188. })
  189. } else if (this.returnMoneySts == 3) {
  190. //当物流单号不为空时,请求修改物流信息的接口
  191. this.$axios.put('/p/orderRefund/reSubmitExpress', orderRefundExpressParam)
  192. .then(({ data }) => {
  193. this.$message({
  194. message: this.$t('applyReturn.modifiedSuccessfully')+'!',
  195. duration: 1000,
  196. type: 'success'
  197. });
  198. this.$router.push({ path: '/order-detail?orderNumber=' + this.orderNumber })
  199. })
  200. }
  201. },
  202. /**
  203. * 隐藏新增地址弹窗
  204. */
  205. hidePop () {
  206. this.$emit('toggleAddrPop', false);
  207. },
  208. }
  209. }
  210. </script>
  211. <style scoped>
  212. .dialog-img {
  213. display: block;
  214. object-fit: contain;
  215. margin: 0 auto;
  216. max-width: 100%;
  217. }
  218. .logistics-msg .select-box {
  219. width: 300px;
  220. height: 30px;
  221. line-height: 32px;
  222. border: 1px solid #eee;
  223. padding: 5px 10px;
  224. }
  225. .popup-box .con .edit .item {
  226. display: flex;
  227. }
  228. .popup-box .con .edit .item .label {
  229. width: 100px;
  230. height: 40px;
  231. line-height: 20px;
  232. font-size: 13px;
  233. }
  234. .popup-box .con .edit .item .text-box {
  235. flex: 1;
  236. margin-left: auto;
  237. }
  238. .logistics-msg .area >>> .el-input__inner {
  239. width: 288px;
  240. margin: 0;
  241. padding: 0;
  242. height: unset;
  243. line-height: unset;
  244. }
  245. .area .el-scrollbar {
  246. width: 97px;
  247. }
  248. .logistics-msg .area >>> .el-input__suffix-inner {
  249. position: absolute;
  250. top: -4px;
  251. right: -10px;
  252. }
  253. .el-select-dropdown {
  254. z-index: 20005 !important;
  255. }
  256. .el-select-dropdown__item.selected {
  257. color: unset;
  258. font-weight: unset;
  259. }
  260. .el-select .area .el-select > .el-input {
  261. overflow: hidden;
  262. }
  263. .popup-box .con .edit .item .text-box .input {
  264. height: 25px;
  265. line-height: 25px;
  266. padding: 8px 10px;
  267. }
  268. /* 修复transform导致弹窗内容模糊问题 */
  269. .fix-transform-blur {
  270. /* z-index: 10000; */
  271. z-index: 1998;
  272. position: fixed;
  273. top: 40%;
  274. left: 50%;
  275. transform: translate(-50%, -40%);
  276. }
  277. /* 上传图片 */
  278. .con .logistics-msg .img-upload {
  279. display: block;
  280. }
  281. .logistics-msg >>> .el-upload--picture-card {
  282. width: 70px;
  283. height: 70px;
  284. }
  285. .logistics-msg .item >>> .el-upload--picture-card {
  286. line-height: 83px;
  287. }
  288. .logistics-msg .img-des {
  289. margin-top: 15px;
  290. color: #aaa;
  291. }
  292. /* 缩略图 */
  293. .logistics-msg >>> .el-upload-list--picture-card .el-upload-list__item {
  294. width: 70px;
  295. height: 70px;
  296. }
  297. /* 提交 */
  298. .popup-box .con .logistics-msg .item .label-btn {
  299. width: 100px;
  300. }
  301. .logistics-msg .item .btn-r {
  302. width: 291px;
  303. text-align: center;
  304. margin-top: 12px;
  305. height: 2em;
  306. line-height: 2em;
  307. font-size: 13px;
  308. letter-spacing: 2px;
  309. }
  310. div /deep/ .el-icon-plus {
  311. width: 70px;
  312. height: 70px;
  313. }
  314. </style>