OrderReturn.vue 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523
  1. <template>
  2. <view class="order-out-box">
  3. <view class="order-status-tab">
  4. <view class="keyword-view clearfix">
  5. <view class="float_left">
  6. <u-search
  7. @clear="searchConfirm()"
  8. @search="searchConfirm()"
  9. :show-action="false"
  10. :clearabled="true"
  11. placeholder="订单编号/退货单号/商品名称"
  12. v-model="search_data.search"
  13. height="72"
  14. placeholder-color="#879BBA"
  15. color="#879BBA"
  16. bg-color="#ECF0F7"
  17. ></u-search>
  18. </view>
  19. <view class="float_right" @click="openSearch"><text class="custom-icon custom-icon-shaixuan"></text></view>
  20. </view>
  21. </view>
  22. <scroll-view
  23. scroll-y
  24. class="order_ul"
  25. @scrolltolower="scrollTolower"
  26. @refresherrefresh="refresherrefresh"
  27. :refresher-enabled="true"
  28. :refresher-triggered="refresher_triggered"
  29. >
  30. <view class="order_li" v-for="(item, index) in order_list" :key="index" @click="goPage(`/pagesT/order/ReturnDetail?id=` + item.id)">
  31. <view class="order_time clearfix">
  32. <view class="float_left">
  33. <view class="tag-circleRight">
  34. <image
  35. :src="
  36. item.inStatus === 4
  37. ? '../../static/img/ic-delivered.png'
  38. : item.inStatus === 5
  39. ? '../../static/img/ic-stock.png'
  40. : '../../static/img/ic-delivered.png'
  41. "
  42. class="img"
  43. ></image>
  44. </view>
  45. <text class="txt">{{ item.no }}</text>
  46. </view>
  47. </view>
  48. <view class="order_bottom">
  49. <view class="order_params">
  50. 客户名称
  51. <text class="right-txt">{{ item.customerName }}</text>
  52. </view>
  53. <view class="order_params clearfix">
  54. 退货时间
  55. <text class="right-txt">{{ $u.timeFormat(item.createTime, 'yyyy-mm-dd hh:MM:ss') }}</text>
  56. </view>
  57. <view class="order_params clearfix">
  58. 退货数量
  59. <text class="right-txt">{{ item.num }}</text>
  60. </view>
  61. </view>
  62. <view class="clearfix pay-status-tip" :class="[parseInt(item.auditStatus) === 2 ? 'pay-success' : parseInt(item.auditStatus) === 3 ? 'pay-danger' : 'pay-warning']">
  63. <text class="float_left ">
  64. <text class="txst">退货金额</text>
  65. <text class="money-text">{{ $utils.formattedNumber(item.returnTotalPrice) }}</text>
  66. </text>
  67. <view class="float_right txst">
  68. <text :class="[parseInt(item.auditStatus) === 2 ? 'primary-status' : parseInt(item.auditStatus) === 3 ? 'danger-status' : 'warning-status']">
  69. {{ parseInt(item.auditStatus) === 2 ? '已审核' : parseInt(item.auditStatus) === 3 ? '已驳回' : '未审核' }}
  70. </text>
  71. </view>
  72. </view>
  73. </view>
  74. <view v-if="!order_list.length" class="empty-view"><u-empty text="暂无订单" mode="order"></u-empty></view>
  75. <u-loadmore v-if="order_list.length" :status="load_status" />
  76. </scroll-view>
  77. <addBtn url="/pagesT/order/AddReturn"></addBtn>
  78. <u-popup v-model="search_show" mode="right">
  79. <view class="search-pop">
  80. <uniStatusBar></uniStatusBar>
  81. <view class="form-view" style="padding-top: 45px;">
  82. <u-form label-width="160rpx" label-position="left">
  83. <u-form-item label-position="top" label="退货日期">
  84. <view class="date-li">
  85. <picker mode="date" @change="bindDateStartChange">
  86. <text class="date-li">{{ search_data.start ? $u.timeFormat(search_data.start, 'yyyy-mm-dd') : '开始日期' }}</text>
  87. </picker>
  88. </view>
  89. <view class="date-line">-</view>
  90. <view class="date-li">
  91. <picker mode="date" @change="bindDateEndChange">
  92. <text class="date-li">{{ search_data.end ? $u.timeFormat(search_data.end, 'yyyy-mm-dd') : '结束日期' }}</text>
  93. </picker>
  94. </view>
  95. </u-form-item>
  96. <u-form-item label="所属店铺">
  97. <view class="clearfix form-val" @click="goPage('/pagesT/shop/selShop')">
  98. <text class="float_left ellipsis">{{ search_data.shopId ? search_data.shopName : '请选择' }}</text>
  99. <view class="float_right" @click.stop="clearValue('shopId')">
  100. <u-icon :name="!search_data.shopId ? 'arrow-right' : 'close-circle-fill'" size="28" color="#999999"></u-icon>
  101. </view>
  102. </view>
  103. </u-form-item>
  104. <u-form-item label-position="top" label="审核状态">
  105. <text
  106. v-for="(item, index) in order_status"
  107. :key="index"
  108. class="check-li"
  109. :class="[search_data.auditStatus === item.value ? 'active' : '']"
  110. @click="statusChange(item)"
  111. >
  112. {{ item.label }}
  113. </text>
  114. </u-form-item>
  115. <u-form-item label-position="top" label="入库状态">
  116. <text
  117. v-for="(item, index) in single_status"
  118. :key="index"
  119. class="check-li"
  120. @click="stockChange(item)"
  121. :class="[search_data.inStatus === item.value ? 'active' : '']"
  122. >
  123. {{ item.label }}
  124. </text>
  125. </u-form-item>
  126. <u-form-item label="业务员">
  127. <view class="clearfix form-val" @click="goPage('/pagesT/staff/selStaff')">
  128. <text class="float_left ellipsis">{{ search_data.operatorId ? search_data.operatorName : '请选择' }}</text>
  129. <view class="float_right" @click.stop="clearValue('operatorId')">
  130. <u-icon :name="!search_data.operatorId ? 'arrow-right' : 'close-circle-fill'" size="28" color="#999999"></u-icon>
  131. </view>
  132. </view>
  133. </u-form-item>
  134. </u-form>
  135. </view>
  136. <view class="search-btn">
  137. <view class="btn-li" @click="clearValue()">重置</view>
  138. <view class="btn-li" @click="searchConfirm">确定</view>
  139. </view>
  140. </view>
  141. </u-popup>
  142. </view>
  143. </template>
  144. <script>
  145. import uniStatusBar from '../../components/uni-status-bar.vue';
  146. export default {
  147. components: {
  148. uniStatusBar
  149. },
  150. props: {
  151. shopData: {
  152. type: [Object, String],
  153. default: ''
  154. },
  155. staffData: {
  156. type: [Object, String],
  157. default: ''
  158. }
  159. },
  160. data() {
  161. return {
  162. refresher_triggered: false, //设置当前下拉刷新状态,true 表示下拉刷新已经被触发,false 表示下拉刷新未被触发
  163. order_status: [{ value: 2, label: '已审核' }, { value: 1, label: '待审核' }],
  164. single_status: [{ value: 4, label: '未入库' }, { value: 5, label: '已入库' }],
  165. search_show: false,
  166. pay_type_list: [],
  167. pay_index: 0,
  168. load_status: 'nomore',
  169. page: 1,
  170. pageSize: 10,
  171. total: 0,
  172. tab_current: 0, // 页面current 0,订单,1,退货单
  173. order_state: 'all', // 订单状态
  174. order_list: [], // 订单列表
  175. search_data: {
  176. inStatus: '', //入库状态
  177. shopId: '', // 店铺
  178. shopName: '',
  179. operatorId: '', //员工
  180. operatorName: '',
  181. auditStatus: '', // 审核状态
  182. start: '',
  183. end: '',
  184. search: '' //关键词
  185. }
  186. };
  187. },
  188. created() {
  189. this.getAllOrderReturn();
  190. },
  191. watch: {
  192. // 店铺
  193. shopData(val) {
  194. if (val) {
  195. this.search_data.shopName = val.name;
  196. this.search_data.shopId = val.id;
  197. }
  198. },
  199. // 业务员
  200. staffData(val) {
  201. if (val) {
  202. this.search_data.operatorName = val.staffName;
  203. this.search_data.operatorId = val.id;
  204. }
  205. }
  206. },
  207. methods: {
  208. // 打开搜索弹窗
  209. openSearch() {
  210. this.search_show = true;
  211. },
  212. // 上拉加载
  213. scrollTolower() {
  214. if (this.total / this.pageSize > this.page) {
  215. this.page += 1;
  216. this.getData();
  217. }
  218. },
  219. // 复制
  220. copy(no) {
  221. uni.setClipboardData({
  222. data: no,
  223. success: res => {
  224. uni.showToast({
  225. title: '复制成功',
  226. icon: 'none',
  227. duration: 2000
  228. });
  229. }
  230. });
  231. },
  232. // 审核状态切换
  233. statusChange(row) {
  234. this.search_data.auditStatus = row.value;
  235. },
  236. // 入库状态切换
  237. stockChange(row) {
  238. this.search_data.inStatus = row.value;
  239. },
  240. // 搜索确定
  241. searchConfirm() {
  242. this.search_show = false;
  243. this.page = 1;
  244. this.getData();
  245. },
  246. // 重置搜索
  247. clearValue(params) {
  248. if (!params) {
  249. this.search_data = {
  250. inStatus: '', //入库状态
  251. shopId: '', // 店铺
  252. shopName: '',
  253. operatorId: '', //员工
  254. operatorName: '',
  255. auditStatus: '', // 审核状态
  256. start: '',
  257. end: '',
  258. search: '' //关键词
  259. };
  260. this.searchConfirm();
  261. } else {
  262. this.search_data[params] = '';
  263. }
  264. },
  265. getData() {
  266. const obj = {
  267. inStatus: this.search_data.inStatus, //入库状态
  268. shopId: this.search_data.shopId, // 店铺
  269. operatorId: this.search_data.operatorId, //员工
  270. auditStatus: this.search_data.auditStatus, // 审核状态
  271. start: this.search_data.start,
  272. end: this.search_data.end,
  273. search: this.search_data.search //关键词
  274. };
  275. const isKey = this.$utils.isSerch(obj);
  276. if (isKey) {
  277. this.searchAllOrderOut(obj);
  278. } else {
  279. this.getAllOrderReturn();
  280. }
  281. },
  282. // 退货订单列表搜索
  283. searchAllOrderOut(obj) {
  284. this.load_status = 'loading';
  285. let params = {
  286. page: this.page,
  287. pageSize: this.pageSize,
  288. ...obj
  289. };
  290. this.$u.api
  291. .searchAllOrderOut(params)
  292. .then(res => {
  293. // 设置当前下拉刷新状态为false
  294. this.refresher_triggered = false;
  295. if (this.page === 1) {
  296. this.order_list = res.data;
  297. } else {
  298. this.order_list = this.order_list.concat(res.data);
  299. }
  300. this.order_list = this.order_list.map(item => {
  301. return {
  302. ...item,
  303. goods_list: item.goods_list || []
  304. };
  305. });
  306. this.total = res.pageTotal;
  307. this.load_status = this.$utils.loadStatus(this.page, this.pageSize, this.total);
  308. })
  309. .catch(err => {
  310. // 设置当前下拉刷新状态为false
  311. this.refresher_triggered = false;
  312. });
  313. },
  314. // 退货订单列表
  315. getAllOrderReturn() {
  316. this.load_status = 'loading';
  317. let params = {
  318. page: this.page,
  319. pageSize: this.pageSize
  320. };
  321. this.$u.api
  322. .getAllOrderReturn(params)
  323. .then(res => {
  324. // 设置当前下拉刷新状态为false
  325. this.refresher_triggered = false;
  326. if (this.page === 1) {
  327. this.order_list = res.data;
  328. } else {
  329. this.order_list = this.order_list.concat(res.data);
  330. }
  331. this.order_list = this.order_list.map(item => {
  332. return {
  333. ...item,
  334. goods_list: item.goods_list || []
  335. };
  336. });
  337. this.total = res.pageTotal;
  338. this.load_status = this.$utils.loadStatus(this.page, this.pageSize, this.total);
  339. })
  340. .catch(err => {
  341. // 设置当前下拉刷新状态为false
  342. this.refresher_triggered = false;
  343. });
  344. },
  345. bindDateStartChange(e) {
  346. this.search_data.start = this.$utils.timeByTimestamp(e.detail.value + ' 00:00:00');
  347. },
  348. bindDateEndChange(e) {
  349. this.search_data.end = this.$utils.timeByTimestamp(e.detail.value + ' 23:59:59');
  350. },
  351. // 下拉刷新
  352. refresherrefresh() {
  353. this.refresher_triggered = true;
  354. this.page = 1;
  355. this.getData();
  356. }
  357. }
  358. };
  359. </script>
  360. <style lang="scss" scoped>
  361. .order-out-box {
  362. .order-status-tab {
  363. width: 100%;
  364. .keyword-view {
  365. padding: 20rpx 24rpx;
  366. background-color: #ffffff;
  367. .float_left {
  368. width: 640rpx;
  369. }
  370. .float_right {
  371. line-height: 64rpx;
  372. width: 50rpx;
  373. text-align: center;
  374. color: #666666;
  375. }
  376. }
  377. }
  378. }
  379. .order_ul {
  380. height: calc(90vh - 226rpx);
  381. padding-top: 24rpx;
  382. .order_li {
  383. background-color: #ffffff;
  384. padding-top: 32rpx;
  385. border-radius: 8rpx;
  386. margin: 0 auto 24rpx;
  387. width: 710rpx;
  388. .money-text {
  389. font-family: DIN-Medium;
  390. color: $uni-color-error;
  391. margin: 0 4rpx;
  392. font-size: 28rpx;
  393. font-weight: 500;
  394. margin-left: 30rpx;
  395. }
  396. .order_time {
  397. height: 40rpx;
  398. line-height: 40rpx;
  399. padding-right: 20rpx;
  400. margin-bottom: 24rpx;
  401. .tag-circleRight {
  402. display: inline-block;
  403. margin-left: 40rpx;
  404. vertical-align: middle;
  405. .img {
  406. width: 126rpx;
  407. height: 40rpx;
  408. display: block;
  409. }
  410. }
  411. .txt {
  412. font-size: 28rpx;
  413. font-weight: 500;
  414. margin-left: 16rpx;
  415. font-family: DIN-Medium;
  416. }
  417. }
  418. .order_info {
  419. padding: 30rpx;
  420. font-size: 24rpx;
  421. border-bottom: 1px solid #f7f8fa;
  422. }
  423. .remarks {
  424. background-color: #f1f1f1;
  425. padding: 0 30rpx;
  426. height: 60rpx;
  427. line-height: 60rpx;
  428. }
  429. .pay-status-tip {
  430. margin-left: 0rpx;
  431. color: #333333;
  432. height: 89rpx;
  433. vertical-align: middle;
  434. padding: 25rpx 40rpx;
  435. font-size: 28rpx;
  436. font-weight: 400;
  437. background: linear-gradient(270deg, rgba(255, 255, 255, 0) 0%, rgba(0, 195, 149, 0.1) 100%);
  438. .txst {
  439. font-size: 28rpx;
  440. font-weight: 500;
  441. color: #2d405e;
  442. }
  443. }
  444. .pay-success {
  445. background: linear-gradient(270deg, rgba(255, 255, 255, 0) 0%, rgba(0, 195, 149, 0.1) 100%);
  446. }
  447. .pay-danger {
  448. background: linear-gradient(270deg, rgba(255, 255, 255, 0) 0%, rgba(246, 119, 120, 0.1) 100%);
  449. }
  450. .pay-warning {
  451. background: linear-gradient(270deg, rgba(255, 255, 255, 0) 0%, #fdf6e8 100%);
  452. }
  453. .order_bottom {
  454. margin-left: 40rpx;
  455. font-size: 28rpx;
  456. .order_params {
  457. margin-bottom: 24rpx;
  458. color: #999999;
  459. .right-txt {
  460. font-size: 28rpx;
  461. font-weight: 400;
  462. color: #2d405e;
  463. margin-left: 30rpx;
  464. }
  465. .float_right {
  466. color: #333333;
  467. }
  468. }
  469. .printing-btn {
  470. position: absolute;
  471. right: 30rpx;
  472. top: 50%;
  473. transform: translateY(-50%);
  474. text-align: center;
  475. .custom-icon-dayin {
  476. font-size: 30rpx;
  477. }
  478. }
  479. .btn {
  480. display: flex;
  481. justify-content: center;
  482. margin-top: 30rpx;
  483. .btn_some {
  484. width: 200rpx;
  485. height: 70rpx;
  486. line-height: 70rpx;
  487. text-align: center;
  488. border-radius: 6rpx;
  489. }
  490. .btn_examine {
  491. border: 1px solid #2979ff;
  492. color: #2979ff;
  493. }
  494. .btn_order {
  495. border: 1px solid #999999;
  496. color: #999999;
  497. margin-left: 30rpx;
  498. }
  499. }
  500. }
  501. }
  502. }
  503. </style>