index.vue 6.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278
  1. <template>
  2. <view class="">
  3. <uni-nav-bar fixed="true" statusBar="true" left-icon="back" title="新增出库登记" @clickLeft="onBack">
  4. </uni-nav-bar>
  5. <view class="p10">
  6. <u--form :model="form" labelPosition="left" :rules="rules" label-width="140rpx">
  7. <u-form-item label="出库单号" prop="code" borderBottom>
  8. <u--input v-model="form.code" disabled placeholder="自动生成"></u--input>
  9. </u-form-item>
  10. <u-form-item label="状态" prop="status" borderBottom>
  11. <u--input v-model="status" placeholder="请选择类型" @click.native="show=true" readonly>
  12. </u--input>
  13. <u-icon slot="right" name="arrow-right"></u-icon>
  14. </u-form-item>
  15. <u-form-item label="申请时间" prop="applyDate" borderBottom>
  16. <u--input v-model="applyDate" placeholder="请选择申请时间" @click.native="getTimeInof('applyDate')"
  17. readonly>
  18. </u--input>
  19. <u-icon slot="right" name="arrow-right"></u-icon>
  20. </u-form-item>
  21. <u-form-item label="领取时间" prop="getDate" borderBottom>
  22. <u--input v-model="getDate" placeholder="请选择领取时间" @click.native="getTimeInof('getDate')" readonly>
  23. </u--input>
  24. <u-icon slot="right" name="arrow-right"></u-icon>
  25. </u-form-item>
  26. <u-form-item label="部门" prop="dept" borderBottom>
  27. <u--input v-model="form.dept" disabled placeholder="部门"></u--input>
  28. </u-form-item>
  29. <u-form-item label="备注" prop="remark" borderBottom>
  30. <u--textarea v-model="form.remark" confirm-type="send" count placeholder="请输入备注"></u--textarea>
  31. </u-form-item>
  32. </u--form>
  33. </view>
  34. <view class="mt10">
  35. <CellTip title="选择归还区域" class="area_tips">
  36. <view class="right">
  37. <u-button size="small" type="primary" @click="select_type">选择备件类型</u-button>
  38. </view>
  39. </CellTip>
  40. <uni-swipe-action v-if="orderList.length !== 0">
  41. <uni-swipe-action-item class="customeSwipe" @click="swipeAction(index)" :right-options="options"
  42. v-for="(item,index) in orderList" :key="index">
  43. <view>
  44. <!-- sparepartTypeCode.name -->
  45. <OrderList lable1="编码:" :value1="item.code" lable2="名称:" :value2="item.name" lable3="规格:"
  46. :value3="item.spec" lable4="型号:" :value4="item.model" lable5="库存:" :value5="item.stock"
  47. lable6="单位:" :value6="item.unit" lable7="批次条码" :value7="item.spec">
  48. <u--input placeholder="请输入出库数量" v-model="item.expend"></u--input>
  49. </OrderList>
  50. </view>
  51. </uni-swipe-action-item>
  52. </uni-swipe-action>
  53. <view class="no_data" v-else>
  54. <u-empty mode="data"></u-empty>
  55. </view>
  56. </view>
  57. <view class="btnList">
  58. <!-- <u-button type="success">暂存</u-button> -->
  59. <u-button type="primary" @click="submit">提交</u-button>
  60. <u-button @click="cancelPage">取消</u-button>
  61. </view>
  62. <u-picker :show="show" :columns="columns" key-name="name" @cancel="show=false" @confirm="onConfirm"></u-picker>
  63. <u-calendar :show="showCalendar" @close="showCalendar=false" class="customCalendar" @confirm="handleConfirm">
  64. </u-calendar>
  65. </view>
  66. </template>
  67. <script>
  68. import CellTip from '@/components/CellTip.vue'
  69. import OrderList from '../components/OrderList.vue'
  70. import {
  71. get,
  72. post,
  73. postJ
  74. } from "@/utils/api.js"
  75. export default {
  76. components: {
  77. CellTip,
  78. OrderList
  79. },
  80. data() {
  81. return {
  82. orderList: [],
  83. showPicker: false,
  84. columns: [
  85. [{
  86. name: "未出库",
  87. value: 0,
  88. }, {
  89. name: "已出库",
  90. value: 1
  91. }]
  92. ],
  93. entryTypeValue: "",
  94. showCalendar: false,
  95. entryTime: "",
  96. columnsPicker: [],
  97. show: false,
  98. options: [{
  99. text: '删除',
  100. style: {
  101. backgroundColor: '#f56c6c'
  102. }
  103. }],
  104. rules: {},
  105. columnData: [],
  106. warehouseIndex: 0,
  107. timeName: "",
  108. status: "",
  109. applyDate: "",
  110. getDate: "",
  111. form: {
  112. code: "",
  113. status: "",
  114. applyDate: "",
  115. getDate: "",
  116. dept: "研发部",
  117. remark: ""
  118. }
  119. }
  120. },
  121. onShow() {
  122. this.orderList = this.$store.state.tour_tally.selectSparepart ? this.$store.state.tour_tally.selectSparepart :
  123. []
  124. this.init()
  125. },
  126. methods: {
  127. getTimeInof(name) {
  128. this.timeName = name
  129. this.showCalendar = true
  130. },
  131. onBack() {
  132. this.$store.dispatch("tour_tally/setSelectSparepart", this.orderList)
  133. uni.redirectTo({
  134. url: "/pages/outbound/order/index"
  135. })
  136. },
  137. swipeAction(idx) {
  138. this.orderList.splice(idx, 1)
  139. this.$store.dispatch("tour_tally/setSelectSparepart", this.orderList)
  140. },
  141. submit() {
  142. this.form.spareparts = this.orderList
  143. postJ(this.apiUrl + "/feature/book/sparepartsExport/putWarehouse", this.form).then(res => {
  144. // console.log(res)
  145. if (res.success) {
  146. uni.showToast({
  147. title: "操作成功"
  148. })
  149. setTimeout(() => {
  150. this.cancelPage()
  151. }, 2000)
  152. }
  153. })
  154. },
  155. cancelPage() {
  156. this.$store.dispatch("tour_tally/setSelectSparepart", [])
  157. uni.redirectTo({
  158. url: "/pages/outbound/order/index"
  159. })
  160. },
  161. selectAddress(idx) {
  162. this.showPicker = true
  163. this.warehouseIndex = idx
  164. },
  165. onConfirm(e) {
  166. this.form.status = e.value[0].value
  167. this.status = e.value[0].name
  168. this.show = false
  169. },
  170. handleConfirm(e) {
  171. this[this.timeName] = e[0]
  172. this.form[this.timeName] = e[0] + " 00:00:00"
  173. this.showCalendar = false
  174. },
  175. pickerList() {
  176. return new Promise((reslove, reject) => {
  177. post(this.apiUrl + "/wms/warehouse/list").then(res => {
  178. reslove(res.data)
  179. })
  180. })
  181. },
  182. init() {
  183. uni.showLoading({
  184. title: "加载中"
  185. })
  186. Promise.all([this.loadCreate(), this.pickerList()]).then(res => {
  187. uni.hideLoading()
  188. this.form.code = res[0]
  189. })
  190. },
  191. loadCreate() {
  192. return new Promise((reslove, reject) => {
  193. get(this.apiUrl + "/feature/book/sparepartsExport/create").then(res => {
  194. // console.log(res)
  195. if (res.success) {
  196. reslove(res.data)
  197. }
  198. })
  199. })
  200. },
  201. select_type() {
  202. uni.redirectTo({
  203. url: "/pages/outbound/linkage/index"
  204. })
  205. }
  206. }
  207. }
  208. </script>
  209. <style lang="scss" scoped>
  210. .p10 {
  211. padding: 20rpx;
  212. }
  213. .customeSwipe {
  214. /deep/ .u-input {
  215. border-bottom: 1px solid #ccc;
  216. }
  217. /deep/ .u-input:last-child {
  218. border-bottom: none;
  219. }
  220. }
  221. .btnList {
  222. position: fixed;
  223. bottom: 0;
  224. left: 0;
  225. width: 100%;
  226. display: flex;
  227. z-index: 999;
  228. /deep/ .u-button {
  229. width: 50% !important;
  230. }
  231. }
  232. .mt10 {
  233. margin-top: 20rpx;
  234. padding-bottom: 160rpx;
  235. position: relative;
  236. }
  237. .right {
  238. position: absolute;
  239. right: 20rpx;
  240. }
  241. .no_data {
  242. margin-top: 80rpx;
  243. }
  244. /deep/ .u-picker__view__column__item {
  245. height: 88rpx !important;
  246. line-height: 88rpx !important;
  247. }
  248. /deep/ .uni-picker-view-indicator {
  249. height: 88rpx !important;
  250. line-height: 88rpx !important;
  251. }
  252. .customCalendar {
  253. /deep/.u-button {
  254. width: 100% !important;
  255. }
  256. }
  257. </style>