index.vue 9.6 KB

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