index.vue 5.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148
  1. <!-- 保税仓业务-商品编辑 -->
  2. <template>
  3. <app-drawer :title="titel" :width="860" v-model:show="show">
  4. <el-form ref="formRef" class="el-form--horizontal" label-width="150px" :model="formItem" :rules="formRules">
  5. <el-form-item label="商品名称" prop="goodsid">
  6. <el-select v-model="formItem.goodsid" @change="onChange">
  7. <el-option :label="item.goodsname" :value="item.goodsid" v-for="(item, index) in goodsList"
  8. :key="index" />
  9. </el-select>
  10. </el-form-item>
  11. <el-form-item label="规格" prop="goodsspec">
  12. <el-input placeholder="请输入" v-model="formItem.goodsspec" />
  13. </el-form-item>
  14. <el-form-item label="成品对应原料明细" prop="rawdetail">
  15. <el-input placeholder="请输入" v-model="formItem.rawdetail" />
  16. </el-form-item>
  17. <el-form-item label="件数" prop="backagenum">
  18. <el-input-number placeholder="请输入" v-model="formItem.backagenum" />
  19. </el-form-item>
  20. <el-form-item label="净重(克拉)" prop="netweightct">
  21. <el-input-number placeholder="请输入" v-model="formItem.netweightct" />
  22. </el-form-item>
  23. <el-form-item label="净重(克)" prop="netweightgm">
  24. <el-input-number placeholder="请输入" v-model="formItem.netweightgm" />
  25. </el-form-item>
  26. <el-form-item label="连袋重(克)" prop="bagweightgm">
  27. <el-input-number placeholder="请输入" v-model="formItem.bagweightgm" />
  28. </el-form-item>
  29. <el-form-item label="单价(克)" prop="prepricegm">
  30. <el-input-number placeholder="请输入" v-model="formItem.prepricegm" />
  31. </el-form-item>
  32. <el-form-item label="总价" prop="totalprice">
  33. <el-input-number placeholder="请输入" v-model="formItem.totalprice" />
  34. </el-form-item>
  35. <el-form-item label="币种" prop="currencydes">
  36. <el-input placeholder="请输入" v-model="formItem.currencydes" />
  37. </el-form-item>
  38. <el-form-item label="报关总值" prop="customsvalue">
  39. <el-input-number placeholder="请输入" v-model="formItem.customsvalue" />
  40. </el-form-item>
  41. <el-form-item label="原产国" prop="origincountry">
  42. <el-input placeholder="请输入" v-model="formItem.origincountry" />
  43. </el-form-item>
  44. <el-form-item class="el-form-item--row" label="备注" prop="remark">
  45. <el-input type="textarea" v-model="formItem.remark" />
  46. </el-form-item>
  47. </el-form>
  48. <template #footer>
  49. <el-button @click="onCancel" plain>取消</el-button>
  50. <el-button type="primary" @click="onSubmit">保存</el-button>
  51. </template>
  52. </app-drawer>
  53. </template>
  54. <script lang="ts" setup>
  55. import { ref, PropType } from 'vue'
  56. import type { FormInstance, FormRules } from 'element-plus'
  57. import { queryGZBSCGoods } from '@/services/api/bonded'
  58. import AppDrawer from '@pc/components/base/drawer/index.vue'
  59. const props = defineProps({
  60. titel: {
  61. type: String,
  62. default: '商品编辑'
  63. },
  64. selectedRow: {
  65. type: Object as PropType<Ermcp.BScinOutOrderDetailRsp>
  66. }
  67. })
  68. const emit = defineEmits(['update'])
  69. const show = ref(true)
  70. const formRef = ref<FormInstance>()
  71. const goodsList = ref<Ermcp.GZBSCGoodsRsp[]>([])
  72. const formItem = ref<Partial<Ermcp.BScinOutOrderDetailRsp>>({ detailid: '0', ...props.selectedRow })
  73. const formRules: FormRules = {
  74. goodsid: [{
  75. required: true,
  76. message: '请选择商品'
  77. }],
  78. goodsspec: [{
  79. required: true,
  80. message: '请输入规格'
  81. }],
  82. rawdetail: [{
  83. required: true,
  84. message: '请输入成品对应原料明细'
  85. }],
  86. netweightct: [{
  87. required: true,
  88. message: '请输入净重'
  89. }],
  90. netweightgm: [{
  91. required: true,
  92. message: '请输入净重'
  93. }],
  94. bagweightgm: [{
  95. required: true,
  96. message: '请输入连袋重'
  97. }],
  98. prepricegm: [{
  99. required: true,
  100. message: '请输入单价'
  101. }],
  102. totalprice: [{
  103. required: true,
  104. message: '请输入总价'
  105. }],
  106. currencydes: [{
  107. required: true,
  108. message: '请输入币种'
  109. }],
  110. customsvalue: [{
  111. required: true,
  112. message: '请输入报关总值'
  113. }],
  114. origincountry: [{
  115. required: true,
  116. message: '请输入原产国'
  117. }],
  118. }
  119. const onChange = (goodsid: number) => {
  120. const item = goodsList.value.find((e) => e.goodsid === goodsid)
  121. formItem.value.goodsid = item?.goodsid
  122. formItem.value.goodsname = item?.goodsname
  123. }
  124. const onCancel = () => {
  125. show.value = false
  126. }
  127. const onSubmit = () => {
  128. formRef.value?.validate((valid) => {
  129. if (valid) {
  130. emit('update', formItem.value)
  131. onCancel()
  132. }
  133. })
  134. }
  135. queryGZBSCGoods({
  136. success: (res) => {
  137. goodsList.value = res.data
  138. }
  139. })
  140. </script>