index.vue 5.3 KB

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