index.vue 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259
  1. <template>
  2. <view class="jnpf-wrap jnpf-wrap-workflow">
  3. <u-form :model="dataForm" :rules="rules" ref="dataForm" :errorType="['toast']" label-position="left"
  4. label-width="150" label-align="left">
  5. <view class="u-p-l-20 u-p-r-20 form-item-box">
  6. <u-form-item label="流程标题" prop="flowTitle" :required="requiredList.flowTitle"
  7. v-if="judgeShow('flowTitle')">
  8. <u-input v-model="dataForm.flowTitle" placeholder="流程标题" :disabled="judgeWrite('flowTitle')"
  9. input-align="right"></u-input>
  10. </u-form-item>
  11. <u-form-item label="流程编码" prop="billNo" v-if="judgeShow('billNo')" :required="requiredList.billNo">
  12. <u-input v-model="dataForm.billNo" placeholder="流程编码" disabled input-align="right"></u-input>
  13. </u-form-item>
  14. </view>
  15. <view class="jnpf-card">
  16. <view class="u-p-l-20 u-p-r-20 form-item-box">
  17. <u-form-item label="客户名称" prop="customerName" v-if="judgeShow('customerName')"
  18. :required="requiredList.customerName">
  19. <u-input v-model="dataForm.customerName" placeholder="请输入客户名称"
  20. :disabled="judgeWrite('customerName')" input-align="right"></u-input>
  21. </u-form-item>
  22. <u-form-item label="联系人员" prop="contacts" v-if="judgeShow('contacts')"
  23. :required="requiredList.contacts">
  24. <u-input v-model="dataForm.contacts" placeholder="请输入联系人员" :disabled="judgeWrite('contacts')"
  25. input-align="right">
  26. </u-input>
  27. </u-form-item>
  28. <u-form-item label="开单日期" prop="salesDate" v-if="judgeShow('salesDate')"
  29. :required="requiredList.salesDate">
  30. <JnpfDatePicker type="datetime" v-model="dataForm.salesDate" placeholder="请输入开单日期"
  31. :disabled="judgeWrite('salesDate')" />
  32. </u-form-item>
  33. <u-form-item label="联系电话" prop="contactPhone" v-if="judgeShow('contactPhone')"
  34. :required="requiredList.contactPhone">
  35. <u-input v-model="dataForm.contactPhone" placeholder="请输入联系电话"
  36. :disabled="judgeWrite('contactPhone')" input-align="right"></u-input>
  37. </u-form-item>
  38. <u-form-item label="客户地址" prop="customerAddres" v-if="judgeShow('customerAddres')"
  39. :required="requiredList.customerAddres">
  40. <u-input v-model="dataForm.customerAddres" placeholder="输入送客户地址"
  41. :disabled="judgeWrite('customerAddres')" input-align="right"></u-input>
  42. </u-form-item>
  43. <u-form-item label="业务人员" prop="salesman" v-if="judgeShow('salesman')"
  44. :required="requiredList.salesman">
  45. <u-input v-model="dataForm.salesman" placeholder="输入业务人员" :disabled="judgeWrite('salesman')"
  46. input-align="right">
  47. </u-input>
  48. </u-form-item>
  49. <u-form-item label="发票编号" prop="ticketNum" v-if="judgeShow('ticketNum')"
  50. :required="requiredList.ticketNum">
  51. <u-input v-model="dataForm.ticketNum" placeholder="输入发票编号" :disabled="judgeWrite('ticketNum')"
  52. input-align="right">
  53. </u-input>
  54. </u-form-item>
  55. <u-form-item label="发票类型" prop="invoiceType" v-if="judgeShow('invoiceType')"
  56. :required="requiredList.invoiceType">
  57. <JnpfSelect v-model="dataForm.invoiceType" placeholder="请选择发票类型" :options="invoiceTypeList"
  58. :disabled="judgeWrite('invoiceType')" />
  59. </u-form-item>
  60. <u-form-item label="付款方式" prop="paymentMethod" v-if="judgeShow('paymentMethod')"
  61. :required="requiredList.paymentMethod">
  62. <u-input v-model="dataForm.paymentMethod" placeholder="请输入付款方式" input-align="right"
  63. :disabled="judgeWrite('paymentMethod')">
  64. </u-input>
  65. </u-form-item>
  66. <u-form-item label="付款金额" prop="paymentMoney" v-if="judgeShow('paymentMoney')"
  67. :required="requiredList.paymentMoney">
  68. <u-input v-model="dataForm.paymentMoney" placeholder="输入付款金额"
  69. :disabled="judgeWrite('paymentMoney')" input-align="right"></u-input>
  70. </u-form-item>
  71. <!-- #ifndef APP-HARMONY -->
  72. <u-form-item label="相关附件" prop="fileJson" v-if="judgeShow('fileJson')"
  73. :required="requiredList.fileJson">
  74. <JnpfUploadFile v-model="fileList" :disabled="judgeWrite('fileJson')" />
  75. </u-form-item>
  76. <!-- #endif -->
  77. <u-form-item label="开单备注" prop="description" v-if="judgeShow('description')"
  78. :required="requiredList.description">
  79. <u-input v-model="dataForm.description" placeholder="输入开单备注" type="textarea"
  80. :disabled="judgeWrite('description')" input-align="right"></u-input>
  81. </u-form-item>
  82. </view>
  83. </view>
  84. <view class="jnpf-table" v-if="judgeShow('entryList')">
  85. <view class="jnpf-table-item-title u-flex u-row-between">
  86. <text class="jnpf-table-item-title-num">销售明细</text>
  87. </view>
  88. <view class="jnpf-table-item" v-for="(item,i) in dataForm.entryList" :key="i">
  89. <view class="jnpf-table-item-title u-flex u-row-between">
  90. <text class="jnpf-table-item-title-num">({{i+1}})</text>
  91. <view class="jnpf-table-delete-btn" v-if="!judgeWrite('entryList')" @click="delItem(i)">
  92. 删除
  93. </view>
  94. </view>
  95. <view class="u-p-l-20 u-p-r-20 form-item-box">
  96. <u-form-item label="商品名称" prop="dataForm.entryList[i].goodsName"
  97. v-if="judgeShow('entryList-goodsName')" :required="requiredList['entryList-goodsName']">
  98. <u-input v-model="dataForm.entryList[i].goodsName" placeholder="请输入商品名称"
  99. :disabled="judgeWrite('entryList-goodsName')" input-align="right"></u-input>
  100. </u-form-item>
  101. <u-form-item label="规格类型" prop="dataForm.entryList[i].specifications"
  102. v-if="judgeShow('entryList-specifications')"
  103. :required="requiredList['entryList-specifications']">
  104. <u-input v-model="dataForm.entryList[i].specifications" placeholder="请输入规格类型"
  105. :disabled="judgeWrite('entryList-specifications')" input-align="right"></u-input>
  106. </u-form-item>
  107. <u-form-item label="单位" prop="dataForm.entryList[i].unit" v-if="judgeShow('entryList-unit')"
  108. :required="requiredList['entryList-unit']">
  109. <u-input v-model="dataForm.entryList[i].unit" placeholder="请输入单位"
  110. :disabled="judgeWrite('entryList-unit')" input-align="right"></u-input>
  111. </u-form-item>
  112. <u-form-item label="数量" prop="dataForm.entryList[i].qty" v-if="judgeShow('entryList-qty')"
  113. :required="requiredList['entryList-qty']">
  114. <u-input v-model="dataForm.entryList[i].qty" placeholder="请输入数量" type="number"
  115. input-align="right" @input="count(dataForm.entryList[i])"
  116. :disabled="judgeWrite('entryList-qty')"></u-input>
  117. </u-form-item>
  118. <u-form-item label="单价" prop="dataForm.entryList[i].price" v-if="judgeShow('entryList-price')"
  119. :required="requiredList['entryList-price']">
  120. <u-input v-model="dataForm.entryList[i].price" placeholder="请输入单价" type="number"
  121. @input="count(dataForm.entryList[i])" input-align="right"
  122. :disabled="judgeWrite('entryList-price')"></u-input>
  123. </u-form-item>
  124. <u-form-item label="金额" prop="dataForm.entryList[i].amount" v-if="judgeShow('entryList-amount')"
  125. :required="requiredList['entryList-amount']">
  126. <u-input v-model="dataForm.entryList[i].amount" type="number" placeholder="请输入金额" disabled
  127. input-align="right"></u-input>
  128. </u-form-item>
  129. <u-form-item label="备注" prop="dataForm.entryList[i].description"
  130. v-if="judgeShow('entryList-description')" :required="requiredList['entryList-description']">
  131. <u-input v-model="dataForm.entryList[i].description" placeholder="请输入备注" type="textarea"
  132. :disabled="judgeWrite('entryList-description')" input-align="right"></u-input>
  133. </u-form-item>
  134. </view>
  135. </view>
  136. <view class="jnpf-table-addBtn" @click="addItem" v-if="!judgeWrite('entryList')">
  137. <u-icon name="plus" color="#2979ff"></u-icon>添加
  138. </view>
  139. </view>
  140. </u-form>
  141. </view>
  142. </template>
  143. <script>
  144. import comMixin from '../mixin'
  145. export default {
  146. name: 'SalesOrder',
  147. mixins: [comMixin],
  148. data() {
  149. return {
  150. billEnCode: 'WF_SalesOrderNo',
  151. dataForm: {
  152. flowTitle: '',
  153. billNo: '',
  154. flowUrgent: 1,
  155. customerAddres: '',
  156. contactPhone: '',
  157. description: '',
  158. fileJson: '',
  159. salesman: '',
  160. paymentMoney: undefined,
  161. paymentMethod: '',
  162. invoiceType: '',
  163. salesDate: undefined,
  164. contacts: '',
  165. customerName: '',
  166. entryList: []
  167. },
  168. invoiceTypeList: [{
  169. fullName: "普通发票",
  170. id: "普通发票",
  171. checked: false
  172. },
  173. {
  174. fullName: "专业发票",
  175. id: "专业发票",
  176. checked: false
  177. },
  178. {
  179. fullName: "其他",
  180. id: "其他",
  181. checked: false
  182. }
  183. ],
  184. rules: {
  185. flowTitle: [{
  186. required: true,
  187. message: '流程标题不能为空',
  188. trigger: 'blur'
  189. }],
  190. flowUrgent: [{
  191. required: true,
  192. message: '紧急程度不能为空',
  193. trigger: 'change',
  194. type: 'number'
  195. }],
  196. billNo: [{
  197. required: true,
  198. message: '流程编码不能为空',
  199. trigger: 'blur',
  200. }],
  201. salesDate: [{
  202. required: true,
  203. message: '开单日期不能为空',
  204. trigger: 'change',
  205. type: 'number'
  206. }]
  207. },
  208. }
  209. },
  210. methods: {
  211. selfInit(data) {
  212. this.dataForm.flowTitle = this.userInfo.userName + "的销售订单";
  213. },
  214. /* 添加子表 */
  215. addItem() {
  216. const item = {
  217. goodsName: '',
  218. specifications: '',
  219. unit: '',
  220. qty: undefined,
  221. price: undefined,
  222. amount: undefined,
  223. description: ''
  224. }
  225. this.dataForm.entryList.push(item)
  226. },
  227. /* 删除子表 */
  228. delItem(index) {
  229. uni.showModal({
  230. title: '提示',
  231. content: '确定删除销售明细(' + (index + 1) + ')?',
  232. success: (res) => {
  233. if (res.confirm) {
  234. this.dataForm.entryList.splice(index, 1)
  235. }
  236. }
  237. })
  238. },
  239. /* 计算价格 */
  240. count(row) {
  241. //金额 = 数量*单价
  242. row.amount = this.jnpf.toDecimal(parseFloat(row.price) * parseFloat(row.qty))
  243. //折扣价 = (单价*折扣)
  244. var discountPrice = row.price * (row.discount / 100);
  245. //实际单价 = 折扣价 * (1 + (税率 / 100))
  246. row.actualPrice = this.jnpf.toDecimal(discountPrice * (1 + (row.cess / 100)));
  247. //实际金额
  248. row.actualAmount = this.jnpf.toDecimal(parseFloat(row.actualPrice) * parseFloat(row
  249. .qty))
  250. this.$forceUpdate()
  251. },
  252. }
  253. }
  254. </script>
  255. <style>
  256. </style>