index.vue 8.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288
  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)">查看出库记录</span>
  19. <span :class="{'active': handleItem === 2}" @click="setHandleItem(2)">销售出库</span>
  20. <span :class="{'active': handleItem === 1}" @click="setHandleItem(1)">其它出库</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: 'OUTBOUND',
  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.handleItem = this.$route.query.handleItem ? Number(this.$route.query.handleItem) : 0
  107. this.reloadList()
  108. },
  109. watch: {
  110. 'storageData': {
  111. handler: function (val) {
  112. if (val && val.content) {
  113. if (this.isChange) {
  114. this.storageList = []
  115. this.isChange = false
  116. }
  117. this.storageList = [...this.storageList, ...val.content]
  118. }
  119. }
  120. }
  121. },
  122. computed: {
  123. storageData () {
  124. return this.allStorageData.data
  125. },
  126. allStorageData () {
  127. return this.$store.state.product.storage.list
  128. },
  129. fetching () {
  130. return this.allStorageData.fetching
  131. },
  132. allPage () {
  133. return this.storageData.totalPages
  134. },
  135. isEmpty () {
  136. return this.storageList.length === 0
  137. }
  138. },
  139. methods: {
  140. onRemind: function (str) {
  141. this.remindText = str
  142. this.timeoutCount++
  143. },
  144. onPullUpAction () {
  145. this.page++
  146. this.filterParams.page = this.page
  147. this.filter.page = this.page
  148. this.reloadList()
  149. },
  150. setHandleItem (type) {
  151. if(type !== this.handleItem) {
  152. this.handleItem = type
  153. if(type !== 1) {
  154. this.filterParams.page = 1
  155. this.filter.page = 1
  156. this.page = 1
  157. this.isChange = true
  158. this.reloadList()
  159. }
  160. }
  161. },
  162. setSelect (type, val, isReload) {
  163. if (type === 'date') {
  164. if (val) {
  165. this.filterParams.fromDate = val.fromDate
  166. this.filter.startMils = val.fromDate
  167. this.filterParams.toDate = val.toDate
  168. this.filter.endMils = val.toDate
  169. } else {
  170. this.filterParams.fromDate = null
  171. this.filter.startMils = null
  172. this.filterParams.toDate = null
  173. this.filter.endMils = null
  174. }
  175. } else {
  176. this.filterParams[type] = val
  177. this.filter[type] = val
  178. }
  179. isReload && this.filterRecord()
  180. },
  181. initFilterParams () {
  182. this.filterParams = {
  183. keyword: '',
  184. fromDate: '',
  185. toDate: '',
  186. type: ''
  187. },
  188. this.filter = {
  189. keyword: '',
  190. startMils: '',
  191. endMils: ''
  192. }
  193. },
  194. onSelectAction (selectObj) {
  195. this.setSelect(selectObj.key, selectObj.value, true)
  196. },
  197. onValueAction (selectObj) {
  198. this.setSelect(selectObj.key, selectObj.value, false)
  199. },
  200. filterRecord () {
  201. this.filterParams.page = 1
  202. this.filter.page = 1
  203. this.isChange = true
  204. this.reloadList()
  205. },
  206. reloadList () {
  207. this.filterParams.type = this.switchType
  208. if(this.handleItem === 0) {
  209. this.$store.dispatch('product/getLoadStorageData', this.filterParams)
  210. } else if(this.handleItem === 2) {
  211. if(this.switchType === 'INBOUND') {
  212. this.filterParams.type = null
  213. this.$store.dispatch('product/getLoadEnterpriseData', this.filterParams)
  214. } else {
  215. this.$store.dispatch('product/getLoadPurchaseData', this.filter)
  216. }
  217. }
  218. }
  219. }
  220. }
  221. </script>
  222. <style lang="scss">
  223. $base-color: #3f84f6;
  224. #mobile-storage-center {
  225. padding-bottom: .5rem;
  226. margin: 0 auto;
  227. .storage-record {
  228. .search-content {
  229. padding: .20rem 0;
  230. text-align: center;
  231. input {
  232. margin: 0;
  233. width: 7.1rem;
  234. border: 1px solid $base-color;
  235. }
  236. }
  237. .tab-content{
  238. margin: 0 auto .13rem;
  239. width: 7.1rem;
  240. overflow: hidden;
  241. text-align: center;
  242. span{
  243. float: left;
  244. display: inline-block;
  245. width: 2.36rem;
  246. height: .62rem;
  247. line-height: .62rem;
  248. text-align: center;
  249. color: #999999;
  250. font-size: .26rem;
  251. background-color: #ffffff;
  252. border: solid 1px #d7d7d7;
  253. -webkit-box-sizing: border-box;
  254. box-sizing: border-box;
  255. &.active{
  256. background-color: #3f84f6;
  257. border: none;
  258. color: #fff;
  259. }
  260. &:first-child{
  261. border-top-left-radius: .05rem;
  262. border-bottom-left-radius: .05rem;
  263. }
  264. &:nth-child(2){
  265. border-left: none;
  266. border-right: none;
  267. }
  268. &:last-child{
  269. border-top-right-radius: .05rem;
  270. border-bottom-right-radius: .05rem;
  271. }
  272. }
  273. }
  274. .filters-wrap{
  275. background: #fff;
  276. margin: 0 auto .13rem;
  277. width: 7.1rem;
  278. overflow: hidden;
  279. padding: .1rem;
  280. }
  281. .list-content{
  282. margin: 0 auto;
  283. padding: 0 .20rem;
  284. margin-bottom:1.2rem;
  285. }
  286. }
  287. }
  288. </style>