customOrder.vue 8.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322
  1. <template>
  2. <div class="app-main app-content">
  3. <!-- 时间筛选:默认近30天,与订单列表 order.vue 同一 DateSelect 组件 -->
  4. <view class="input-wrap_box">
  5. <view class="select-dn_bx">
  6. <DateSelect ref="dateSelectRef" class="bar" top="0" @selectDateFn="selectDateFn" defaultShowName="近30天" />
  7. </view>
  8. </view>
  9. <div class="list-wrap">
  10. <block v-if="!$util.isEmpty(list.data)">
  11. <div class="list" v-for="(item, index) in list.data" :key="index">
  12. <div v-if="!$util.isEmpty(item.orderInfo)">
  13. <OrderItem :item="item.orderInfo" @listendUpdateFiled="onUpdateItemField"></OrderItem>
  14. </div>
  15. <div v-else>
  16. <OrderItem :ref="`orderRef${item.id}`" :item="item" @listendUpdateFiled="onUpdateItemField" @directFh="directFh" @fillNoFh="fillNoFh" :moreOrderRemind="false"></OrderItem>
  17. </div>
  18. </div>
  19. </block>
  20. <block v-else>
  21. <app-wrapper-empty title="暂无数据" :is-empty="$util.isEmpty(list.data)" />
  22. </block>
  23. </div>
  24. <view class="bottom-bar-view" v-if="!$util.isEmpty(ids)">
  25. <view class="bar-content">
  26. <button class="admin-button-com big blue" @click="batchFh()">全部发货</button>
  27. <button class="admin-button-com big blue" style="margin-left: 50upx;" @click="batchPrint()">合并打印</button>
  28. </view>
  29. </view>
  30. <modal-module :show="fhLabelShow" @click="fhConfirm" :maskClosable="true" title="物流信息" padding="30rpx 30rpx" >
  31. <template v-slot:content>
  32. <div class="app-modal-input-wrap">
  33. <div class="inp-list-line">
  34. <div class="line-label">物流名称</div>
  35. <div class="line-input">
  36. <input type="text" v-model="fhWl" @focus="fhWl=''" class="inp-input" />
  37. </div>
  38. </div>
  39. <div class="inp-list-line">
  40. <div class="line-label">物流单号</div>
  41. <div class="line-input">
  42. <input type="text" v-model="fhWlNo" :focus="fhWlFocus" @focus="fhWlNo=''" class="inp-input" />
  43. </div>
  44. </div>
  45. </div>
  46. </template>
  47. </modal-module>
  48. </div>
  49. </template>
  50. <script>
  51. import AppWrapperEmpty from "@/components/app-wrapper-empty";
  52. import ModalModule from "@/components/plugin/modal";
  53. import DateSelect from "@/components/module/dateSelect";
  54. import { list } from "@/mixins";
  55. import { mapGetters } from "vuex";
  56. import orderMixin from "@/mixins/order";
  57. import OrderItem from "../home/components/OrderItem"
  58. import { getListB,mergePrintFn,allFhAction,orderFh} from "@/api/order";
  59. export default {
  60. name: "customOrder",
  61. components: {
  62. AppWrapperEmpty,
  63. ModalModule,
  64. DateSelect,
  65. OrderItem,
  66. },
  67. mixins: [list,orderMixin],
  68. computed: { ...mapGetters(["getLoginInfo", "getDictionariesInfo"]) },
  69. data() {
  70. return {
  71. ids:'',
  72. fhWlInfo:[],
  73. fhWlNo:'',
  74. fhWl:'顺丰',
  75. fhWlFocus:false,
  76. fhLabelShow:false,
  77. // 默认近30天,与订单列表一致,避免一次加载客户全量历史订单
  78. searchTime: 'last30Days',
  79. startTime: '',
  80. endTime: '',
  81. }
  82. },
  83. onPullDownRefresh() {
  84. this.resetList();
  85. this.getOrderList().then((res) => {
  86. uni.stopPullDownRefresh();
  87. });
  88. },
  89. onReachBottom() {
  90. if (!this.list.finished) {
  91. this.getOrderList().then((res) => {
  92. uni.stopPullDownRefresh();
  93. });
  94. } else {
  95. uni.stopPullDownRefresh();
  96. }
  97. },
  98. onLoad() {
  99. this.getOrderList()
  100. //返回上一页时不需要刷新
  101. let pages = getCurrentPages();
  102. let prevPage = pages[ pages.length - 2 ];
  103. prevPage.$vm.fromDetail = {status:1}
  104. this.ids = this.option.ids?this.option.ids:''
  105. },
  106. methods: {
  107. //这个有多处要同步修改,关键词:fh_express_pop
  108. fillNoFh(info){
  109. let that = this
  110. this.fhLabelShow = true
  111. this.fhWlInfo = info
  112. setTimeout(x => {
  113. this.$nextTick(() => {
  114. that.fhWlFocus = true
  115. })
  116. }, 200)
  117. },
  118. fhConfirm(val){
  119. let that = this
  120. if (val.index == 0) {
  121. that.fhLabelShow = false
  122. that.fhWlFocus = false
  123. that.fhWlNo = ''
  124. return
  125. }
  126. if (this.$util.isEmpty(this.fhWl)){
  127. that.$msg('请填写物流名称')
  128. return false
  129. }
  130. if (this.$util.isEmpty(this.fhWlNo)){
  131. that.$msg('请填写物流单号')
  132. return false
  133. }
  134. let id = that.fhWlInfo.id ? that.fhWlInfo.id : 0
  135. that.$util.confirmModal({content:'确认发货?'},() => {
  136. orderFh({id:id,fhType:1,fhWl:that.fhWl,fhWlNo:that.fhWlNo}).then(res=>{
  137. if(res.code == 1){
  138. that.$refs[`orderRef${id}`][0].currentStatus = 3
  139. that.fhLabelShow = false
  140. that.fhWlFocus = false
  141. that.fhWlNo = ''
  142. that.$msg('发货成功')
  143. }
  144. })
  145. })
  146. },
  147. init(){
  148. },
  149. directFh(info){
  150. let that = this
  151. that.$util.confirmModal({content:'确认发货?'},() => {
  152. orderFh({id:info.id,fhType:0}).then(res=>{
  153. if(res.code == 1){
  154. that.$refs[`orderRef${info.id}`][0].currentStatus = 3
  155. that.$msg('发货成功')
  156. }
  157. })
  158. })
  159. },
  160. batchFh(){
  161. let that = this
  162. if(this.$util.isEmpty(this.option.ids)){
  163. this.$msg('没有订单')
  164. }
  165. let mergeId = this.option.mergeId?this.option.mergeId:0
  166. that.$util.confirmModal({content:'确认全部发货?'},() => {
  167. allFhAction({mergeId:mergeId}).then(res=>{
  168. if(res.code == 1){
  169. that.$msg('操作成功')
  170. that.resetList()
  171. that.getOrderList()
  172. }
  173. })
  174. })
  175. },
  176. batchPrint(){
  177. let that = this
  178. if(this.$util.isEmpty(this.option.ids)){
  179. this.$msg('没有订单')
  180. }
  181. let mergeId = this.option.mergeId?this.option.mergeId:0
  182. that.$util.confirmModal({content:'确认合并打印?'},() => {
  183. mergePrintFn({mergeId:mergeId}).then(res=>{
  184. if(res.code == 1){
  185. that.$msg('打印成功')
  186. }
  187. })
  188. })
  189. },
  190. /**
  191. * DateSelect 选中日期后刷新列表
  192. * @param {Object} val - { searchTime, startTime, endTime }
  193. */
  194. selectDateFn(val) {
  195. this.searchTime = val.searchTime || ''
  196. this.startTime = val.startTime || ''
  197. this.endTime = val.endTime || ''
  198. this.resetList()
  199. this.getOrderList()
  200. },
  201. /** 按客户 + 时间范围拉取订单列表 */
  202. getOrderList() {
  203. return getListB({
  204. page: this.list.page,
  205. customId: this.option.customId,
  206. searchTime: this.searchTime,
  207. startTime: this.startTime,
  208. endTime: this.endTime,
  209. }).then((res) => {
  210. this.completes(res)
  211. })
  212. }
  213. },
  214. };
  215. </script>
  216. <style lang="scss" scoped>
  217. page{
  218. width: 750upx;
  219. overflow: hidden;
  220. }
  221. .app-content {
  222. width: 100%;
  223. padding-bottom: 160upx;
  224. overflow: hidden;
  225. .select-dn_bx {
  226. padding-left: 18upx;
  227. }
  228. .app-tabs {
  229. position: fixed;
  230. width: 100%;
  231. z-index: 9;
  232. }
  233. .input-wrap_box {
  234. background-color: #fff;
  235. position: fixed;
  236. top: 0;
  237. z-index: 10;
  238. width: 100%;
  239. height: 100upx;
  240. display: flex;
  241. align-items: center;
  242. padding: 0 30upx;
  243. & > view:nth-child(2) {
  244. flex: 1;
  245. }
  246. }
  247. .list-wrap {
  248. // 为顶部固定时间筛选栏留出空间
  249. padding-top: 100upx;
  250. .list {
  251. background-color: #fff;
  252. margin-bottom: 20upx;
  253. }
  254. }
  255. }
  256. .upload-confirm-wrap {
  257. max-height: 600upx;
  258. overflow-y: auto;
  259. .modal-tit {
  260. @include disFlex(center, center);
  261. font-size: 40upx;
  262. margin-top: 30upx;
  263. margin-bottom: 50upx;
  264. .iconfont {
  265. color: #09bb07;
  266. margin-right: 20upx;
  267. font-size: 50upx;
  268. }
  269. }
  270. .sel-wrap {
  271. color: $fontColor2;
  272. font-size: 32upx;
  273. .sel-tit {
  274. text-align: left;
  275. }
  276. .sel-btn {
  277. @include disFlex(center, flex-start);
  278. flex-wrap: wrap;
  279. padding: 10upx 0 40upx;
  280. }
  281. }
  282. }
  283. // 按钮
  284. .bottom-bar-view {
  285. position: fixed;
  286. left: 0;
  287. right: 0;
  288. bottom: 0;
  289. z-index: 9999;
  290. width: 100%;
  291. background-color: #FFFFFF;
  292. border-top: 1upx solid #eee;
  293. box-shadow: 0upx -1upx 6upx 0upx rgba(4, 0, 0, 0.06);
  294. /* #ifdef MP-WEIXIN */
  295. padding-bottom: constant(safe-area-inset-bottom); /* iOS 11.2- */
  296. padding-bottom: env(safe-area-inset-bottom); /* iOS 11.2+ */
  297. /* #endif */
  298. /* #ifdef APP-PLUS */
  299. padding-bottom: constant(safe-area-inset-bottom); /* iOS 11.2- */
  300. padding-bottom: env(safe-area-inset-bottom); /* iOS 11.2+ */
  301. /* #endif */
  302. .bar-content {
  303. width: 100%;
  304. display: flex;
  305. justify-content: center;
  306. align-items: center;
  307. padding: 10upx 40upx;
  308. }
  309. }
  310. </style>