index.vue 7.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229
  1. <template>
  2. <!-- 采购 点价登记-->
  3. <a-modal class="commonModal someprice"
  4. :title="selectedRow.contracttype===1? '采购合同-点价登记': '销售合同-点价登记'"
  5. v-model:visible="visible"
  6. @cancel="cancel"
  7. centered
  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. <span class="white">{{ getPriceTypeName(selectedRow.pricetype) }}</span>
  32. </a-form-item>
  33. </a-col>
  34. </a-row>
  35. <a-row :gutter="24">
  36. <a-col :span="12">
  37. <a-form-item :label="selectedRow.contracttype===1? '采购方': '销售方'">
  38. <span class="white">{{ formatValue(selectedRow.accountname) }}</span>
  39. </a-form-item>
  40. </a-col>
  41. <a-col :span="12">
  42. <a-form-item label="现货品种">
  43. <span class="white">{{ formatValue(selectedRow.deliverygoodsname) }}</span>
  44. </a-form-item>
  45. </a-col>
  46. </a-row>
  47. <a-row :gutter="24">
  48. <a-col :span="12">
  49. <a-form-item label="合同签署量">
  50. <span
  51. 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
  64. class="white">{{ formatValue(selectedRow.goodsname) + selectedRow.currencyname }}</span>
  65. </a-form-item>
  66. </a-col>
  67. </a-row>
  68. </a-form>
  69. </fieldset>
  70. <fieldset class="formFieldSet">
  71. <legend>已登记信息</legend>
  72. <a-form class="inlineForm">
  73. <a-row :gutter="24">
  74. <a-col :span="12">
  75. <a-form-item label="已定价量">
  76. <span class="white">{{ selectedRow.pricedqty + selectedRow.enumdicname }}</span>
  77. </a-form-item>
  78. </a-col>
  79. <a-col :span="12">
  80. <a-form-item label="已点均价">
  81. <span
  82. class="white">{{ formatValue(selectedRow.pricedavg.toFixed(2)) + " 元" }}</span>
  83. </a-form-item>
  84. </a-col>
  85. </a-row>
  86. </a-form>
  87. </fieldset>
  88. <fieldset class="formFieldSet">
  89. <legend>本次点价信息</legend>
  90. <a-form class="inlineForm"
  91. ref="formRef"
  92. :model="formState"
  93. :rules="rules">
  94. <a-row :gutter="24">
  95. <a-col :span="12">
  96. <a-form-item label="点价价格"
  97. name="PricedPrice">
  98. <a-input-number class="dialogInput"
  99. style="width: 200px"
  100. v-model:value="formState.PricedPrice"
  101. ::min="0"
  102. placeholder="请输入点价价格" />
  103. </a-form-item>
  104. </a-col>
  105. <a-col :span="12">
  106. <a-form-item label="升贴水">
  107. <span class="white">{{ formatValue(selectedRow.pricemove.toFixed(2)) }}</span>
  108. </a-form-item>
  109. </a-col>
  110. </a-row>
  111. <a-row :gutter="24">
  112. <a-col :span="12">
  113. <a-form-item label="商品价格">
  114. <span class="white">{{
  115. (Number(selectedRow.pricemove) + Number(formState.PricedPrice)).toFixed(2)
  116. }}</span>
  117. </a-form-item>
  118. </a-col>
  119. <a-col :span="12">
  120. <a-form-item label="点价数量"
  121. class="relative"
  122. name="PricedQty">
  123. <a-input-number class="dialogInput"
  124. style="width: 200px"
  125. v-model:value="formState.PricedQty"
  126. ::min="0"
  127. :max="selectedRow.unpricedqty"
  128. placeholder="请输入点价数量" />
  129. <div class="tip mt10">
  130. <span>未定价量<span
  131. class="white">{{ selectedRow.unpricedqty }}{{ selectedRow.enumdicname }}</span>
  132. </span>
  133. <a class="blue ml10"
  134. @click="formState.PricedQty = selectedRow.unpricedqty"> 全部登记</a>
  135. </div>
  136. </a-form-item>
  137. </a-col>
  138. </a-row>
  139. <a-row :gutter="24">
  140. <a-col :span="12">
  141. <a-form-item label="点价金额">
  142. <span class="white">{{
  143. ((Number(selectedRow.pricemove) + Number(formState.PricedPrice)) * formState.PricedQty).toFixed(2)
  144. + " 元" }}
  145. </span>
  146. </a-form-item>
  147. </a-col>
  148. </a-row>
  149. </a-form>
  150. </fieldset>
  151. </a-modal>
  152. </template>
  153. <script lang="ts">
  154. import { defineComponent, PropType, ref, unref } from 'vue';
  155. import { formatValue } from '@/common/methods';
  156. import { Ermcp3SellBuyContract } from '@/services/go/ermcp/purchase/interface';
  157. import { getPriceTypeName } from '@/common/constants/enumsName';
  158. import { SomePriceReq } from '@/services/proto/contract/interface';
  159. import { somePriceReq } from '@/views/business/purchase/components/setup';
  160. import { handleForm } from './setup';
  161. import { _closeModal } from '@/common/setup/modal/modal';
  162. export default defineComponent({
  163. name: 'purchase_pending_someprice',
  164. components: {},
  165. emits: ['cancel', 'update'],
  166. props: {
  167. selectedRow: {
  168. type: Object as PropType<Ermcp3SellBuyContract>,
  169. default: {},
  170. },
  171. },
  172. setup(props, context) {
  173. const { visible, cancel } = _closeModal(context);
  174. const loading = ref<boolean>(false);
  175. const { rules, formState, formRef } = handleForm();
  176. function submit() {
  177. const wrapEl = unref(formRef);
  178. wrapEl.validate().then(() => {
  179. loading.value = true;
  180. const params: SomePriceReq = {
  181. PricedPrice: Number(formState.PricedPrice),
  182. PricedQty: Number(formState.PricedQty),
  183. };
  184. // 发出点价请求
  185. somePriceReq(props.selectedRow.spotcontractid, params, loading)
  186. .then((res) => {
  187. cancel(true);
  188. })
  189. .catch((err) => {});
  190. });
  191. }
  192. return {
  193. visible,
  194. cancel,
  195. submit,
  196. loading,
  197. formRef,
  198. formState,
  199. formatValue,
  200. rules,
  201. getPriceTypeName,
  202. };
  203. },
  204. });
  205. </script>
  206. <style lang="less">
  207. .someprice {
  208. .ant-modal-content {
  209. .ant-modal-body {
  210. padding: 24px;
  211. }
  212. }
  213. legend {
  214. width: auto;
  215. margin-left: 20px;
  216. font-size: 16px;
  217. color: @m-white0;
  218. border-bottom: 0;
  219. padding: 0 10px;
  220. }
  221. }
  222. </style>;