serviceInfo.js 8.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238
  1. import { required, mobileRequired, mobile, httpUrl, email } from '@/components/template/rules_verify.js'
  2. import { increOrderSettleGetBrand, increOrderSettleGetCategoryList, increOrderSettleGetIncreItem, increOrderSettleGetWebsit } from "@/api/orderSettleManag.js"
  3. export default {
  4. data() {
  5. return {
  6. brandList: [],
  7. mainList: [],
  8. increContentList: [],
  9. websitList: []
  10. }
  11. },
  12. computed: {
  13. serviceInfo() {
  14. return [
  15. {
  16. name: 'el-select',
  17. md: 6,
  18. attributes: { disabled: false, placeholder: '请输入' },
  19. formItemAttributes: {
  20. label: '服务类型',
  21. prop: 'increType',
  22. rules: [...required]
  23. },
  24. options: [{ label: "延保", value: 1 }],
  25. },
  26. {
  27. name: 'el-input',
  28. md: 6,
  29. attributes: { disabled: true, placeholder: '请输入' },
  30. formItemAttributes: {
  31. label: '使用类型',
  32. prop: 'shiyongleixing',
  33. rules: [...required]
  34. }
  35. },
  36. {
  37. name: 'el-select',
  38. md: 6,
  39. options: this.brandList,
  40. formItemAttributes: {
  41. label: '产品品牌',
  42. prop: 'brandId',
  43. rules: [...required]
  44. },
  45. attributes: { disabled: false, clearable: true, filterable: true, placeholder: '请选择' },
  46. events: {
  47. change: (val) => {
  48. this.mainList = []
  49. this.increContentList = []
  50. this.websitList = []
  51. this.addFormData.brandName = ""
  52. this.addFormData.mainId = ""
  53. this.addFormData.mainName = ""
  54. this.addFormData.mainImg = ""
  55. this.addFormData.increContent = ""
  56. this.addFormData.pgIncreId = ""
  57. this.addFormData.limitNum = ""
  58. this.addFormData.amount = ""
  59. this.addFormData.pgIncreItemId = ""
  60. this.addFormData.websitId = ""
  61. this.addFormData.websitName = ""
  62. if (val) {
  63. this.addFormData.brandName = this.brandList.find(item => item.value === val)?.label
  64. increOrderSettleGetCategoryList({ brand: this.addFormData.brandName }).then(res => {
  65. this.mainList = res.data.map(item => ({
  66. label: item.name,
  67. value: item.categoryId,
  68. data: item
  69. }))
  70. })
  71. }
  72. }
  73. }
  74. },
  75. {
  76. name: 'el-select',
  77. md: 6,
  78. options: this.mainList,
  79. formItemAttributes: {
  80. label: '产品大类',
  81. prop: 'mainId',
  82. rules: [...required]
  83. },
  84. attributes: { disabled: false, clearable: true, filterable: true, placeholder: '请选择' },
  85. events: {
  86. change: (val) => {
  87. this.increContentList = []
  88. this.websitList = []
  89. this.addFormData.mainName = ""
  90. this.addFormData.mainImg = ""
  91. this.addFormData.increContent = ""
  92. this.addFormData.pgIncreId = ""
  93. this.addFormData.limitNum = ""
  94. this.addFormData.amount = ""
  95. this.addFormData.pgIncreItemId = ""
  96. this.addFormData.websitId = ""
  97. this.addFormData.websitName = ""
  98. if (val) {
  99. this.addFormData.mainName = this.mainList.find(item => item.value === val)?.label
  100. this.addFormData.mainImg = this.mainList.find(item => item.value === val)?.data?.imgUrl
  101. increOrderSettleGetIncreItem({
  102. brand: this.addFormData.brandName,
  103. mainName: this.addFormData.mainName
  104. }).then(res => {
  105. this.increContentList = res.data.map(item => ({
  106. label: item.content,
  107. value: item.increId,
  108. data: item
  109. }))
  110. })
  111. }
  112. }
  113. }
  114. },
  115. {
  116. name: 'el-select',
  117. md: 12,
  118. formItemAttributes: {
  119. label: '服务内容',
  120. prop: 'pgIncreId',
  121. rules: [...required],
  122. },
  123. options: this.increContentList,
  124. attributes: { disabled: false, clearable: true, filterable: true, placeholder: '请选择' },
  125. events: {
  126. change: (val) => {
  127. this.websitList = []
  128. this.addFormData.limitNum = ""
  129. this.addFormData.amount = ""
  130. this.addFormData.pgIncreItemId = ""
  131. this.addFormData.websitId = ""
  132. this.addFormData.websitName = ""
  133. this.addFormData.serviceEndTime = ""
  134. this.addFormData.increContent = ""
  135. if (val) {
  136. var data = this.increContentList.find(item => item.value === val)
  137. this.addFormData.increContent = data.data.content;
  138. this.addFormData.limitNum = data.data.limitNum;
  139. this.addFormData.amount = data.data.amount;
  140. this.addFormData.pgIncreItemId = data.data.id;
  141. if (this.addFormData.insureTime && this.addFormData.limitNum) {
  142. // 初始日期
  143. const initialDate = new Date(this.addFormData.insureTime);
  144. // 加上三年
  145. initialDate.setFullYear(initialDate.getFullYear() + (this.addFormData.limitNum || 0));
  146. // 获取新的日期
  147. this.addFormData.serviceEndTime = initialDate.toISOString().split('T')[0];
  148. }
  149. increOrderSettleGetWebsit({
  150. increId: val
  151. }).then(res => {
  152. this.websitList = res.data.map(item => ({
  153. value: item.websitId,
  154. label: item.websitName,
  155. }))
  156. })
  157. }
  158. }
  159. }
  160. },
  161. {
  162. name: 'el-input',
  163. md: 6,
  164. attributes: { disabled: true, placeholder: '请输入' },
  165. formItemAttributes: {
  166. label: '使用限值',
  167. prop: 'limitNum',
  168. rules: [...required]
  169. },
  170. events: {
  171. change: (val) => {
  172. if (this.addFormData.insureTime && val) {
  173. // 初始日期
  174. const initialDate = new Date(this.addFormData.insureTime);
  175. // 加上三年
  176. initialDate.setFullYear(initialDate.getFullYear() + (val || 0));
  177. // 获取新的日期
  178. this.addFormData.serviceEndTime = initialDate.toISOString().split('T')[0];
  179. } else {
  180. this.addFormData.serviceEndTime = ""
  181. }
  182. }
  183. }
  184. },
  185. {
  186. name: 'el-input',
  187. md: 6,
  188. attributes: { disabled: false, placeholder: '请输入', type: 'number' },
  189. formItemAttributes: {
  190. label: '服务金额',
  191. prop: 'amount',
  192. rules: [...required]
  193. }
  194. },
  195. {
  196. name: 'el-select',
  197. md: 12,
  198. formItemAttributes: {
  199. label: '销售网点',
  200. prop: 'websitId',
  201. rules: [...required],
  202. },
  203. options: this.websitList,
  204. attributes: { disabled: false, clearable: true, filterable: true, placeholder: '请选择' },
  205. events: {
  206. change: (val) => {
  207. this.addFormData.websitName = ""
  208. if (val) {
  209. this.addFormData.websitName = this.websitList.find(item => item.value === val)?.label
  210. }
  211. }
  212. }
  213. },
  214. {
  215. name: 'el-radio',
  216. md: 12,
  217. formItemAttributes: {
  218. label: '支付方式',
  219. prop: 'payType',
  220. rules: [...required],
  221. },
  222. options: [{ label: "微信支付", value: 1 }, { label: "现金支付", value: 3 }],
  223. attributes: { disabled: false, placeholder: '请选择' },
  224. },
  225. ]
  226. }
  227. },
  228. methods: {
  229. getincreOrderSettleGetBrand() {
  230. increOrderSettleGetBrand().then(res => {
  231. this.brandList = res.data.map(item => ({
  232. label: item.brandName,
  233. value: item.id
  234. }))
  235. })
  236. }
  237. }
  238. }