index.vue 7.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287
  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" @click="scanCode">
  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. var main, receiver, filter;
  48. var _codeQueryTag = false;
  49. import taskItem from '@/components/task-item/task-item.vue'
  50. import {saleOrder} from '@/common/request/apis/picking'
  51. import {orderStartHandle} from '@/common/request/apis/purchase'
  52. export default{
  53. components:{
  54. taskItem
  55. },
  56. data() {
  57. return {
  58. offsetTop:0,
  59. cangName:'鹏越中心仓',
  60. type1:'全部',
  61. type2:'月份',
  62. stashShow:false,
  63. statusShow:false,
  64. dateShow:false,
  65. stashColumns:[
  66. ['鹏越中心仓','美团中心仓']
  67. ],
  68. statusColumns:[
  69. [{
  70. name:'全部',
  71. id:''
  72. },{
  73. name:'待拣货',
  74. id:'1'
  75. },{
  76. name:'拣货中',
  77. id:'4'
  78. },{
  79. name:'已拣货',
  80. id:'2'
  81. }]
  82. ],
  83. dateColumns:[
  84. ['全年','一月','二月','三月','四月','五月','六月','七月','八月','九月','十月','十一月','十二月']
  85. ],
  86. defaultIndex:[],
  87. defaultIndex2:[],
  88. defaultIndex3:[],
  89. taskList:[],
  90. params:{
  91. beginTime:'',
  92. endTime:'',
  93. number:'',
  94. status:'',
  95. pageNum:1,
  96. pageSize:10
  97. }
  98. }
  99. },
  100. onLoad() {
  101. let systemInfo = uni.getSystemInfoSync();
  102. let statusBarHeight = systemInfo.statusBarHeight;
  103. this.offsetTop = statusBarHeight + 40
  104. this.init()
  105. },
  106. onHide() {
  107. uni.$off('scanFinish')
  108. },
  109. onUnload() {
  110. uni.$off('scanFinish')
  111. },
  112. onShow() {
  113. uni.$on('scanFinish',(data)=>{
  114. this.params.number = data
  115. this.init()
  116. })
  117. if(uni.getStorageSync('orderRefresh')) {
  118. this.init()
  119. uni.removeStorageSync('orderRefresh')
  120. }
  121. },
  122. methods:{
  123. scanCode() {
  124. this.$scan.scanCode()
  125. },
  126. init() {
  127. uni.showLoading()
  128. this.params.pageNum = 1
  129. this.getSaleOrder()
  130. },
  131. searchClick() {
  132. this.init()
  133. },
  134. tabClick(type) {
  135. if(type == 1) {
  136. this.defaultIndex = this.getDefaultIndex(this.type1,this.statusColumns)
  137. this.statusShow = true
  138. }else {
  139. this.defaultIndex = this.getDefaultIndex(this.type2,this.dateColumns)
  140. this.dateShow = true
  141. }
  142. },
  143. getSaleOrder() {
  144. saleOrder(this.params)
  145. .then(res=>{
  146. if(res.code == 200) {
  147. this.taskList = res.data.rows;
  148. }
  149. uni.hideLoading()
  150. })
  151. .catch(err=>{
  152. uni.hideLoading()
  153. })
  154. },
  155. stashClick() {
  156. this.defaultIndex = this.getDefaultIndex(this.cangName,this.stashColumns)
  157. this.stashShow = true
  158. },
  159. pickerConfirm(val) {
  160. this.cangName = val.value[0]
  161. this.stashShow = false
  162. },
  163. statusConfirm(val) {
  164. this.type1 = val.value[0].name
  165. this.params.status = val.value[0].id
  166. this.statusShow = false
  167. this.init()
  168. },
  169. dateConfirm(val) {
  170. this.type2 = val.value[0]
  171. this.dateShow = false
  172. let month = val.indexs[0]
  173. this.getLastDayOfMonth(month)
  174. this.init()
  175. },
  176. // 获取开始时间、结束时间
  177. getLastDayOfMonth(month) {
  178. let year = new Date().getFullYear()
  179. if(month !=0) {
  180. let monthStart = new Date(year, month, 0).getDate();
  181. this.params.beginTime = `${year}-${month}-01`
  182. this.params.endTime = `${year}-${month}-${monthStart}`
  183. }else {
  184. this.params.beginTime = ''
  185. this.params.endTime = ''
  186. }
  187. },
  188. // 获取picker默认index
  189. getDefaultIndex(val,list) {
  190. let arr = []
  191. let index = list[0].findIndex(item=>item.name == val)
  192. arr = [index]
  193. return arr
  194. },
  195. // 点击操作
  196. toOrderStartHandle(id) {
  197. orderStartHandle(id)
  198. .then(res=>{
  199. if(res.code == 200) {
  200. uni.navigateTo({
  201. url:`/pages/picking-task/delivery?id=${id}`
  202. })
  203. }
  204. })
  205. },
  206. // 出库
  207. toStorage(val) {
  208. this.toOrderStartHandle(val.id)
  209. },
  210. toDetail(val) {
  211. uni.navigateTo({
  212. url:`/pages/picking-task/detail?id=${val.id}`
  213. })
  214. }
  215. }
  216. }
  217. </script>
  218. <style lang="scss" scoped>
  219. .btn-right {
  220. display: flex;
  221. align-items: center;
  222. .cang-name {
  223. color: #0256FF;
  224. text-align: center;
  225. font-family: "PingFang SC";
  226. font-size: 28rpx;
  227. font-weight: 600;
  228. margin-right: 10rpx;
  229. }
  230. }
  231. .picking-task-page {
  232. min-height: 100vh;
  233. background: #F0F6FB;
  234. .container_main {
  235. .search-box {
  236. display: flex;
  237. align-items: center;
  238. padding: 0 32rpx;
  239. .scan-text {
  240. color: #333;
  241. font-family: "PingFang SC";
  242. font-size: 24rpx;
  243. font-weight: 400;
  244. margin-right: 20rpx;
  245. margin-left: 30rpx;
  246. }
  247. .scan-icon {
  248. width: 36rpx;
  249. height: 36rpx;
  250. background-color: #fff;
  251. border-radius: 50%;
  252. display: flex;
  253. align-items: center;
  254. justify-content: center;
  255. image {
  256. width: 24rpx;
  257. height: 24rpx;
  258. }
  259. }
  260. }
  261. .type-box {
  262. .type-item {
  263. width: 50%;
  264. height: 88rpx;
  265. display: flex;
  266. align-items: center;
  267. justify-content: center;
  268. .type-val {
  269. color: #000;
  270. font-family: "PingFang SC";
  271. font-size: 28rpx;
  272. font-weight: 400;
  273. margin-right: 10rpx;
  274. }
  275. }
  276. }
  277. .task-cont {
  278. padding: 0 24rpx;
  279. }
  280. }
  281. }
  282. </style>