index.vue 9.9 KB

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