index.vue 5.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225
  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"></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. </view>
  36. </view>
  37. <!-- 中心仓弹窗 -->
  38. <u-picker :show="stashShow" :defaultIndex="defaultIndex" :columns="stashColumns" @confirm="pickerConfirm" @cancel="stashShow= false"></u-picker>
  39. <!-- 状态 -->
  40. <u-picker :show="statusShow" :defaultIndex="defaultIndex2" :columns="statusColumns" @confirm="statusConfirm" @cancel="statusShow= false"></u-picker>
  41. <!-- 月份 -->
  42. <u-picker :show="dateShow" :defaultIndex="defaultIndex3" :columns="dateColumns" @confirm="dateConfirm" @cancel="dateShow= false"></u-picker>
  43. </view>
  44. </template>
  45. <script>
  46. import taskItem from '@/components/task-item/task-item.vue'
  47. import {saleOrder} from '@/common/request/apis/picking'
  48. export default{
  49. components:{
  50. taskItem
  51. },
  52. data() {
  53. return {
  54. offsetTop:0,
  55. cangName:'鹏越中心仓',
  56. type1:'全部',
  57. type2:'月份',
  58. stashShow:false,
  59. statusShow:false,
  60. dateShow:false,
  61. stashColumns:[
  62. ['鹏越中心仓','美团中心仓']
  63. ],
  64. statusColumns:[
  65. ['全部','待拣货','已拣货','拣货中']
  66. ],
  67. dateColumns:[
  68. ['一月','二月','三月','四月','五月','六月','七月','八月','九月','十月','十一月','十二月']
  69. ],
  70. defaultIndex:[],
  71. defaultIndex2:[],
  72. defaultIndex3:[],
  73. taskList:[],
  74. params:{
  75. beginTime:'',
  76. endTime:'',
  77. number:'',
  78. status:0
  79. }
  80. }
  81. },
  82. onLoad() {
  83. let systemInfo = uni.getSystemInfoSync();
  84. let statusBarHeight = systemInfo.statusBarHeight;
  85. this.offsetTop = statusBarHeight + 40
  86. this.getSaleOrder()
  87. },
  88. methods:{
  89. searchClick() {
  90. this.getPurchaseInventory()
  91. },
  92. tabClick(type) {
  93. if(type == 1) {
  94. this.defaultIndex = this.getDefaultIndex(this.type1,this.statusColumns)
  95. this.statusShow = true
  96. }else {
  97. this.defaultIndex = this.getDefaultIndex(this.type2,this.dateColumns)
  98. this.dateShow = true
  99. }
  100. },
  101. getSaleOrder() {
  102. saleOrder(this.params)
  103. .then(res=>{
  104. if(res.code == 200) {
  105. this.taskList = res.data.rows;
  106. }
  107. })
  108. },
  109. stashClick() {
  110. this.defaultIndex = this.getDefaultIndex(this.cangName,this.stashColumns)
  111. this.stashShow = true
  112. },
  113. pickerConfirm(val) {
  114. this.cangName = val.value[0]
  115. this.stashShow = false
  116. },
  117. statusConfirm(val) {
  118. this.type1 = val.value[0]
  119. this.statusShow = false
  120. },
  121. dateConfirm(val) {
  122. this.type2 = val.value[0]
  123. this.dateShow = false
  124. let month = val.indexs[0]
  125. this.getLastDayOfMonth(month)
  126. this.getSaleOrder()
  127. },
  128. // 获取开始时间、结束时间
  129. getLastDayOfMonth(month) {
  130. let year = new Date().getFullYear()
  131. let monthStart = new Date(year, month + 1, 0).getDate();
  132. this.params.beginTime = `${year}-${month + 1}-01`
  133. this.params.endTime = `${year}-${month + 1}-${monthStart}`
  134. },
  135. // 获取picker默认index
  136. getDefaultIndex(val,list) {
  137. let arr = []
  138. let index = list[0].findIndex(item=>item == val)
  139. arr = [index]
  140. return arr
  141. },
  142. // 出库
  143. toStorage(val) {
  144. uni.navigateTo({
  145. url:'/pages/picking-task/delivery'
  146. })
  147. },
  148. toDetail(val) {
  149. uni.navigateTo({
  150. url:'/pages/picking-task/detail'
  151. })
  152. }
  153. }
  154. }
  155. </script>
  156. <style lang="scss" scoped>
  157. .btn-right {
  158. display: flex;
  159. align-items: center;
  160. .cang-name {
  161. color: #0256FF;
  162. text-align: center;
  163. font-family: "PingFang SC";
  164. font-size: 28rpx;
  165. font-weight: 600;
  166. margin-right: 10rpx;
  167. }
  168. }
  169. .picking-task-page {
  170. min-height: 100vh;
  171. background: #F0F6FB;
  172. .container_main {
  173. .search-box {
  174. display: flex;
  175. align-items: center;
  176. padding: 0 32rpx;
  177. .scan-text {
  178. color: #333;
  179. font-family: "PingFang SC";
  180. font-size: 24rpx;
  181. font-weight: 400;
  182. margin-right: 20rpx;
  183. margin-left: 30rpx;
  184. }
  185. .scan-icon {
  186. width: 36rpx;
  187. height: 36rpx;
  188. background-color: #fff;
  189. border-radius: 50%;
  190. display: flex;
  191. align-items: center;
  192. justify-content: center;
  193. image {
  194. width: 24rpx;
  195. height: 24rpx;
  196. }
  197. }
  198. }
  199. .type-box {
  200. .type-item {
  201. width: 50%;
  202. height: 88rpx;
  203. display: flex;
  204. align-items: center;
  205. justify-content: center;
  206. .type-val {
  207. color: #000;
  208. font-family: "PingFang SC";
  209. font-size: 28rpx;
  210. font-weight: 400;
  211. margin-right: 10rpx;
  212. }
  213. }
  214. }
  215. .task-cont {
  216. padding: 0 24rpx;
  217. }
  218. }
  219. }
  220. </style>