itemOrder.vue 7.6 KB

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