index.vue 8.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289
  1. <template>
  2. <div class="storage">
  3. <div class="com-mobile-header mobile-center-header">
  4. <a @click="goLastPage"><i class="iconfont icon-fanhui"></i></a>
  5. <p>产品入库</p>
  6. <p class="en-name"><img :src="`/images/mobile/center/${user.data.enterprise.uu ? 'en' : 'self'}.png`" alt="">{{currentEnName}}</p>
  7. </div>
  8. <div class="mobile-fix-content mobile-centerfix-content" id="mobile-storage-center">
  9. <div>
  10. <div class="storage-record">
  11. <div class="search-content clearfix">
  12. <div class="search">
  13. <input type="text" v-model="filterParams.keyword" :placeholder="switchType ==='OUTBOUND' ? (handleItem === 0 ? '出库单号/买家名称':'订单号/买家名称') : (handleItem === 0 ? '入库单号/卖家名称':'发货单/卖家名称')" class="staff-search" @keyup.13="filterRecord">
  14. <span @click="filterRecord"><i class="iconfont icon-sousuo"></i></span>
  15. </div>
  16. </div>
  17. <div class="tab-content">
  18. <span :class="{'active': handleItem === 0}" @click="setHandleItem(0)">{{switchType === 'INBOUND' ? '查看入库记录' : '查看出库记录'}}</span>
  19. <span :class="{'active': handleItem === 2}" @click="setHandleItem(2)">{{switchType === 'INBOUND' ? '采购入库' : '销售出库'}}</span>
  20. <span :class="{'active': handleItem === 1}" @click="setHandleItem(1)">{{switchType === 'INBOUND' ? '其它入库' : '其它出库'}}</span>
  21. </div>
  22. <div class="filters-wrap" v-show="handleItem !== 1">
  23. <base-filter
  24. v-for="filterOption in filterOptions"
  25. :key="filterOption.selectOption"
  26. :selectItems="filterOption.selectItems"
  27. :defaultVal="filterOption.defaultVal"
  28. :selectOption="filterOption.selectOption"
  29. @selectAction="onSelectAction"
  30. @valueAction="onValueAction"
  31. :title="filterOption.title">
  32. </base-filter>
  33. </div>
  34. <div class="list-content">
  35. <storage-list :listData="storageList" :switchType="switchType" :handleItem="handleItem" v-if="handleItem !== 1"></storage-list>
  36. <other-storage :switchType="switchType" v-else></other-storage>
  37. </div>
  38. <empty-status v-if="isEmpty && handleItem !== 1" :type="'collect'" :showLink="true" :text="'抱歉,没有相关信息'"></empty-status>
  39. <pull-up :fixId="'mobile-storage-center'" :searchMore="fetching" :allPage="allPage" :page="page" @pullUpAction="onPullUpAction"></pull-up>
  40. </div>
  41. </div>
  42. </div>
  43. <remind-box :title="remindText" :timeoutCount="timeoutCount"></remind-box>
  44. </div>
  45. </template>
  46. <script>
  47. import { RemindBox, PullUp, EmptyStatus } from '~components/mobile/common'
  48. import { ModalWrapper, BaseFilter } from '~components/mobile/base'
  49. import { StorageList, OtherStorage } from '~components/mobile/center/outOfStorage'
  50. export default {
  51. middleware: 'authenticated',
  52. layout: 'mobile',
  53. fetch({store}) {
  54. return Promise.all([
  55. store.dispatch('loadCurrencyData')
  56. ])
  57. },
  58. data () {
  59. return {
  60. remindText: '',
  61. timeoutCount: 0,
  62. switchType: 'INBOUND',
  63. handleItem: 0,
  64. filterOptions: [
  65. {
  66. title: '交易时间',
  67. selectOption: 'date',
  68. selectItems: [{
  69. key: '30天',
  70. val: 1
  71. }, {
  72. key: '90天',
  73. val: 2
  74. }, {
  75. key: '180天',
  76. val: 3
  77. }, {
  78. key: '自定义',
  79. val: 4
  80. }],
  81. defaultVal: 1
  82. }
  83. ],
  84. page: 1,
  85. isChange: false,
  86. storageList: [],
  87. filterParams:{
  88. count: 10
  89. },
  90. filter:{
  91. count: 10,
  92. sorting: {"createtime":"DESC"},
  93. status: '502-406'
  94. }
  95. }
  96. },
  97. components: {
  98. RemindBox,
  99. PullUp,
  100. EmptyStatus,
  101. BaseFilter,
  102. StorageList,
  103. OtherStorage
  104. },
  105. created () {
  106. this.switchType = this.$route.query.type ? this.$route.query.type : 'INBOUND'
  107. this.handleItem = this.$route.query.handleItem ? Number(this.$route.query.handleItem) : 0
  108. this.reloadList()
  109. },
  110. watch: {
  111. 'storageData': {
  112. handler: function (val) {
  113. if (val && val.content) {
  114. if(this.isChange){
  115. this.storageList = []
  116. this.isChange = false
  117. }
  118. this.storageList = [...this.storageList, ...val.content]
  119. }
  120. }
  121. }
  122. },
  123. computed: {
  124. storageData () {
  125. return this.allStorageData.data
  126. },
  127. allStorageData () {
  128. return this.$store.state.product.storage.list
  129. },
  130. fetching () {
  131. return this.allStorageData.fetching
  132. },
  133. allPage () {
  134. return this.storageData.totalPages
  135. },
  136. isEmpty () {
  137. return this.storageList.length === 0
  138. }
  139. },
  140. methods: {
  141. onRemind: function (str) {
  142. this.remindText = str
  143. this.timeoutCount++
  144. },
  145. onPullUpAction () {
  146. this.page++
  147. this.filterParams.page = this.page
  148. this.filter.page = this.page
  149. this.reloadList()
  150. },
  151. setHandleItem (type) {
  152. if(type !== this.handleItem) {
  153. this.handleItem = type
  154. if(type !== 1) {
  155. this.filterParams.page = 1
  156. this.filter.page = 1
  157. this.page = 1
  158. this.isChange = true
  159. this.reloadList()
  160. }
  161. }
  162. },
  163. setSelect (type, val, isReload) {
  164. if (type === 'date') {
  165. if (val) {
  166. this.filterParams.fromDate = val.fromDate
  167. this.filter.startMils = val.fromDate
  168. this.filterParams.toDate = val.toDate
  169. this.filter.endMils = val.toDate
  170. } else {
  171. this.filterParams.fromDate = null
  172. this.filter.startMils = null
  173. this.filterParams.toDate = null
  174. this.filter.endMils = null
  175. }
  176. } else {
  177. this.filterParams[type] = val
  178. this.filter[type] = val
  179. }
  180. isReload && this.filterRecord()
  181. },
  182. initFilterParams () {
  183. this.filterParams = {
  184. keyword: '',
  185. fromDate: '',
  186. toDate: '',
  187. type: ''
  188. },
  189. this.filter = {
  190. keyword: '',
  191. startMils: '',
  192. endMils: ''
  193. }
  194. },
  195. onSelectAction (selectObj) {
  196. this.setSelect(selectObj.key, selectObj.value, true)
  197. },
  198. onValueAction (selectObj) {
  199. this.setSelect(selectObj.key, selectObj.value, false)
  200. },
  201. filterRecord () {
  202. this.filterParams.page = 1
  203. this.filter.page = 1
  204. this.isChange = true
  205. this.reloadList()
  206. },
  207. reloadList () {
  208. this.filterParams.type = this.switchType
  209. if(this.handleItem === 0) {
  210. this.$store.dispatch('product/getLoadStorageData', this.filterParams)
  211. } else if(this.handleItem === 2) {
  212. if(this.switchType === 'INBOUND') {
  213. this.filterParams.type = null
  214. this.$store.dispatch('product/getLoadEnterpriseData', this.filterParams)
  215. } else {
  216. this.$store.dispatch('product/getLoadPurchaseData', this.filter)
  217. }
  218. }
  219. }
  220. }
  221. }
  222. </script>
  223. <style lang="scss">
  224. $base-color: #3f84f6;
  225. #mobile-storage-center {
  226. padding-bottom: .5rem;
  227. margin: 0 auto;
  228. .storage-record {
  229. .search-content {
  230. padding: .20rem 0;
  231. text-align: center;
  232. input {
  233. margin: 0;
  234. width: 7.1rem;
  235. border: 1px solid $base-color;
  236. }
  237. }
  238. .tab-content{
  239. margin: 0 auto .13rem;
  240. width: 7.1rem;
  241. overflow: hidden;
  242. text-align: center;
  243. span{
  244. float: left;
  245. display: inline-block;
  246. width: 2.36rem;
  247. height: .62rem;
  248. line-height: .62rem;
  249. text-align: center;
  250. color: #999999;
  251. font-size: .26rem;
  252. background-color: #ffffff;
  253. border: solid 1px #d7d7d7;
  254. -webkit-box-sizing: border-box;
  255. box-sizing: border-box;
  256. &.active{
  257. background-color: #3f84f6;
  258. border: none;
  259. color: #fff;
  260. }
  261. &:first-child{
  262. border-top-left-radius: .05rem;
  263. border-bottom-left-radius: .05rem;
  264. }
  265. &:nth-child(2){
  266. border-left: none;
  267. border-right: none;
  268. }
  269. &:last-child{
  270. border-top-right-radius: .05rem;
  271. border-bottom-right-radius: .05rem;
  272. }
  273. }
  274. }
  275. .filters-wrap{
  276. background: #fff;
  277. margin: 0 auto .13rem;
  278. width: 7.1rem;
  279. overflow: hidden;
  280. padding: .1rem;
  281. }
  282. .list-content{
  283. margin: 0 auto;
  284. padding: 0 .20rem;
  285. margin-bottom:1.2rem;
  286. }
  287. }
  288. }
  289. </style>