index.vue 6.7 KB

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