index.vue 8.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223
  1. <template>
  2. <!-- 交收登记-->
  3. <a-modal class="commonModal paddingDialog settlement"
  4. :title="selectedRow.contracttype===1? '采购合同-交收登记': '销售合同-交收登记'"
  5. v-model:visible="visible"
  6. centered
  7. @cancel="cancel"
  8. width="890px">
  9. <template #footer>
  10. <a-button key="submit"
  11. class="cancelBtn"
  12. @click="cancel">取消
  13. </a-button>
  14. <a-button key="submit"
  15. type="primary"
  16. :loading="loading"
  17. @click="submit">交收登记
  18. </a-button>
  19. </template>
  20. <fieldset class="formFieldSet">
  21. <legend>合同基本信息</legend>
  22. <a-form class="inlineForm">
  23. <a-row :gutter="24">
  24. <a-col :span="12">
  25. <a-form-item label="合同编号">
  26. <span class="white">{{ formatValue(selectedRow.contractno) }}</span>
  27. </a-form-item>
  28. </a-col>
  29. <a-col :span="12">
  30. <a-form-item label="定价.
  31. 类型">
  32. <span class="white">{{ getPriceTypeName(selectedRow.pricetype) }}</span>
  33. </a-form-item>
  34. </a-col>
  35. </a-row>
  36. <a-row :gutter="24">
  37. <a-col :span="12">
  38. <a-form-item :label="selectedRow.contracttype===1? '采购方': '销售方'">
  39. <span class="white">{{ formatValue(selectedRow.accountname) }}</span>
  40. </a-form-item>
  41. </a-col>
  42. <a-col :span="12">
  43. <a-form-item label="现货品种">
  44. <span class="white">{{ formatValue(selectedRow.deliverygoodsname) }}</span>
  45. </a-form-item>
  46. </a-col>
  47. </a-row>
  48. <a-row :gutter="24">
  49. <a-col :span="12">
  50. <a-form-item label="合同签署量">
  51. <span class="white">{{ formatValue(selectedRow.qty + selectedRow.enumdicname) }}</span>
  52. </a-form-item>
  53. </a-col>
  54. <a-col :span="12">
  55. <a-form-item label="合同暂定价">
  56. <span class="white">{{ formatValue(selectedRow.price) }}</span>
  57. </a-form-item>
  58. </a-col>
  59. </a-row>
  60. <a-row :gutter="24">
  61. <a-col :span="12">
  62. <a-form-item label="点价合约">
  63. <span class="white">{{ formatValue(selectedRow.goodsname) }}</span>
  64. </a-form-item>
  65. </a-col>
  66. </a-row>
  67. </a-form>
  68. </fieldset>
  69. <fieldset class="formFieldSet">
  70. <legend>已登记信息</legend>
  71. <a-form class="inlineForm">
  72. <a-row :gutter="24">
  73. <a-col :span="12">
  74. <a-form-item label="已定价量">
  75. <span class="white">{{ selectedRow.pricedqty + selectedRow.enumdicname }}</span>
  76. </a-form-item>
  77. </a-col>
  78. <a-col :span="12">
  79. <a-form-item label="已点均价">
  80. <span class="white">{{ formatValue(selectedRow.pricedavg) }}</span>
  81. </a-form-item>
  82. </a-col>
  83. </a-row>
  84. </a-form>
  85. </fieldset>
  86. <fieldset class="formFieldSet">
  87. <legend>本次点价信息</legend>
  88. <a-form class="inlineForm"
  89. ref="formRef"
  90. :model="formState"
  91. :rules="formStateRules">
  92. <a-row :gutter="24">
  93. <a-col :span="12">
  94. <a-form-item label="点价价格"
  95. name="PricedPrice">
  96. <a-input-number class="dialogInput"
  97. style="width: 200px"
  98. v-model:value="formState.PricedPrice"
  99. :min="0"
  100. placeholder="请输入点价价格" />
  101. </a-form-item>
  102. </a-col>
  103. <a-col :span="12">
  104. <a-form-item label="升贴水">
  105. <span class="white">{{ formatValue(selectedRow.pricemove) }}</span>
  106. </a-form-item>
  107. </a-col>
  108. </a-row>
  109. <a-row :gutter="24">
  110. <a-col :span="12">
  111. <a-form-item label="商品价格">
  112. <span class="white">{{ Number(selectedRow.pricemove) + Number(formState.PricedPrice) }}</span>
  113. </a-form-item>
  114. </a-col>
  115. <a-col :span="12">
  116. <a-form-item label="点价数量"
  117. class="relative"
  118. name="PricedQty">
  119. <a-input-number class="dialogInput"
  120. style="width: 200px"
  121. v-model:value="formState.PricedQty"
  122. :min="0"
  123. :max="selectedRow.unpricedqty"
  124. placeholder="请输入点价数量" />
  125. <div class="tip">
  126. <span>未定价量<span class="white">{{selectedRow.unpricedqty}}{{selectedRow.enumdicname}} </span></span>
  127. <a class="blue ml10"
  128. @click="formState.PricedQty = selectedRow.unpricedqty"> 全部登记</a>
  129. </div>
  130. </a-form-item>
  131. </a-col>
  132. </a-row>
  133. <a-row :gutter="24">
  134. <a-col :span="12">
  135. <a-form-item label="点价金额">
  136. <span class="white">{{( Number(selectedRow.pricemove) + Number(formState.PricedPrice)) * formState.PricedQty }}</span>
  137. </a-form-item>
  138. </a-col>
  139. </a-row>
  140. </a-form>
  141. </fieldset>
  142. </a-modal>
  143. </template>
  144. <script lang="ts">
  145. import { defineComponent, PropType, reactive, ref, unref } from 'vue';
  146. import { closeModal } from '@/common/setup/modal/index';
  147. import { formatValue } from '@/common/methods';
  148. import { Ermcp3SellBuyContract } from '@/services/go/ermcp/purchase/interface';
  149. import { getPriceTypeName } from '@/views/business/purchase/setup';
  150. import { operationContractReq } from '@/services/proto/contract';
  151. import { message } from 'ant-design-vue';
  152. import { objectToUint8Array } from '@/utils/objHandle';
  153. export default defineComponent({
  154. name: 'purchase_pending_settlement',
  155. components: {},
  156. props: {
  157. selectedRow: {
  158. type: Object as PropType<Ermcp3SellBuyContract>,
  159. default: {},
  160. },
  161. },
  162. setup(props) {
  163. const { visible, cancel } = closeModal('purchase_pending_settlement');
  164. const loading = ref<boolean>(false);
  165. const formRef = ref();
  166. const formState = reactive({ PricedPrice: 0, PricedQty: 0 });
  167. const numberIstrue = (rule: any, value: any) => {
  168. if (!value) {
  169. return Promise.reject(new Error('请输入正确的值'));
  170. } else {
  171. return Promise.resolve();
  172. }
  173. };
  174. const formStateRules = {
  175. PricedPrice: [{ required: true, validator: numberIstrue, trigger: 'blur', type: 'number' }],
  176. PricedQty: [{ required: true, validator: numberIstrue, trigger: 'blur', type: 'number' }],
  177. };
  178. function submit() {
  179. const wrapEl = unref(formRef);
  180. wrapEl.validate().then(() => {
  181. loading.value = true;
  182. operationContractReq({
  183. OperateType: 1, // uint32 操作类型-1:登记2:确认3:拒绝4:撤销
  184. Info: {
  185. OperateApplyType: 1, // uint32 操作申请类型-1:点价2:结算3:款项4:发票
  186. RelatedID: 1, // uint64 现货合同ID(602+Unix秒时间戳(10位)+xxxxxx)
  187. DetailJson: objectToUint8Array(formState), // bytes 明细JSON {}
  188. },
  189. })
  190. .then(() => {
  191. message.success('登记成功!');
  192. loading.value = false;
  193. cancel();
  194. })
  195. .catch((err) => {
  196. message.error(err);
  197. loading.value = false;
  198. cancel();
  199. });
  200. });
  201. }
  202. return {
  203. visible,
  204. cancel,
  205. submit,
  206. loading,
  207. formRef,
  208. formState,
  209. formatValue,
  210. formStateRules,
  211. getPriceTypeName,
  212. };
  213. },
  214. });
  215. </script>
  216. <style lang="less">
  217. </style>;