logisticsBill.vue 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471
  1. <!-- 填写物流单号页面 -->
  2. <template>
  3. <view class="select_service">
  4. <view class="order_goods">
  5. <view class="goods_list">
  6. <view class="goods_pre">
  7. <view class="goods_image">
  8. <image :src="allData.productImage" mode="aspectFit"></image>
  9. </view>
  10. <view class="goods_pre_right">
  11. <view class="goods_des">
  12. <view class="goods_name">{{allData.goodsName}}</view>
  13. <view class="goods_spec" v-if="allData.specValues">{{allData.specValues}}</view>
  14. </view>
  15. <view class="goods_prices">
  16. <view class="goods_price">
  17. <text class="unit">¥</text>
  18. <text class="price_int">{{$getPartNumber(allData.productShowPrice,'int')}}</text>
  19. <text class="price_decimal">{{$getPartNumber(allData.productShowPrice,'decimal')}}</text>
  20. </view>
  21. <view class="goods_num">*{{allData.returnNum}}</view>
  22. </view>
  23. </view>
  24. </view>
  25. </view>
  26. </view>
  27. <view class="logistics_des">
  28. <view class="logistics_pre">
  29. <view class="logistics_pre_left">
  30. <text>*</text>
  31. <text>{{$L('物流单号')}}:</text>
  32. </view>
  33. <view class="logistics_pre_right">
  34. <input type="text" v-model="logisticsBillNo" :placeholder="$L('请填写物流单号')" maxlength="20"/>
  35. </view>
  36. </view>
  37. <view class="logistics_pre">
  38. <view class="logistics_pre_left">
  39. <text>*</text>
  40. <text>{{$L('物流公司')}}:</text>
  41. </view>
  42. <view class="logistics_pre_right" @click="goLogisticsCompany">
  43. <text>{{logisticsCompanyData.expressName ? logisticsCompanyData.expressName : '请选择物流公司'}}</text>
  44. <image :src="imgUrl+'order-detail/to_right.png'" mode="aspectFit"></image>
  45. </view>
  46. </view>
  47. <!-- <view class="logistics_pre">
  48. <view class="logistics_pre_left">
  49. <text>*</text>
  50. <text>联系电话:</text>
  51. </view>
  52. <view class="logistics_pre_right">
  53. <input type="text" :value="contactNumber" placeholder="请输入联系电话" @input="getContactNumber"/>
  54. </view>
  55. </view> -->
  56. </view>
  57. <view class="submit_txt" @click="submitLogistics">{{$L('提交')}}</view>
  58. </view>
  59. </template>
  60. <script>
  61. import {
  62. mapState
  63. } from 'vuex';
  64. import recommendGoods from "@/components/recommend-goods.vue";
  65. import uniPopup from '@/components/uni-popup/uni-popup.vue';
  66. import uniPopupMessage from '@/components/uni-popup/uni-popup-message.vue';
  67. import uniPopupDialog from '@/components/uni-popup/uni-popup-dialog.vue';
  68. let startY = 0,
  69. moveY = 0,
  70. pageAtTop = true;
  71. export default {
  72. components: {
  73. recommendGoods,
  74. uniPopup,
  75. uniPopupMessage,
  76. uniPopupDialog
  77. },
  78. data() {
  79. return {
  80. imgUrl: getApp().globalData.imgUrl,
  81. coverTransform: 'translateY(0px)',
  82. coverTransition: '0s',
  83. moving: false,
  84. afsSn:'', //退款单号
  85. allData:{}, //订单详细信息
  86. orderProductList:[], //订单商品列表
  87. logisticsBillNo:'', //物流单号
  88. contactNumber:'', //联系电话
  89. expressId:'', //物流公司的id
  90. logisticsCompanyData:{}, //物流公司的信息
  91. }
  92. },
  93. async onLoad(option) {
  94. //退款单号
  95. this.afsSn = option.afsSn;
  96. this.initData();
  97. this.getOrderDetail();
  98. },
  99. onShow:function(){
  100. let that = this;
  101. let pages = getCurrentPages();
  102. let currPage = pages[pages.length - 1]; //当前页面
  103. let res = currPage.logisticsCompanyData; //下一个页面传过来的值
  104. // that.logisticsCompanyData = res || {};
  105. },
  106. // #ifndef MP
  107. onNavigationBarButtonTap(e) {
  108. const index = e.index;
  109. if (index === 0) {
  110. this.navTo('/pages/set/set');
  111. } else if (index === 1) {
  112. // #ifdef APP-PLUS
  113. const pages = getCurrentPages();
  114. const page = pages[pages.length - 1];
  115. const currentWebview = page.$getAppWebview();
  116. currentWebview.hideTitleNViewButtonRedDot({
  117. index
  118. });
  119. // #endif
  120. uni.navigateTo({
  121. url: '/pages/notice/notice'
  122. })
  123. }
  124. },
  125. // #endif
  126. computed: {
  127. ...mapState(['hasLogin', 'userInfo', 'userCenterData'])
  128. },
  129. methods: {
  130. initData() {
  131. },
  132. /**
  133. * 统一跳转接口,拦截未登录路由
  134. * navigator标签现在默认没有转场动画,所以用view
  135. */
  136. navTo(url) {
  137. if (!this.hasLogin) {
  138. url = '/pages/public/login';
  139. }
  140. uni.navigateTo({
  141. url
  142. })
  143. },
  144. /**
  145. * 会员卡下拉和回弹
  146. * 1.关闭bounce避免ios端下拉冲突
  147. * 2.由于touchmove事件的缺陷(以前做小程序就遇到,比如20跳到40,h5反而好很多),下拉的时候会有掉帧的感觉
  148. * transition设置0.1秒延迟,让css来过渡这段空窗期
  149. * 3.回弹效果可修改曲线值来调整效果,推荐一个好用的bezier生成工具 http://cubic-bezier.com/
  150. */
  151. coverTouchstart(e) {
  152. if (pageAtTop === false) {
  153. return;
  154. }
  155. this.coverTransition = 'transform .1s linear';
  156. startY = e.touches[0].clientY;
  157. },
  158. coverTouchmove(e) {
  159. moveY = e.touches[0].clientY;
  160. let moveDistance = moveY - startY;
  161. if (moveDistance < 0) {
  162. this.moving = false;
  163. return;
  164. }
  165. this.moving = true;
  166. if (moveDistance >= 80 && moveDistance < 100) {
  167. moveDistance = 80;
  168. }
  169. if (moveDistance > 0 && moveDistance <= 80) {
  170. this.coverTransform = `translateY(${moveDistance}px)`;
  171. }
  172. },
  173. coverTouchend() {
  174. if (this.moving === false) {
  175. return;
  176. }
  177. this.moving = false;
  178. this.coverTransition = 'transform 0.3s cubic-bezier(.21,1.93,.53,.64)';
  179. this.coverTransform = 'translateY(0px)';
  180. },
  181. //获取订单详情信息
  182. getOrderDetail(){
  183. let that = this;
  184. let param = {};
  185. param.url = 'v3/business/front/after/sale/detail';
  186. param.method = 'GET';
  187. param.data = {};
  188. param.data.afsSn = that.afsSn;
  189. that.$request(param).then(res => {
  190. if (res.state == 200) {
  191. let result = res.data;
  192. that.orderProductList = result.orderProductList;
  193. that.allData = result || {};
  194. that.loadFlag = true;
  195. } else {
  196. this.$api.msg(res.msg);
  197. }
  198. }).catch((e) => {
  199. //异常处理
  200. })
  201. },
  202. //获取输入物流单号的值
  203. // logisticsBill(e){
  204. // let that = this;
  205. // that.logisticsBillNo = e.detail.value;
  206. // },
  207. //获取联系电话
  208. getContactNumber(e){
  209. let that = this;
  210. that.contactNumber = e.detail.value;
  211. },
  212. //去物流公司页面
  213. goLogisticsCompany(){
  214. uni.navigateTo({
  215. url:'/pages/order/logisticsCompany'
  216. })
  217. },
  218. //电话号的校验
  219. validateTel(tel){//校验电话
  220. if(tel!=""){
  221. var strRegex = /^(13|14|15|17|18)\d{9}$/;
  222. if(!strRegex.test(tel)){
  223. return false;
  224. }
  225. }
  226. return true;
  227. },
  228. //提交物流信息
  229. submitLogistics(){
  230. let that = this;
  231. let isValidate = that.validateTel(that.contactNumber);
  232. if(that.logisticsBillNo == ''){
  233. that.$api.msg('请填写物流单号');
  234. return
  235. }
  236. let reg = /^[0-9a-zA-Z]{1,20}$/g;
  237. if(!reg.test(that.logisticsBillNo)){
  238. uni.showToast({
  239. title:'请输入正确的物流单号!',
  240. icon:"none"
  241. });
  242. return
  243. }
  244. if(JSON.stringify(that.logisticsCompanyData) == '{}' || that.logisticsCompanyData == {}){
  245. that.$api.msg('请选择物流公司');
  246. return
  247. }
  248. // else if(that.contactNumber == ''){
  249. // that.$api.msg('请填写联系电话');
  250. // }else if(that.contactNumber != '' && isValidate == false){
  251. // that.$api.msg('联系电话格式有误!');
  252. // }
  253. let param = {};
  254. param.url = 'v3/business/front/after/sale/deliverGoods';
  255. param.method = 'POST';
  256. param.data = {};
  257. param.data.afsSn = that.afsSn; //售后服务单号
  258. param.data.expressId = that.logisticsCompanyData.expressId; //物流公司的id
  259. param.data.logisticsNumber = that.logisticsBillNo; //快递单号
  260. // param.data.contactPhone = that.contactNumber; //联系电话
  261. that.$request(param).then(res => {
  262. if (res.state == 200) {
  263. that.$api.msg(res.msg);
  264. let pages = getCurrentPages();
  265. let beforePage = pages[pages.length -2]; //上一页
  266. beforePage.$vm.getOrderDetail(); //更新上一页数据 售后订单详情页面
  267. uni.navigateBack({
  268. delta:1
  269. })
  270. } else {
  271. that.$api.msg(res.msg);
  272. }
  273. }).catch((e) => {
  274. //异常处理
  275. })
  276. },
  277. }
  278. }
  279. </script>
  280. <style lang='scss'>
  281. page {
  282. background: $bg-color-split;
  283. }
  284. .select_service{
  285. width: 750rpx;
  286. margin: 0 auto;
  287. background: #F5F5F5;
  288. .order_goods{
  289. border-top: 20rpx solid #F5F5F5;
  290. background-color: #FFFFFF;
  291. .goods_list{
  292. padding: 20rpx 0;
  293. .goods_pre{
  294. display: flex;
  295. padding: 0 20rpx;
  296. box-sizing: border-box;
  297. .goods_image{
  298. width: 200rpx;
  299. height: 200rpx;
  300. background: #F3F3F3;
  301. border-radius: 14px;
  302. image{
  303. width: 200rpx;
  304. height: 200rpx;
  305. border-radius: 14rpx;
  306. }
  307. }
  308. .goods_pre_right{
  309. display: flex;
  310. justify-content: space-between;
  311. width: 585rpx;
  312. .goods_des{
  313. margin-left: 25rpx;
  314. padding-top: 8rpx;
  315. box-sizing: border-box;
  316. .goods_name{
  317. width: 340rpx;
  318. font-size: 28rpx;
  319. font-family: PingFang SC;
  320. font-weight: 500;
  321. color: #343434;
  322. line-height: 39rpx;
  323. text-overflow: -o-ellipsis-lastline;
  324. overflow: hidden;
  325. text-overflow: ellipsis;
  326. display: -webkit-box;
  327. -webkit-line-clamp: 2;
  328. line-clamp: 2;
  329. -webkit-box-orient: vertical;
  330. }
  331. .goods_spec{
  332. font-size: 24rpx;
  333. font-family: PingFang SC;
  334. font-weight: 400;
  335. color: #949494;
  336. line-height: 30rpx;
  337. margin-top: 20rpx;
  338. }
  339. }
  340. .goods_prices{
  341. display: flex;
  342. flex-direction: column;
  343. justify-content: center;
  344. align-items: flex-end;
  345. .goods_price{
  346. text{
  347. display: inline-block;
  348. font-family: PingFang SC;
  349. font-weight: 500;
  350. color: #343434;
  351. line-height: 30rpx;
  352. }
  353. .unit{
  354. font-size: 24rpx;
  355. }
  356. .price_int{
  357. font-size: 32rpx;
  358. }
  359. .price_decimal{
  360. font-size: 24rpx;
  361. }
  362. }
  363. }
  364. .goods_num{
  365. font-size: 24rpx;
  366. font-family: PingFang SC;
  367. font-weight: 500;
  368. color: #2D2D2D;
  369. line-height: 30rpx;
  370. }
  371. .refund_btn{
  372. padding: 12rpx 15rpx;
  373. box-sizing: border-box;
  374. border: 1rpx solid #2D2D2D;
  375. border-radius: 25rpx;
  376. font-size: 26rpx;
  377. line-height: 26rpx;
  378. font-family: PingFang SC;
  379. font-weight: 400;
  380. color: #333333;
  381. margin-top: 22rpx;
  382. }
  383. }
  384. }
  385. }
  386. }
  387. .logistics_des{
  388. width: 100%;
  389. background-color: #FFFFFF;
  390. .logistics_pre{
  391. padding-right: 20rpx;
  392. height: 112rpx;
  393. box-sizing: border-box;
  394. display: flex;
  395. justify-content: space-between;
  396. align-items: center;
  397. margin-left: 20rpx;
  398. border-bottom: 1rpx solid #EDEDED;
  399. .logistics_pre_left{
  400. text:nth-child(1){
  401. font-size: 28rpx;
  402. font-family: PingFang SC;
  403. font-weight: 500;
  404. color: #FC1C1C;
  405. line-height: 45rpx;
  406. margin-right: 10rpx;
  407. }
  408. text:nth-child(2){
  409. font-size: 28rpx;
  410. font-family: PingFang SC;
  411. font-weight: 500;
  412. color: #333333;
  413. line-height: 45rpx;
  414. }
  415. }
  416. .logistics_pre_right{
  417. display: flex;
  418. align-items: center;
  419. text{
  420. font-size: 26rpx;
  421. font-family: PingFang SC;
  422. font-weight: 400;
  423. color: #999999;
  424. line-height: 45rpx;
  425. }
  426. input{
  427. font-size: 26rpx;
  428. font-family: PingFang SC;
  429. font-weight: 400;
  430. color: #999999;
  431. line-height: 45rpx;
  432. text-align: right;
  433. }
  434. image{
  435. width: 12rpx;
  436. height: 24rpx;
  437. margin-left: 15rpx;
  438. }
  439. }
  440. }
  441. .logistics_pre:nth-last-of-type(1){
  442. border-bottom: none;
  443. }
  444. }
  445. .submit_txt{
  446. width: 668rpx;
  447. height: 88rpx;
  448. background: #F30300;
  449. border-radius: 40px;
  450. font-size: 36rpx;
  451. font-family: PingFang SC;
  452. font-weight: 500;
  453. color: #FFFFFF;
  454. line-height: 88rpx;
  455. position: fixed;
  456. bottom: 40rpx;
  457. z-index: 10;
  458. margin: 0 41rpx;
  459. text-align: center;
  460. }
  461. }
  462. </style>