index.vue 5.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224
  1. <template>
  2. <view class="">
  3. <uni-nav-bar fixed="true" statusBar="true" left-icon="back" title="入库台账" @clickLeft="back"></uni-nav-bar>
  4. <view class="fixed screen">
  5. <span @click="show=true">筛选</span>
  6. <uni-icons custom-prefix="iconfont" @click="show=true" type="icon-shaixuan" size="16" color="#000"></uni-icons>
  7. <!-- <u-icon name="list" size="40rpx" click="pr10" @click="show=true"></u-icon> -->
  8. </view>
  9. <view class="content">
  10. <OrderTask :list="worksheetList"></OrderTask>
  11. </view>
  12. <view class="fixed add">
  13. <u-button type="primary" @click="add">新增</u-button>
  14. </view>
  15. <u-popup :show="show" mode="right" @close="show=false">
  16. <view class="p10">
  17. <u--form :model="form" labelPosition="left" label-width="140rpx" ref="formName">
  18. <u-form-item prop="code" label="入库单号" borderBottom>
  19. <u--input placeholder="请输入入库单号" v-model="form.code"></u--input>
  20. </u-form-item>
  21. <u-form-item prop="entryType" label="入库类型" borderBottom>
  22. <u--input placeholder="请输入入库类型" v-model="form.entryType"></u--input>
  23. </u-form-item>
  24. <u-form-item prop="registrant" label="登记人" borderBottom>
  25. <u--input placeholder="请输入登记人" v-model="form.registrant"></u--input>
  26. </u-form-item>
  27. <u-form-item prop="entryTime" label="入库时间" borderBottom>
  28. <u--input placeholder="请选择入库时间" v-model="entryTime" readonly @click.native="showentryTime=true">
  29. </u--input>
  30. </u-form-item>
  31. <u-form-item prop="registTime" label="等级时间" borderBottom>
  32. <u--input placeholder="请选择等级时间" v-model="registTime" readonly
  33. @click.native="showRegistTime=true">
  34. </u--input>
  35. </u-form-item>
  36. </u--form>
  37. <view class="btn">
  38. <u-button type="primary" @click="onSubmit">确定</u-button>
  39. <u-button @click="resetForm">重置</u-button>
  40. </view>
  41. </view>
  42. <u-calendar :show="showentryTime" class="customCalendar" mode="range" @close="showentryTime=false"
  43. @confirm="onConfirm($event,'entryTime','showentryTime')">
  44. </u-calendar>
  45. <u-calendar :show="showRegistTime" class="customCalendar" mode="range" @close="showRegistTime=false"
  46. @confirm="onConfirm($event,'registTime','showRegistTime')">
  47. </u-calendar>
  48. </u-popup>
  49. </view>
  50. </template>
  51. <script>
  52. import OrderTask from "./OrderTask.vue"
  53. import {
  54. post
  55. } from "@/utils/api.js"
  56. export default {
  57. components: {
  58. OrderTask
  59. },
  60. data() {
  61. return {
  62. form: {
  63. code: "", //入库单号
  64. entryType: "", //入库类型
  65. registrant: "", // 登记人
  66. entryBeginTime: "", //入库开始时间
  67. entryEndTime: "", //入库结束时间
  68. registBeginTime: "", //等级开始时间
  69. registEndTime: "", //等级结束时间
  70. page: 1,
  71. siez: 10
  72. },
  73. showentryTime: false,
  74. showRegistTime: false,
  75. entryTime: "",
  76. registTime: "",
  77. isEnd: true,
  78. worksheetList: [],
  79. show: false
  80. }
  81. },
  82. onShow() {
  83. this.getList()
  84. },
  85. onReachBottom() {
  86. if (this.isEnd) return
  87. this.form.page++
  88. this.getList()
  89. },
  90. methods: {
  91. add(){
  92. uni.redirectTo({
  93. url: "/pages/put_storage/add/index"
  94. })
  95. },
  96. onSubmit() {
  97. this.form.page = 1
  98. // console.log(this.form)
  99. if (this.entryTime) {
  100. let arr = this.entryTime.split("至"),
  101. str = "";
  102. [this.form.entryBeginTime, this.form.entryEndTime] = arr.map((item, idx) => {
  103. str = idx === 0 ? `${item} 00:00:00` : `${item} 23:59:59`
  104. return str
  105. })
  106. }
  107. if (this.registTime) {
  108. let arr = this.registTime.split("至"),
  109. str = "";
  110. [this.form.registBeginTime, this.form.registEndTime] = arr.map((item, idx) => {
  111. str = idx === 0 ? `${item} 00:00:00` : `${item} 23:59:59`
  112. return str
  113. })
  114. }
  115. this.getList()
  116. this.show = false
  117. },
  118. resetForm() {
  119. this.$refs.formName.resetFields()
  120. this.registTime = ""
  121. this.entryTime = ""
  122. this.form.entryBeginTime = ""
  123. this.form.entryEndTime = ""
  124. this.form.registBeginTime = ""
  125. this.form.registEndTime = ""
  126. this.form.page = 1
  127. this.getList()
  128. this.show = false
  129. },
  130. onConfirm(val, name, show) {
  131. let str = ""
  132. val.forEach((item, idx) => {
  133. if (idx === 0) {
  134. str = item
  135. } else if (idx === val.length - 1) {
  136. str += "至" + item
  137. }
  138. })
  139. this[name] = str
  140. this[show] = false
  141. },
  142. getList() {
  143. uni.showLoading({
  144. title: "加载中"
  145. })
  146. post(this.apiUrl + "/feature/book/sparepartsEntry/putWareHouseList", this.form).then(res => {
  147. // console.log(res)
  148. if (this.form.page === 1) {
  149. this.worksheetList = res.data.items
  150. } else {
  151. res.data.items.forEach(item => {
  152. this.worksheetList.push(item)
  153. })
  154. }
  155. this.form.page < res.data.pageTotal ? (this.isEnd = false) : (this.isEnd = true);
  156. }).then(() => {
  157. uni.hideLoading()
  158. })
  159. }
  160. }
  161. }
  162. </script>
  163. <style lang="scss" scoped>
  164. .fixed {
  165. position: fixed;
  166. width: 100%;
  167. left: 0
  168. }
  169. .screen {
  170. height: $tab-height;
  171. line-height: $tab-height;
  172. background-color: #FFFFFF;
  173. border-bottom: 1px solid #f2f2f2;
  174. z-index: 99;
  175. text-align: right;
  176. display: flex;
  177. justify-content: flex-end;
  178. }
  179. .content {
  180. margin-top: $tab-height;
  181. // margin-bottom: ;
  182. }
  183. .add {
  184. bottom: 0;
  185. }
  186. .pr10 {
  187. padding-right: 20rpx;
  188. }
  189. .title {
  190. font-size: 30rpx;
  191. font-weight: bold;
  192. text-align: center;
  193. }
  194. .p10 {
  195. padding: 20rpx;
  196. }
  197. .customCalendar {
  198. /deep/.u-button {
  199. width: 100% !important;
  200. }
  201. /deep/ .u-calendar-month__days__day {
  202. height: 112rpx !important;
  203. }
  204. }
  205. .btn {
  206. margin-top: 20rpx;
  207. display: flex;
  208. /deep/ .u-button {
  209. width: 48% !important;
  210. }
  211. }
  212. </style>