editPrice.vue 23 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743
  1. <template>
  2. <div class="edit-price">
  3. <custom-header name="飞鸟管家"></custom-header>
  4. <div class="edit-form">
  5. <el-form ref="formRef" :model="form" :rules="rules" label-width="80px">
  6. <el-form-item label="药肥名称" prop="id" required>
  7. <el-select v-model="form.id" placeholder="请选择" filterable clearable style="width: 100%">
  8. <el-option v-for="opt in pesticideOptions" :key="opt.id" :label="opt.name" :value="opt.id" />
  9. </el-select>
  10. </el-form-item>
  11. <el-form-item label="药肥品牌" prop="brand" required>
  12. <el-input class="has-border" v-model="form.brand" placeholder="请输入" />
  13. </el-form-item>
  14. <el-form-item label="药肥类型" required prop="typeId">
  15. <div class="row-3-selects">
  16. <field
  17. v-model="fieldValue"
  18. is-link
  19. readonly
  20. label=""
  21. placeholder="请选择药肥类型"
  22. @click="showCascader = true"
  23. />
  24. <popup v-model:show="showCascader" round position="bottom">
  25. <cascader
  26. v-model="cascaderValue"
  27. aria-hidden="false"
  28. title="请选择药肥类型"
  29. :options="typeOptions"
  30. :field-names="cascaderProps"
  31. @close="showCascader = false"
  32. @finish="onFinish"
  33. />
  34. </popup>
  35. </div>
  36. </el-form-item>
  37. <el-form-item label="计量单位" prop="unit" required>
  38. <el-radio-group v-model="form.unit">
  39. <el-radio value="克">克</el-radio>
  40. <el-radio value="千克">千克</el-radio>
  41. <el-radio value="毫升">毫升</el-radio>
  42. <el-radio value="升">升</el-radio>
  43. </el-radio-group>
  44. </el-form-item>
  45. <el-form-item label="施用方式" prop="method" required>
  46. <el-radio-group v-model="form.method">
  47. <el-radio value="1">叶面施</el-radio>
  48. <el-radio value="2">根部施</el-radio>
  49. </el-radio-group>
  50. </el-form-item>
  51. <el-form-item label="药肥成本" prop="cost" required class="input-unit">
  52. <el-input v-model="form.cost" type="number" step="0.01" placeholder="请输入">
  53. <template #append>元/{{ form.unit }}</template>
  54. </el-input>
  55. </el-form-item>
  56. <el-form-item label="药肥报价" prop="price" required class="input-unit">
  57. <el-input v-model="form.price" type="number" step="0.01" placeholder="请输入">
  58. <template #append>元/{{ form.unit }}</template>
  59. </el-input>
  60. </el-form-item>
  61. <el-form-item label="药肥库存" prop="stock" required class="input-unit">
  62. <el-input v-model="form.stock" type="number" step="0.01" placeholder="请输入">
  63. <template #append>{{ form.unit }}</template>
  64. </el-input>
  65. </el-form-item>
  66. <el-form-item label="单位兑水" class="input-unit">
  67. <div class="water-row">
  68. <el-input v-model="form.waterMin" type="number" step="0.01" placeholder="请输入兑水量">
  69. <template #append>{{ form.unit }}</template>
  70. </el-input>
  71. <span>-</span>
  72. <el-input v-model="form.waterMax" type="number" step="0.01" placeholder="请输入兑水量">
  73. <template #append>{{ form.unit }}</template>
  74. </el-input>
  75. </div>
  76. </el-form-item>
  77. <el-form-item label="适用品类">
  78. <el-select
  79. v-model="form.speciesIds"
  80. multiple
  81. placeholder="请选择"
  82. filterable
  83. clearable
  84. style="width: 100%"
  85. >
  86. <el-option v-for="(opt, optI) in specieList" :key="optI" :label="opt.name" :value="opt.id" />
  87. </el-select>
  88. </el-form-item>
  89. </el-form>
  90. </div>
  91. <div class="page-action">
  92. <div class="btn-item del" v-if="!isAdd" @click="openDelete">删除</div>
  93. <div class="btn-item cancel" v-if="isAdd" @click="goBack">取消</div>
  94. <div class="btn-right">
  95. <div class="btn-item cancel" v-if="!isAdd" @click="goBack">取消编辑</div>
  96. <div class="btn-item primary" @click="handleSave">{{ isAdd ? "新增报价" : "保存报价" }}</div>
  97. </div>
  98. </div>
  99. </div>
  100. </template>
  101. <script setup>
  102. import customHeader from "@/components/customHeader.vue";
  103. import { ElMessage, ElMessageBox } from "element-plus";
  104. import { useRouter, useRoute } from "vue-router";
  105. import { ref, reactive, onMounted, onActivated, onUnmounted, onDeactivated, watch } from "vue";
  106. import { Cascader, Popup, Field } from "vant";
  107. const router = useRouter();
  108. const route = useRoute();
  109. const isAdd = ref(false);
  110. const goBack = () => {
  111. router.back();
  112. };
  113. const showCascader = ref(false);
  114. const fieldValue = ref("");
  115. const cascaderValue = ref("");
  116. // 全部选项选择完毕后,会触发 finish 事件
  117. const onFinish = ({ selectedOptions }) => {
  118. showCascader.value = false;
  119. fieldValue.value = selectedOptions.map((option) => option.name).join(" / ");
  120. form.typeId = selectedOptions[selectedOptions.length - 1].id;
  121. };
  122. const openDelete = () => {
  123. ElMessageBox.confirm("确认要删除该报价吗?", "提示", {
  124. confirmButtonText: "确认",
  125. cancelButtonText: "取消",
  126. type: "warning",
  127. })
  128. .then(() => {
  129. VE_API.z_farm_work_pesticide_fertilizer.deleteFertilizer({ agriculturalStoreId: detailData.value.agriculturalStoreId, pesticideFertilizerId: detailData.value.id }).then((res) => {
  130. if (res.code === 0) {
  131. ElMessage.success("删除成功");
  132. router.back();
  133. }
  134. });
  135. })
  136. .catch(() => {});
  137. };
  138. // 表单模型与选项
  139. const formRef = ref();
  140. const form = reactive({
  141. id: "",
  142. typeId: null,
  143. brand: "",
  144. type1: "",
  145. type2: "",
  146. type3: "",
  147. unit: "克",
  148. method: "1",
  149. cost: null,
  150. price: null,
  151. stock: null,
  152. waterMin: null,
  153. waterMax: null,
  154. speciesIds: [],
  155. });
  156. const rules = {
  157. id: [{ required: true, message: "请选择药肥名称", trigger: "change" }],
  158. brand: [{ required: true, message: "请选择药肥品牌", trigger: "change" }],
  159. typeId: [{ required: true, message: "请选择药肥类型", trigger: "change" }],
  160. unit: [{ required: true, message: "请选择计量单位", trigger: "change" }],
  161. method: [{ required: true, message: "请选择施用方式", trigger: "change" }],
  162. cost: [{ required: true, message: "请输入成本", trigger: "blur" }],
  163. price: [{ required: true, message: "请输入报价", trigger: "blur" }],
  164. stock: [{ required: true, message: "请输入库存", trigger: "blur" }],
  165. };
  166. // 单位转换映射
  167. const unitMap = {
  168. kg: "千克",
  169. g: "克",
  170. ml: "毫升",
  171. l: "升",
  172. 千克: "千克",
  173. 克: "克",
  174. 毫升: "毫升",
  175. 升: "升",
  176. };
  177. // 施用方式转换映射
  178. const methodMap = {
  179. 叶面施: "1",
  180. 根部施: "2",
  181. };
  182. const cascaderProps = {
  183. value: "id",
  184. text: "name",
  185. children: "children",
  186. };
  187. onMounted(() => {
  188. getSpecieList();
  189. fetchPesticideOptions();
  190. fetchTypeOptions();
  191. // 首次加载时初始化表单
  192. if (isAdd.value) {
  193. initForm();
  194. } else {
  195. getDetail();
  196. }
  197. });
  198. const specieList = ref([]);
  199. function getSpecieList() {
  200. VE_API.farm.fetchSpecieList().then(({ data }) => {
  201. specieList.value = data;
  202. });
  203. }
  204. // 递归清理空的 children 属性
  205. const cleanEmptyChildren = (data) => {
  206. if (!Array.isArray(data)) {
  207. return data;
  208. }
  209. return data.map((item) => {
  210. const newItem = { ...item };
  211. if (newItem.children) {
  212. if (Array.isArray(newItem.children) && newItem.children.length > 0) {
  213. // 递归处理子项
  214. newItem.children = cleanEmptyChildren(newItem.children);
  215. } else {
  216. // 如果 children 为空数组或不存在,删除该属性
  217. delete newItem.children;
  218. }
  219. }
  220. return newItem;
  221. });
  222. };
  223. // 用途类型选项
  224. const typeOptions = ref([]);
  225. function fetchTypeOptions() {
  226. if (typeOptions.value.length === 0) {
  227. VE_API.z_farm_work_pesticide_fertilizer.typeList().then((res) => {
  228. if (res.code === 0) {
  229. // 清理空的 children 属性
  230. typeOptions.value = cleanEmptyChildren(res.data || []);
  231. }
  232. });
  233. }
  234. }
  235. /**
  236. * 获取药肥选项
  237. */
  238. const pesticideOptions = ref([]);
  239. function fetchPesticideOptions() {
  240. // 每次都重新获取药肥选项,确保数据是最新的
  241. VE_API.z_farm_work_pesticide_fertilizer
  242. .selectOption()
  243. .then((res) => {
  244. if (res.code === 0) {
  245. pesticideOptions.value = res.data || [];
  246. }
  247. })
  248. .catch(() => {
  249. // 获取药肥选项失败
  250. });
  251. }
  252. // 根据 typeId 查找路径数组
  253. const findPathByTypeId = (options, targetId, path = []) => {
  254. for (const option of options) {
  255. const currentPath = [...path, option.id];
  256. if (option.id === targetId) {
  257. return currentPath;
  258. }
  259. if (option.children && option.children.length > 0) {
  260. const found = findPathByTypeId(option.children, targetId, currentPath);
  261. if (found) return found;
  262. }
  263. }
  264. return null;
  265. };
  266. // 根据 typeId 查找显示文本
  267. const findTextByTypeId = (options, targetId) => {
  268. for (const option of options) {
  269. if (option.id === targetId) {
  270. return option.name;
  271. }
  272. if (option.children && option.children.length > 0) {
  273. const found = findTextByTypeId(option.children, targetId);
  274. if (found) return found;
  275. }
  276. }
  277. return "";
  278. };
  279. // 根据 typeId 设置级联选择器的默认值
  280. const setCascaderDefaultValue = (typeId) => {
  281. if (!typeId || !typeOptions.value.length) {
  282. return;
  283. }
  284. // 查找路径数组
  285. const path = findPathByTypeId(typeOptions.value, typeId);
  286. if (path && path.length > 0) {
  287. cascaderValue.value = path;
  288. // 查找显示文本(完整路径)
  289. const pathNames = [];
  290. let current = typeOptions.value;
  291. for (const id of path) {
  292. const option = current.find(opt => opt.id === id);
  293. if (option) {
  294. pathNames.push(option.name);
  295. current = option.children || [];
  296. }
  297. }
  298. if (pathNames.length > 0) {
  299. fieldValue.value = pathNames.join(" / ");
  300. }
  301. }
  302. };
  303. // 监听 typeOptions 变化,当数据加载完成后自动设置默认值
  304. watch(
  305. () => typeOptions.value,
  306. (newOptions) => {
  307. if (newOptions.length > 0 && form.typeId) {
  308. setCascaderDefaultValue(form.typeId);
  309. }
  310. },
  311. { deep: true }
  312. );
  313. // 获取详情数据
  314. const detailData = ref({});
  315. const getDetail = () => {
  316. const id = route.query.id;
  317. if (!id || isAdd.value) {
  318. return;
  319. }
  320. VE_API.z_farm_work_pesticide_fertilizer
  321. .fertilizerDetail({ id })
  322. .then(({ data }) => {
  323. if (data) {
  324. detailData.value = data;
  325. // 赋值表单数据
  326. form.id = data.id || "";
  327. form.brand = data.brand || "";
  328. form.typeId = data.typeId || null;
  329. // 转换单位
  330. form.unit = unitMap[data.unit] || data.unit || "克";
  331. // 转换施用方式
  332. if (data.usageModeList && data.usageModeList.length > 0) {
  333. const firstMode = data.usageModeList[0];
  334. form.method = methodMap[firstMode] || firstMode;
  335. }
  336. form.cost = data.cost || null;
  337. form.price = data.price || null;
  338. form.stock = data.stock || null;
  339. form.waterMin = data.unitWaterAmount || null;
  340. form.waterMax = data.unitWaterAmountMax || null;
  341. // 适用品种
  342. if (data.speciesList && Array.isArray(data.speciesList) && data.speciesList.length > 0) {
  343. form.speciesIds = data.speciesList.map(item => item.id);
  344. } else {
  345. form.speciesIds = [];
  346. }
  347. console.log("form.speciesIds", form.speciesIds, data.speciesList);
  348. // 设置级联选择器的默认值(watch 会自动处理)
  349. if (form.typeId && typeOptions.value.length > 0) {
  350. setCascaderDefaultValue(form.typeId);
  351. }
  352. }
  353. })
  354. .catch(() => {
  355. ElMessage.error("获取详情失败");
  356. });
  357. };
  358. // 重置表单数据
  359. const resetForm = () => {
  360. form.id = "";
  361. form.typeId = null;
  362. form.brand = "";
  363. form.type1 = "";
  364. form.type2 = "";
  365. form.type3 = "";
  366. form.unit = "克";
  367. form.method = "1";
  368. form.cost = null;
  369. form.price = null;
  370. form.stock = null;
  371. form.waterMin = null;
  372. form.waterMax = null;
  373. form.speciesIds = [];
  374. // 重置级联选择器
  375. showCascader.value = false;
  376. fieldValue.value = "";
  377. cascaderValue.value = "";
  378. // 清除表单验证状态
  379. if (formRef.value) {
  380. formRef.value.resetFields();
  381. // formRef.value.clearValidate();
  382. }
  383. };
  384. // 初始化表单数据(新增模式)
  385. const initForm = () => {
  386. resetForm();
  387. // 新增模式下的默认值
  388. form.unit = "克";
  389. form.method = "1";
  390. };
  391. onActivated(() => {
  392. isAdd.value = route.query.isAdd ? true : false;
  393. // 进入页面时,如果是新增模式,初始化表单;如果是编辑模式,获取详情
  394. if (isAdd.value) {
  395. initForm();
  396. } else {
  397. getDetail();
  398. }
  399. });
  400. onDeactivated(() => {
  401. // 离开页面时清除数据
  402. resetForm();
  403. });
  404. onUnmounted(() => {
  405. // 组件卸载时也清除数据
  406. resetForm();
  407. });
  408. // 根据路径数组获取三级分类名称
  409. const getCategoryNamesByPath = (path) => {
  410. if (!path || path.length === 0 || !typeOptions.value.length) {
  411. return {
  412. categoryLevel1Name: "",
  413. categoryLevel2Name: "",
  414. categoryLevel3Name: "",
  415. };
  416. }
  417. const names = [];
  418. let current = typeOptions.value;
  419. for (let i = 0; i < path.length && i < 3; i++) {
  420. const option = current.find(opt => opt.id === path[i]);
  421. if (option) {
  422. names.push(option.name);
  423. current = option.children || [];
  424. } else {
  425. break;
  426. }
  427. }
  428. return {
  429. categoryLevel1Name: names[0] || "",
  430. categoryLevel2Name: names[1] || "",
  431. categoryLevel3Name: names[2] || "",
  432. };
  433. };
  434. // 获取选中的药肥信息
  435. const getSelectedPesticideFertilizer = () => {
  436. const selected = pesticideOptions.value.find(opt => opt.id === form.id);
  437. if (!selected) {
  438. return null;
  439. }
  440. return selected;
  441. };
  442. // 单位反向转换(将中文单位转换为英文)
  443. const reverseUnitMap = {
  444. 千克: "kg",
  445. 克: "g",
  446. 毫升: "ml",
  447. 升: "l",
  448. };
  449. // 保存方法
  450. const handleSave = async () => {
  451. // 表单验证
  452. try {
  453. await formRef.value.validate();
  454. } catch (error) {
  455. ElMessage.warning("请完善表单信息");
  456. return;
  457. }
  458. // 获取选中的药肥信息
  459. const selectedPesticide = getSelectedPesticideFertilizer();
  460. if (!selectedPesticide) {
  461. ElMessage.warning("请选择药肥名称");
  462. return;
  463. }
  464. // 获取三级分类名称
  465. const categoryNames = getCategoryNamesByPath(cascaderValue.value);
  466. // 转换施用方式
  467. const usageModeList = form.method === "1" ? ["叶面施"] : ["根部施"];
  468. // 转换单位(如果需要英文单位)
  469. const unit = reverseUnitMap[form.unit] || form.unit;
  470. // 转换适用品种(数组转字符串,用逗号分隔)
  471. // const speciesIds = Array.isArray(form.crops)
  472. // ? form.crops.join(",")
  473. // : (form.crops || "");
  474. // 构建请求参数
  475. const params = {
  476. pesticideFertilizer: {
  477. id: selectedPesticide.id || form.id,
  478. name: selectedPesticide.name || "",
  479. // pesticideFertilizerCode: selectedPesticide.code || "",
  480. // typeName: selectedPesticide.typeName || "",
  481. typeId: form.typeId,
  482. defaultName: selectedPesticide.name || "",
  483. unit: unit,
  484. // price: selectedPesticide.price || form.price || null,
  485. unitWaterAmount: form.waterMin ? Number(form.waterMin) : null,
  486. unitWaterAmountMax: form.waterMax ? Number(form.waterMax) : null,
  487. speciesIds: form.speciesIds,
  488. usageModeList: usageModeList,
  489. categoryLevel1Name: categoryNames.categoryLevel1Name,
  490. categoryLevel2Name: categoryNames.categoryLevel2Name,
  491. categoryLevel3Name: categoryNames.categoryLevel3Name,
  492. },
  493. price: form.price ? Number(form.price) : null,
  494. cost: form.cost ? Number(form.cost) : null,
  495. stock: form.stock ? Number(form.stock) : null,
  496. remark: selectedPesticide.remark || "",
  497. brand: form.brand,
  498. };
  499. // 调用保存接口
  500. VE_API.z_farm_work_pesticide_fertilizer
  501. .saveFertilizer(params)
  502. .then((res) => {
  503. if (res.code === 0) {
  504. ElMessage.success(isAdd.value ? "新增报价成功" : "保存报价成功");
  505. // 延迟返回,让用户看到成功提示
  506. setTimeout(() => {
  507. router.back();
  508. }, 1000);
  509. } else {
  510. ElMessage.error(res.message || "保存失败");
  511. }
  512. })
  513. .catch(() => {
  514. ElMessage.error("保存失败,请重试");
  515. });
  516. };
  517. </script>
  518. <style lang="scss" scoped>
  519. .edit-price {
  520. width: 100%;
  521. height: 100vh;
  522. background: #f5f7fb;
  523. .edit-form {
  524. margin: 12px;
  525. padding: 12px;
  526. background: #ffffff;
  527. .row-3-selects {
  528. width: 100%;
  529. display: flex;
  530. gap: 5px;
  531. ::v-deep {
  532. .van-cell {
  533. padding: 4px 10px;
  534. border: 1px solid rgba(33, 153, 248, 0.3);
  535. border-radius: 5px;
  536. box-sizing: border-box;
  537. }
  538. .van-field__control {
  539. color: #2199f8;
  540. &::placeholder {
  541. color: rgba(33, 153, 248, 0.43) !important;
  542. }
  543. }
  544. .van-cell__right-icon {
  545. color: #2199f8;
  546. transform: rotate(90deg);
  547. font-size: 14px;
  548. }
  549. .el-select__wrapper {
  550. padding: 2px 6px;
  551. }
  552. }
  553. > .el-select {
  554. flex: 1;
  555. }
  556. }
  557. .water-row {
  558. color: rgba(0, 0, 0, 0.1);
  559. display: flex;
  560. gap: 2px;
  561. > .el-input {
  562. flex: 1;
  563. }
  564. }
  565. ::v-deep {
  566. .el-form-item__label {
  567. color: rgba(29, 33, 41, 0.2);
  568. font-size: 14px;
  569. }
  570. .el-form-item--default {
  571. margin-bottom: 16px;
  572. }
  573. .el-select__input {
  574. color: #2199f8;
  575. }
  576. .el-select__wrapper {
  577. // height: 30px;
  578. color: #2199f8;
  579. min-height: 30px;
  580. line-height: 28px;
  581. box-shadow: 0 0 0 1px rgba(33, 153, 248, 0.3) inset;
  582. }
  583. .el-select__caret {
  584. color: #2199f8;
  585. }
  586. .el-select__placeholder {
  587. color: #2199f8;
  588. }
  589. .el-radio {
  590. margin-right: 16px;
  591. }
  592. .has-border,
  593. .el-cascader {
  594. .el-input__wrapper {
  595. box-shadow: 0 0 0 1px rgba(33, 153, 248, 0.3) inset;
  596. }
  597. }
  598. .el-tag.el-tag--info {
  599. --el-tag-text-color: #2199f8;
  600. --el-tag-bg-color: rgba(33, 153, 248, 0.1);
  601. }
  602. .el-input__wrapper {
  603. box-shadow: none;
  604. }
  605. .el-input__inner {
  606. color: #2199f8;
  607. --el-input-placeholder-color: rgba(33, 153, 248, 0.43);
  608. }
  609. .el-input-group__append {
  610. padding: 0 6px;
  611. background: none;
  612. box-shadow: none;
  613. }
  614. .el-input-group__append {
  615. color: rgba(33, 153, 248, 0.5);
  616. }
  617. .input-unit {
  618. .el-input {
  619. border: 1px solid rgba(33, 153, 248, 0.3);
  620. border-radius: 5px;
  621. height: 30px;
  622. box-sizing: border-box;
  623. }
  624. .el-input__wrapper {
  625. padding: 0 2px 0 10px;
  626. height: 28px;
  627. line-height: 28px;
  628. min-height: 28px;
  629. }
  630. .el-input__inner {
  631. --el-input-inner-height: 28px;
  632. height: 28px;
  633. line-height: 28px;
  634. min-height: 28px;
  635. color: #2199f8;
  636. --el-input-placeholder-color: rgba(33, 153, 248, 0.43);
  637. }
  638. }
  639. }
  640. }
  641. .page-action {
  642. position: fixed;
  643. left: 0;
  644. right: 0;
  645. bottom: 0;
  646. padding: 12px 12px;
  647. background: #fff;
  648. box-shadow: 2px 2px 4.5px rgba(0, 0, 0, 0.4);
  649. display: flex;
  650. justify-content: space-between;
  651. align-items: center;
  652. .btn-item {
  653. height: 40px;
  654. line-height: 41px;
  655. border-radius: 20px;
  656. width: fit-content;
  657. padding: 0 20px;
  658. color: #666666;
  659. font-size: 14px;
  660. &.del {
  661. color: #ff943d;
  662. background: rgba(255, 148, 61, 0.1);
  663. }
  664. &.cancel {
  665. border: 1px solid rgba(153, 153, 153, 0.5);
  666. }
  667. &.primary {
  668. color: #fff;
  669. background: linear-gradient(#76c3ff, #2199f8);
  670. }
  671. }
  672. .btn-right {
  673. display: flex;
  674. gap: 10px;
  675. }
  676. }
  677. }
  678. </style>
  679. <style lang="scss">
  680. // 针对特定作用域设置
  681. .edit-price {
  682. --van-field-placeholder-text-color: rgba(33, 153, 248, 0.43);
  683. }
  684. </style>