index.vue 6.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266
  1. <template>
  2. <view class="picking-task-page">
  3. <u-navbar height="40px" title="拣货任务" bgColor="#F0F6FB" autoBack placeholder>
  4. <view class="u-nav-slot btn-right" slot="right" @click="stashClick">
  5. <view class="cang-name">{{cangName}}</view>
  6. <u-icon name="arrow-down-fill" color="#999999" size="12"></u-icon>
  7. </view>
  8. </u-navbar>
  9. <view class="container_main">
  10. <u-sticky :offsetTop="offsetTop" bgColor="#F0F6FB">
  11. <view class="search-box">
  12. <u-search placeholder="请输入单据编号" bgColor="#fff" shape="square" v-model="params.number" :showAction="false" @search="searchClick" @clear="searchClick"></u-search>
  13. <view class="flex_box">
  14. <view class="scan-text">扫描单据二维码</view>
  15. <view class="scan-icon">
  16. <image src="@/static/image/scan-icon.png" mode=""></image>
  17. </view>
  18. </view>
  19. </view>
  20. <view class="type-box flex_box">
  21. <view class="type-item" @click="tabClick(1)">
  22. <view class="type-val">{{type1}}</view>
  23. <u-icon name="arrow-down-fill" color="#999999" size="12"></u-icon>
  24. </view>
  25. <view class="type-item" @click="tabClick(2)">
  26. <view class="type-val">{{type2}}</view>
  27. <u-icon name="arrow-down-fill" color="#999999" size="12"></u-icon>
  28. </view>
  29. </view>
  30. </u-sticky>
  31. <view class="task-cont">
  32. <block v-for="(item,i) in taskList" :key="i">
  33. <task-item :item="item" @toStorage="toStorage" @toDetail="toDetail"></task-item>
  34. </block>
  35. <u-empty mode="data" v-if="taskList.length == 0"></u-empty>
  36. </view>
  37. </view>
  38. <!-- 中心仓弹窗 -->
  39. <u-picker :show="stashShow" :defaultIndex="defaultIndex" :columns="stashColumns" @confirm="pickerConfirm" @cancel="stashShow= false"></u-picker>
  40. <!-- 状态 -->
  41. <u-picker :show="statusShow" keyName="name" :defaultIndex="defaultIndex2" :columns="statusColumns" @confirm="statusConfirm" @cancel="statusShow= false"></u-picker>
  42. <!-- 月份 -->
  43. <u-picker :show="dateShow" :defaultIndex="defaultIndex3" :columns="dateColumns" @confirm="dateConfirm" @cancel="dateShow= false"></u-picker>
  44. </view>
  45. </template>
  46. <script>
  47. import taskItem from '@/components/task-item/task-item.vue'
  48. import {saleOrder} from '@/common/request/apis/picking'
  49. import {orderStartHandle} from '@/common/request/apis/purchase'
  50. export default{
  51. components:{
  52. taskItem
  53. },
  54. data() {
  55. return {
  56. offsetTop:0,
  57. cangName:'鹏越中心仓',
  58. type1:'全部',
  59. type2:'月份',
  60. stashShow:false,
  61. statusShow:false,
  62. dateShow:false,
  63. stashColumns:[
  64. ['鹏越中心仓','美团中心仓']
  65. ],
  66. statusColumns:[
  67. [{
  68. name:'全部',
  69. id:''
  70. },{
  71. name:'待拣货',
  72. id:'1'
  73. },{
  74. name:'拣货中',
  75. id:'4'
  76. },{
  77. name:'已拣货',
  78. id:'2'
  79. }]
  80. ],
  81. dateColumns:[
  82. ['全年','一月','二月','三月','四月','五月','六月','七月','八月','九月','十月','十一月','十二月']
  83. ],
  84. defaultIndex:[],
  85. defaultIndex2:[],
  86. defaultIndex3:[],
  87. taskList:[],
  88. params:{
  89. beginTime:'',
  90. endTime:'',
  91. number:'',
  92. status:'',
  93. pageNum:1,
  94. pageSize:10
  95. }
  96. }
  97. },
  98. onLoad() {
  99. let systemInfo = uni.getSystemInfoSync();
  100. let statusBarHeight = systemInfo.statusBarHeight;
  101. this.offsetTop = statusBarHeight + 40
  102. this.init()
  103. },
  104. methods:{
  105. init() {
  106. uni.showLoading()
  107. this.params.pageNum = 1
  108. this.getSaleOrder()
  109. },
  110. searchClick() {
  111. this.init()
  112. },
  113. tabClick(type) {
  114. if(type == 1) {
  115. this.defaultIndex = this.getDefaultIndex(this.type1,this.statusColumns)
  116. this.statusShow = true
  117. }else {
  118. this.defaultIndex = this.getDefaultIndex(this.type2,this.dateColumns)
  119. this.dateShow = true
  120. }
  121. },
  122. getSaleOrder() {
  123. saleOrder(this.params)
  124. .then(res=>{
  125. if(res.code == 200) {
  126. this.taskList = res.data.rows;
  127. }
  128. uni.hideLoading()
  129. })
  130. .catch(err=>{
  131. uni.hideLoading()
  132. })
  133. },
  134. stashClick() {
  135. this.defaultIndex = this.getDefaultIndex(this.cangName,this.stashColumns)
  136. this.stashShow = true
  137. },
  138. pickerConfirm(val) {
  139. this.cangName = val.value[0]
  140. this.stashShow = false
  141. },
  142. statusConfirm(val) {
  143. this.type1 = val.value[0].name
  144. this.params.status = val.value[0].id
  145. this.statusShow = false
  146. this.init()
  147. },
  148. dateConfirm(val) {
  149. this.type2 = val.value[0]
  150. this.dateShow = false
  151. let month = val.indexs[0]
  152. this.getLastDayOfMonth(month)
  153. this.init()
  154. },
  155. // 获取开始时间、结束时间
  156. getLastDayOfMonth(month) {
  157. let year = new Date().getFullYear()
  158. if(month !=0) {
  159. let monthStart = new Date(year, month, 0).getDate();
  160. this.params.beginTime = `${year}-${month}-01`
  161. this.params.endTime = `${year}-${month}-${monthStart}`
  162. }else {
  163. this.params.beginTime = ''
  164. this.params.endTime = ''
  165. }
  166. },
  167. // 获取picker默认index
  168. getDefaultIndex(val,list) {
  169. let arr = []
  170. let index = list[0].findIndex(item=>item.name == val)
  171. arr = [index]
  172. return arr
  173. },
  174. // 点击操作
  175. toOrderStartHandle(id) {
  176. orderStartHandle(id)
  177. .then(res=>{
  178. if(res.code == 200) {
  179. uni.navigateTo({
  180. url:'/pages/picking-task/delivery'
  181. })
  182. }
  183. })
  184. },
  185. // 出库
  186. toStorage(val) {
  187. this.toOrderStartHandle(val.id)
  188. },
  189. toDetail(val) {
  190. uni.navigateTo({
  191. url:`/pages/picking-task/detail?id=${val.id}`
  192. })
  193. }
  194. }
  195. }
  196. </script>
  197. <style lang="scss" scoped>
  198. .btn-right {
  199. display: flex;
  200. align-items: center;
  201. .cang-name {
  202. color: #0256FF;
  203. text-align: center;
  204. font-family: "PingFang SC";
  205. font-size: 28rpx;
  206. font-weight: 600;
  207. margin-right: 10rpx;
  208. }
  209. }
  210. .picking-task-page {
  211. min-height: 100vh;
  212. background: #F0F6FB;
  213. .container_main {
  214. .search-box {
  215. display: flex;
  216. align-items: center;
  217. padding: 0 32rpx;
  218. .scan-text {
  219. color: #333;
  220. font-family: "PingFang SC";
  221. font-size: 24rpx;
  222. font-weight: 400;
  223. margin-right: 20rpx;
  224. margin-left: 30rpx;
  225. }
  226. .scan-icon {
  227. width: 36rpx;
  228. height: 36rpx;
  229. background-color: #fff;
  230. border-radius: 50%;
  231. display: flex;
  232. align-items: center;
  233. justify-content: center;
  234. image {
  235. width: 24rpx;
  236. height: 24rpx;
  237. }
  238. }
  239. }
  240. .type-box {
  241. .type-item {
  242. width: 50%;
  243. height: 88rpx;
  244. display: flex;
  245. align-items: center;
  246. justify-content: center;
  247. .type-val {
  248. color: #000;
  249. font-family: "PingFang SC";
  250. font-size: 28rpx;
  251. font-weight: 400;
  252. margin-right: 10rpx;
  253. }
  254. }
  255. }
  256. .task-cont {
  257. padding: 0 24rpx;
  258. }
  259. }
  260. }
  261. </style>