servicePackage.vue 56 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849
  1. <template>
  2. <el-tabs v-model="activeName" @tab-click="handleClick">
  3. <el-tab-pane label="服务套餐" name="first">
  4. <div style="display: inline-block; width: 100%">
  5. <div
  6. style="position: relative; display: inline-block; margin: 10px 0px"
  7. >
  8. <span>套餐名称:</span>
  9. <el-input
  10. style="width: 150px"
  11. @keydown.enter.native="shopSelect"
  12. placeholder="请输入套餐名称"
  13. v-model="name"
  14. >
  15. </el-input
  16. >&nbsp;&nbsp;
  17. </div>
  18. <div
  19. style="position: relative; display: inline-block; margin: 10px 0px"
  20. >
  21. <span>套餐类型:</span>
  22. <el-select
  23. v-model="setType"
  24. placeholder="请选择套餐类型"
  25. style="width: 150px"
  26. @change="search()"
  27. >
  28. <el-option label="月度套餐" value="1"></el-option>
  29. <el-option label="季度套餐" value="2"></el-option>
  30. <el-option label="年度套餐" value="3"></el-option>
  31. <el-option label="自定义" value="4"></el-option>
  32. </el-select>
  33. &nbsp;&nbsp;&nbsp;&nbsp;
  34. </div>
  35. <div
  36. style="position: relative; display: inline-block; margin: 10px 0px"
  37. >
  38. <span>套餐适用性别:</span>
  39. <el-select
  40. v-model="suitSex"
  41. placeholder="请选择套餐适用性别"
  42. style="width: 180px"
  43. @change="search()"
  44. >
  45. <el-option label="男生专区" value="1"></el-option>
  46. <el-option label="女生专区" value="2"></el-option> </el-select
  47. >&nbsp;&nbsp;&nbsp;&nbsp;
  48. </div>
  49. <el-button
  50. style="margin-left: 15px"
  51. size="mini"
  52. type="primary"
  53. icon="document"
  54. @click="search"
  55. >查询
  56. </el-button>
  57. <el-button
  58. style="margin-left: 15px"
  59. size="mini"
  60. type="primary"
  61. icon="document"
  62. @click="clean"
  63. >重置
  64. </el-button>
  65. <el-button
  66. size="mini"
  67. type="primary"
  68. icon="document"
  69. @click="addSetmeal"
  70. >添加套餐
  71. </el-button>
  72. <el-button
  73. size="mini"
  74. type="primary"
  75. icon="document"
  76. @click="delSetmeal"
  77. >批量删除
  78. </el-button>
  79. <el-button
  80. size="mini"
  81. type="primary"
  82. icon="document"
  83. @click="setmealImp"
  84. >导出
  85. </el-button>
  86. </div>
  87. <el-table
  88. v-loading="tableDataLoading"
  89. :data="typeDatas.list"
  90. row-key="id"
  91. @selection-change="handleSelectionChange"
  92. >
  93. <el-table-column type="selection" width="55"> </el-table-column>
  94. <el-table-column label="编号" type="index" width="80">
  95. </el-table-column>
  96. <el-table-column label="套餐名称" prop="name"> </el-table-column>
  97. <el-table-column prop="shopCover" label="套餐图片" width="150">
  98. <template slot-scope="scope">
  99. <div style="display: inline-block; margin: 3px">
  100. <el-popover
  101. placement="top-start"
  102. title=""
  103. trigger="hover"
  104. v-for="(i, ind) in scope.row.imgsArr"
  105. :key="ind"
  106. >
  107. <img
  108. style="width: 50px; height: 50px"
  109. :src="i"
  110. alt=""
  111. slot="reference"
  112. />
  113. <img style="width: 300px; height: auto" :src="i" alt="" />
  114. </el-popover>
  115. </div>
  116. </template>
  117. </el-table-column>
  118. <!-- <el-table-column label="套餐id" prop="phone" width="120">
  119. </el-table-column> -->
  120. <el-table-column label="套餐价格" prop="price"> </el-table-column>
  121. <el-table-column label="套餐详情" prop="putawayFlag">
  122. <template slot-scope="scope">
  123. <span
  124. @click="infoMeal(scope.row)"
  125. style="color: #56a9ff;cursor: pointer;"
  126. >详情</span
  127. >
  128. </template>
  129. </el-table-column>
  130. <el-table-column label="套餐类型" prop="errandMoney" width="150">
  131. <template slot-scope="scope">
  132. <span v-if="scope.row.setType == 1">月度套餐</span>
  133. <span v-if="scope.row.setType == 2">季度套餐</span>
  134. <span v-if="scope.row.setType == 3">年度套餐</span>
  135. <span v-if="scope.row.setType == 4">自定义</span>
  136. </template>
  137. </el-table-column>
  138. <el-table-column label="套餐适用性别" prop="suitSex" width="150">
  139. <template slot-scope="scope">
  140. <span v-if="scope.row.suitSex == 1">男</span>
  141. <span v-if="scope.row.suitSex == 2">女</span>
  142. </template>
  143. </el-table-column>
  144. <el-table-column label="套餐绑定规则" prop="ruleName">
  145. </el-table-column>
  146. <el-table-column label="时间段" prop="minimumDelivery" width="160">
  147. <template slot-scope="scope">
  148. <span
  149. >{{ scope.row.selfStartTime }} {{ scope.row.selfEndTime }}</span
  150. >
  151. </template>
  152. </el-table-column>
  153. <el-table-column
  154. label="有效期"
  155. prop="enableFullReductionFlag"
  156. width="150"
  157. >
  158. <template slot-scope="scope">
  159. <span>{{ scope.row.startTime }} {{ scope.row.endTime }}</span>
  160. </template>
  161. </el-table-column>
  162. <el-table-column label="创建时间" prop="enableFullReductionFlag">
  163. </el-table-column>
  164. <el-table-column label="状态" prop="autoSendOrder">
  165. <template slot-scope="scope">
  166. <span v-if="scope.row.setStatus == 1">可用</span>
  167. <span v-if="scope.row.setStatus == 2">不可用</span>
  168. </template>
  169. </el-table-column>
  170. <el-table-column label="操作" width="230" fixed="right">
  171. <template slot-scope="scope">
  172. <el-button
  173. :disabled="!isAuth('shopsList:update')"
  174. size="mini"
  175. type="primary"
  176. @click="updateMima(scope.row)"
  177. style="margin: 5px"
  178. >编辑
  179. </el-button>
  180. <el-button
  181. :disabled="!isAuth('shopsList:delete')"
  182. size="mini"
  183. type="danger"
  184. @click="deletes(scope.row)"
  185. style="margin: 5px"
  186. >删除
  187. </el-button>
  188. </template>
  189. </el-table-column>
  190. </el-table>
  191. <div style="text-align: center; margin-top: 10px">
  192. <el-pagination
  193. @size-change="handleSizeChange"
  194. @current-change="handleCurrentChange"
  195. :page-sizes="[10, 20, 30, 50, 100]"
  196. :page-size="limit"
  197. :current-page="page"
  198. layout="total,sizes, prev, pager, next,jumper"
  199. :total="typeDatas.total"
  200. >
  201. </el-pagination>
  202. </div>
  203. </el-tab-pane>
  204. <el-tab-pane label="规则配置" name="third">
  205. <div style="position: relative; display: inline-block; margin: 10px 0px">
  206. <span>规格名称:</span>
  207. <el-input
  208. style="width: 150px"
  209. @keydown.enter.native="searchRule"
  210. placeholder="请输入套餐名称"
  211. v-model="ruleName"
  212. clearable
  213. >
  214. </el-input
  215. >&nbsp;&nbsp;
  216. <el-button
  217. style="margin-left: 15px"
  218. size="mini"
  219. type="primary"
  220. icon="document"
  221. @click="searchRule"
  222. >查询
  223. </el-button>
  224. <el-button
  225. style="margin-left: 15px"
  226. size="mini"
  227. type="primary"
  228. icon="document"
  229. @click="cleanRule"
  230. >重置
  231. </el-button>
  232. <el-button size="mini" type="primary" icon="document" @click="addRule"
  233. >添加
  234. </el-button>
  235. <el-button
  236. size="mini"
  237. type="primary"
  238. icon="document"
  239. @click="setRuleImp"
  240. >导出
  241. </el-button>
  242. </div>
  243. <el-table
  244. v-loading="tableDataLoading"
  245. :data="typeDatas1.list"
  246. row-key="id"
  247. >
  248. <!-- <el-table-column label="编号" type="index" width="80">
  249. </el-table-column> -->
  250. <el-table-column label="规格排序" prop="sort">
  251. <template slot-scope="scope">
  252. <!-- <el-input-number v-model="scope.sort" label="排序"></el-input-number> -->
  253. <span>{{ scope.row.sort }}</span>
  254. </template>
  255. </el-table-column>
  256. <el-table-column label="规则名称" prop="name"> </el-table-column>
  257. <el-table-column label="规则id" prop="id"> </el-table-column>
  258. <el-table-column label="套餐内容" prop="content"> </el-table-column>
  259. <el-table-column label="创建时间" prop="createTime"> </el-table-column>
  260. <el-table-column label="状态" prop="autoSendOrder">
  261. <template slot-scope="scope">
  262. <el-switch
  263. v-model="scope.row.status"
  264. :active-value="1"
  265. :inactive-value="2"
  266. @change="editSwitch(scope.row)"
  267. >
  268. </el-switch>
  269. </template>
  270. </el-table-column>
  271. <el-table-column label="操作" width="200">
  272. <template slot-scope="scope">
  273. <el-button
  274. :disabled="!isAuth('shopsList:update')"
  275. size="mini"
  276. type="primary"
  277. @click="editRule(scope.row)"
  278. style="margin: 5px"
  279. >编辑
  280. </el-button>
  281. <el-button
  282. :disabled="!isAuth('shopsList:delete')"
  283. size="mini"
  284. type="danger"
  285. @click="delRule(scope.row)"
  286. style="margin: 5px"
  287. >删除
  288. </el-button>
  289. </template>
  290. </el-table-column>
  291. </el-table>
  292. <div style="text-align: center; margin-top: 10px; float: right">
  293. <el-pagination
  294. @size-change="handleSizeChange1"
  295. @current-change="handleCurrentChange1"
  296. :page-sizes="[10, 20, 30, 50, 100]"
  297. :page-size="limit1"
  298. :current-page="page1"
  299. layout="total,sizes, prev, pager, next,jumper"
  300. :total="typeDatas1.total"
  301. >
  302. </el-pagination>
  303. </div>
  304. </el-tab-pane>
  305. <el-dialog
  306. :title="addSetmealTitle"
  307. customClass="setmeal"
  308. :visible.sync="addSetmealVisible"
  309. :before-close="cancelSetmeal"
  310. :close-on-click-modal="false"
  311. >
  312. <div v-loading="addSetmealLoading">
  313. <el-form :model="addSetmealForm" v-if="addSetmealShow">
  314. <div style="display: flex">
  315. <el-form-item label="套餐名称:">
  316. <el-input
  317. v-model="addSetmealForm.name"
  318. style="width: 200px"
  319. placeholder="请输入套餐名称"
  320. ></el-input>
  321. </el-form-item>
  322. <el-form-item label="套餐子名称:">
  323. <el-input
  324. v-model="addSetmealForm.subName"
  325. style="width: 200px"
  326. placeholder="请输入套餐子名称"
  327. ></el-input>
  328. </el-form-item>
  329. </div>
  330. <div style="display: flex">
  331. <el-form-item label="套餐价格:">
  332. <el-input
  333. v-model="addSetmealForm.price"
  334. style="width: 200px"
  335. placeholder="请输入套餐价格"
  336. ></el-input>
  337. </el-form-item>
  338. <el-form-item label="套餐原价:">
  339. <el-input
  340. v-model="addSetmealForm.originalPrice"
  341. style="width: 200px"
  342. placeholder="请输入套餐原价"
  343. ></el-input>
  344. </el-form-item>
  345. </div>
  346. <div style="display: flex;">
  347. <el-form-item label="套餐标签:">
  348. <el-tag
  349. style="margin-right: 5px"
  350. :key="tag"
  351. v-for="tag in addSetmealForm.setTagArr"
  352. closable
  353. :disable-transitions="false"
  354. @close="handleSetTagClose(tag)"
  355. >
  356. {{ tag }}
  357. </el-tag>
  358. <el-input
  359. class="input-new-tag"
  360. v-if="setTagVisible"
  361. v-model="setTagValue"
  362. ref="saveSetTag"
  363. size="small"
  364. @blur="handleSetTagConfirm"
  365. >
  366. </el-input>
  367. <el-button
  368. v-else
  369. class="button-new-tag"
  370. size="small"
  371. @click="showSetTag"
  372. >添加标签</el-button
  373. >
  374. </el-form-item>
  375. </div>
  376. <div style="display: flex;">
  377. <el-form-item label="服务标签:">
  378. <el-tag
  379. style="margin-right: 5px"
  380. :key="tag"
  381. v-for="tag in addSetmealForm.serviceTagArr"
  382. closable
  383. :disable-transitions="false"
  384. @close="handleServiceTagClose(tag)"
  385. >
  386. {{ tag }}
  387. </el-tag>
  388. <el-input
  389. class="input-new-tag"
  390. v-if="serviceTagVisible"
  391. v-model="serviceTagValue"
  392. ref="saveServiceTag"
  393. size="small"
  394. @blur="handleServiceTagConfirm"
  395. >
  396. </el-input>
  397. <el-button
  398. style="display: inline-block;"
  399. v-else
  400. class="button-new-tag"
  401. size="small"
  402. @click="showServiceTag"
  403. >添加标签</el-button
  404. >
  405. </el-form-item>
  406. </div>
  407. <el-form-item>
  408. <div
  409. style="
  410. display: flex;
  411. align-items: center;
  412. margin: 2% 0;
  413. flex-flow: wrap;
  414. "
  415. >
  416. <span style="display: inline-block; text-align: left"
  417. >套餐图片:<br />(可上传多张)&nbsp;&nbsp;&nbsp;</span
  418. >
  419. <div v-for="(item, index) of potost" :key="index">
  420. <div style="position: relative; margin: 5px">
  421. <img
  422. :src="item"
  423. class="avatar"
  424. style="width: 148px; height: 148px"
  425. />
  426. <div @click="handleRemove(index)" class="divhove">
  427. <i
  428. class="el-icon-delete"
  429. style="margin: 0; font-size: 18px; color: #fff"
  430. ></i>
  431. </div>
  432. </div>
  433. </div>
  434. <div class="imgs">
  435. <el-upload
  436. :action="Tupiantou"
  437. list-type="picture-card"
  438. :show-file-list="false"
  439. :on-success="handleUploadSuccess"
  440. :on-progress="onprogress1"
  441. >
  442. <el-progress
  443. v-if="percentage1 > 0 && percentage1 < 100"
  444. type="circle"
  445. :percentage="percentage1"
  446. >
  447. </el-progress>
  448. <i v-else class="el-icon-plus"></i>
  449. </el-upload>
  450. </div>
  451. </div>
  452. </el-form-item>
  453. <!-- 套餐 -->
  454. <div
  455. style="background-color: #f5f5f5;border-radius: 4px;margin: 0 0 20px 0;"
  456. v-for="(item, index) in addSetmealForm.loversSetContentDTOS"
  457. :key="index"
  458. >
  459. <div style="display: flex;padding: 20px 0 0 15px;">
  460. <el-form-item label="套餐内容:">
  461. <el-input
  462. v-model="item.contentName"
  463. style="width: 200px"
  464. placeholder="请输入套餐内容"
  465. ></el-input>
  466. </el-form-item>
  467. <el-form-item label="排序:">
  468. <el-input-number
  469. v-model="item.sort"
  470. label="描述文字"
  471. :min="0"
  472. style="width: 150px;"
  473. ></el-input-number>
  474. <i
  475. class="el-icon-circle-plus-outline"
  476. @click="mealAdd(item, index)"
  477. style="
  478. margin-left: 15px;
  479. font-size: 22px;
  480. color: #56a9ff;
  481. cursor: pointer;
  482. "
  483. ></i>
  484. <i
  485. class="el-icon-delete"
  486. @click="mealRemove(item, index)"
  487. style="
  488. margin-left: 15px;
  489. font-size: 22px;
  490. color: #f56c6c;
  491. cursor: pointer;
  492. "
  493. ></i>
  494. </el-form-item>
  495. </div>
  496. <div
  497. v-for="(i, ind) in item.loversSetContentDetailDTOS"
  498. :key="ind"
  499. style="padding-top: 20px;display: flex;flex-wrap: wrap;border: 1px dotted red;"
  500. >
  501. <el-form-item label="店铺名称:" style="margin-left: 80px">
  502. <el-select
  503. v-model="i.shop"
  504. placeholder="请选择店铺名称"
  505. style="width: 280px"
  506. filterable
  507. @change="shopNameChange($event, i)"
  508. >
  509. <el-option
  510. :label="j.shopName"
  511. :value="`${j.shopId},${j.shopName}`"
  512. v-for="j in shopData"
  513. :key="j.shopId"
  514. ></el-option>
  515. </el-select>
  516. </el-form-item>
  517. <el-form-item label="商品名称:">
  518. <el-select
  519. v-model="i.goods"
  520. placeholder="请选择商品名称"
  521. style="width: 250px"
  522. @change="goodsNameChange($event, i)"
  523. >
  524. <el-option
  525. :label="j.goodsName"
  526. :value="`${j.goodsId},${j.goodsName}`"
  527. v-for="j in i.goodsData"
  528. :key="j.goodsId"
  529. ></el-option>
  530. </el-select>
  531. </el-form-item>
  532. <el-form-item label="原价:" style="margin-left: 80px">
  533. <el-input
  534. v-model="i.originalPrice"
  535. style="width: 150px"
  536. placeholder="请输入原价"
  537. @change="viewupdate"
  538. ></el-input>
  539. </el-form-item>
  540. <el-form-item label="价格:">
  541. <el-input
  542. v-model="i.price"
  543. style="width: 150px"
  544. placeholder="请输入价格"
  545. @change="viewupdate"
  546. ></el-input>
  547. </el-form-item>
  548. <el-form-item label="数量:">
  549. <el-input-number
  550. v-model="i.num"
  551. label="描述文字"
  552. :min="1"
  553. style="width: 150px;"
  554. @change="viewupdate"
  555. ></el-input-number>
  556. <i
  557. class="el-icon-circle-plus-outline"
  558. @click="storeAdd(item.loversSetContentDetailDTOS, ind)"
  559. style="
  560. margin-left: 15px;
  561. font-size: 22px;
  562. color: #56a9ff;
  563. cursor: pointer;
  564. "
  565. ></i>
  566. <i
  567. class="el-icon-delete"
  568. @click="storeRemove(item.loversSetContentDetailDTOS, ind)"
  569. style="
  570. margin-left: 15px;
  571. font-size: 22px;
  572. color: #f56c6c;
  573. cursor: pointer;
  574. "
  575. ></i>
  576. </el-form-item>
  577. </div>
  578. </div>
  579. <div style="display: flex">
  580. <el-form-item label="套餐类型:">
  581. <el-select
  582. v-model="addSetmealForm.setType"
  583. placeholder="请选择套餐类型"
  584. style="width: 180px"
  585. @change="setTypeChange"
  586. >
  587. <el-option label="月度套餐" :value="1"></el-option>
  588. <el-option label="季度套餐" :value="2"></el-option>
  589. <el-option label="年度套餐" :value="3"></el-option>
  590. <el-option label="自定义" :value="4"></el-option>
  591. </el-select>
  592. </el-form-item>
  593. <el-form-item label="时间段:" v-if="addSetmealForm.setType == 4">
  594. <el-date-picker
  595. @change="selfTimeChange"
  596. style="width: 380px"
  597. v-model="addSetmealForm.selfTime"
  598. type="datetimerange"
  599. unlink-panels
  600. range-separator="-"
  601. start-placeholder="开始日期"
  602. end-placeholder="结束日期"
  603. format="yyyy-MM-dd HH:mm:ss"
  604. value-format="yyyy-MM-dd HH:mm:ss"
  605. :clearable="false"
  606. >
  607. </el-date-picker>
  608. </el-form-item>
  609. </div>
  610. <el-form-item label="有效期:">
  611. <el-date-picker
  612. @change="timeChange"
  613. style="width: 380px"
  614. v-model="addSetmealForm.time"
  615. type="datetimerange"
  616. unlink-panels
  617. range-separator="-"
  618. start-placeholder="开始日期"
  619. end-placeholder="结束日期"
  620. format="yyyy-MM-dd HH:mm:ss"
  621. value-format="yyyy-MM-dd HH:mm:ss"
  622. :clearable="false"
  623. >
  624. </el-date-picker>
  625. </el-form-item>
  626. <div style="display: flex">
  627. <el-form-item label="套餐适用性别:">
  628. <el-select
  629. v-model="addSetmealForm.suitSex"
  630. placeholder="请选择套餐适用性别"
  631. style="width: 180px"
  632. >
  633. <el-option label="男生专区" :value="1"></el-option>
  634. <el-option label="女生专区" :value="2"></el-option>
  635. </el-select>
  636. </el-form-item>
  637. <el-form-item label="订单生成预约单时间:">
  638. 选择的时间前
  639. <el-input
  640. v-model="addSetmealForm.subOrderGenerateTime"
  641. style="width: 100px"
  642. placeholder=""
  643. ></el-input>
  644. 小时(保留一位小数)
  645. </el-form-item>
  646. </div>
  647. <el-form-item label="套餐绑定规则:">
  648. <el-select
  649. v-model="addSetmealForm.ruleId"
  650. placeholder="请选择套餐绑定规则"
  651. style="width: 180px"
  652. >
  653. <el-option
  654. :label="a.name"
  655. :value="a.id"
  656. v-for="a in roleData"
  657. :key="a.id"
  658. ></el-option>
  659. </el-select>
  660. </el-form-item>
  661. <el-form-item
  662. label="套餐状态:"
  663. style="display: flex; align-items: center"
  664. >
  665. <el-switch
  666. style="display: block"
  667. v-model="addSetmealForm.setStatus"
  668. active-text="启用"
  669. inactive-text="关闭"
  670. :active-value="1"
  671. :inactive-value="2"
  672. >
  673. </el-switch>
  674. </el-form-item>
  675. </el-form>
  676. <div slot="footer" class="dialog-footer">
  677. <el-button type="primary" @click="amendSetmeal">确 定</el-button>
  678. <el-button @click="cancelSetmeal" style="margin-right: 20px;"
  679. >取 消</el-button
  680. >
  681. </div>
  682. </div>
  683. </el-dialog>
  684. <el-dialog
  685. title="套餐详情"
  686. customClass="setmeal"
  687. :visible.sync="infoVisible"
  688. :before-close="cancelInfo"
  689. >
  690. <!-- 套餐 -->
  691. <div
  692. style="background-color: #f5f5f5;border-radius: 4px;margin: 0 0 20px 0;padding-bottom: 20px;"
  693. v-for="(item, index) in infoList"
  694. :key="index"
  695. >
  696. <div style="display: flex;padding: 20px 0 0 15px;">
  697. <div style="margin-right: 30px;">
  698. <span>套餐内容:</span>
  699. <span style="font-size: 18px;font-weight: 600;">{{ item.contentName }}</span>
  700. </div>
  701. <div>
  702. <span>排序:</span>
  703. <span>{{ item.sort }}</span>
  704. </div>
  705. </div>
  706. <div
  707. v-for="(i, ind) in item.contentDetailList"
  708. :key="ind"
  709. style="padding-top: 20px;display: flex;flex-wrap: wrap;"
  710. >
  711. <div style="margin-left: 80px">
  712. <span>店铺名称:</span>
  713. <span style="font-size: 18px;font-weight: 600;">{{ i.shopName }}</span>
  714. </div>
  715. <div style="margin:0 30px;">
  716. <span>商品名称:</span>
  717. <span style="font-size: 18px;font-weight: 600;">{{ i.goodsName }}</span>
  718. </div>
  719. <div>
  720. <span>原价(元):</span>
  721. <span style="font-size: 18px;font-weight: 600;">{{ i.detailOriginalPrice }}</span>
  722. </div>
  723. <div style="margin:0 30px;">
  724. <span>价格(元):</span>
  725. <span style="font-size: 18px;font-weight: 600;">{{ i.detailPrice }}</span>
  726. </div>
  727. <div>
  728. <span>数量:</span>
  729. <span style="font-size: 18px;font-weight: 600;">{{ i.num }}</span>
  730. </div>
  731. </div>
  732. </div>
  733. </el-dialog>
  734. <el-dialog
  735. :title="addRuleTitle"
  736. customClass="setRule"
  737. :visible.sync="addRuleVisible"
  738. :before-close="cancelRule"
  739. center
  740. >
  741. <el-form :model="addRuleForm">
  742. <el-form-item label="排序:">
  743. <el-input-number
  744. v-model="addRuleForm.sort"
  745. label="描述文字"
  746. :min="0"
  747. ></el-input-number>
  748. </el-form-item>
  749. <el-form-item label="规则名称:">
  750. <el-input
  751. v-model="addRuleForm.name"
  752. style="width: 200px"
  753. placeholder="请输入规则名称"
  754. ></el-input>
  755. </el-form-item>
  756. <el-form-item label="规则内容:">
  757. <el-input
  758. v-model="addRuleForm.content"
  759. style="width: 450px"
  760. placeholder="请输入规则内容"
  761. type="textarea"
  762. :rows="6"
  763. ></el-input>
  764. </el-form-item>
  765. <el-form-item label="状态:">
  766. <el-switch
  767. v-model="addRuleForm.status"
  768. :active-value="1"
  769. :inactive-value="2"
  770. >
  771. </el-switch>
  772. </el-form-item>
  773. </el-form>
  774. <div slot="footer" class="dialog-footer">
  775. <el-button @click="cancelRule">取 消</el-button>
  776. <el-button type="primary" @click="amendRule">确 定</el-button>
  777. </div>
  778. </el-dialog>
  779. </el-tabs>
  780. </template>
  781. <script>
  782. import { jsonp } from "vue-jsonp";
  783. import {
  784. provinceAndCityData,
  785. regionData,
  786. provinceAndCityDataPlus,
  787. regionDataPlus,
  788. CodeToText,
  789. TextToCode
  790. } from "element-china-area-data";
  791. var geocoder,
  792. map,
  793. markersArray = [];
  794. export default {
  795. data() {
  796. return {
  797. activeName: "first",
  798. name: "",
  799. setType: "",
  800. suitSex: "",
  801. limit: 10,
  802. page: 1,
  803. tableDataLoading: false,
  804. selectDataId: [],
  805. typeDatas: {
  806. list: [],
  807. total: 10
  808. },
  809. limit1: 10,
  810. page1: 1,
  811. ruleName: "",
  812. typeDatas1: {
  813. list: [],
  814. total: 10
  815. },
  816. // 添加套餐
  817. addSetmealVisible: false,
  818. addSetmealTitle: "",
  819. addSetmealForm: {
  820. id: "",
  821. name: "", //套餐名称
  822. subName: "", //套餐子名称
  823. setTagArr: [], //套餐标签;多个标签之间使用,分割
  824. setTag: "", //套餐标签;多个标签之间使用,分割
  825. serviceTagArr: [], //服务标签;多个标签之间使用,分割
  826. serviceTag: "", //服务标签;多个标签之间使用,分割
  827. price: 1.1, //价格
  828. originalPrice: 1.2, //原价
  829. imgs: [], //图片;多张图片使用,分割,第一张为主图
  830. setType: "", //套餐类型;1月度套餐,2季度套餐,3年度套餐,4自定义
  831. suitSex: "", //适用性别;1男、2女
  832. ruleId: 1, //规则id
  833. setStatus: "", //状态;1可用、2不可用
  834. subOrderGenerateTime: 1, //子订单生成时机;单位:小时
  835. time: "",
  836. startTime: "", //套餐开始时间
  837. endTime: "", //套餐结束时间
  838. selfTime: "",
  839. selfStartTime: "", //自定义时间段开始时间;type为4自定义时必填
  840. selfEndTime: "", //自定义时间段结束时间;type为4自定义时必填
  841. loversSetContentDTOS: [
  842. {
  843. loversSetId: "", //套餐id,修改时不能为空
  844. sort: 1, //排序
  845. contentName: "测试", //内容名称
  846. loversSetContentDetailDTOS: [
  847. {
  848. loversSetContentId: "", //情侣套餐内容id,修改时不能为空
  849. goodsData: [],
  850. goods: "",
  851. goodsId: "", //商品id
  852. goodsName: "", //商品名称
  853. shop: "",
  854. shopId: "", //店铺id
  855. shopName: "", //店铺名称
  856. num: "", //数量
  857. price: "", //价格
  858. originalPrice: "" //原价
  859. }
  860. ] //内容详情内容列表
  861. }
  862. ]
  863. },
  864. addSetmealLoading: false,
  865. addSetmealShow: false,
  866. shopData: [], // 店铺名称
  867. roleData: [], // 规格下拉列表
  868. // 套餐标签
  869. setTagVisible: false,
  870. setTagValue: "",
  871. // 服务标签
  872. serviceTagVisible: false,
  873. serviceTagValue: "",
  874. potost: [],
  875. percentage1: 0, //进度条
  876. addRuleTitle: "",
  877. addRuleVisible: false,
  878. addRuleForm: {
  879. sort: 1,
  880. content: "",
  881. name: "",
  882. status: "",
  883. id: ""
  884. },
  885. infoVisible: false,
  886. infoList: []
  887. };
  888. },
  889. methods: {
  890. // tabs切换
  891. handleClick(tab, event) {
  892. if (tab._props.label == "服务套餐") {
  893. this.page = 1;
  894. this.limit = 10;
  895. this.dataSelect();
  896. }
  897. if (tab._props.label == "规则配置") {
  898. this.page1 = 1;
  899. this.limit1 = 10;
  900. this.dataSelect1();
  901. }
  902. },
  903. handleSizeChange(val) {
  904. this.limit = val;
  905. this.dataSelect();
  906. },
  907. handleCurrentChange(val) {
  908. this.page = val;
  909. this.dataSelect();
  910. },
  911. handleSizeChange1(val) {
  912. this.limit1 = val;
  913. this.dataSelect1();
  914. },
  915. handleCurrentChange1(val) {
  916. this.page1 = val;
  917. this.dataSelect1();
  918. },
  919. // 查询
  920. select() {
  921. this.page = 1;
  922. this.dataSelect();
  923. },
  924. // 获取商户数据
  925. dataSelect() {
  926. this.tableDataLoading = true;
  927. this.$http({
  928. url: this.$http.adornUrl("admin/lover-set/page"),
  929. method: "get",
  930. params: this.$http.adornParams({
  931. page: this.page,
  932. limit: this.limit,
  933. name: this.name,
  934. setType: this.setType,
  935. suitSex: this.suitSex
  936. })
  937. }).then(({ data }) => {
  938. this.tableDataLoading = false;
  939. data.data.list.forEach(i => {
  940. i.imgsArr = i.imgs.split(",");
  941. });
  942. this.typeDatas.list = data.data.list;
  943. this.typeDatas.total = data.data.totalCount;
  944. console.log(data.data, "情侣套餐分页数据");
  945. });
  946. },
  947. search() {
  948. this.dataSelect();
  949. },
  950. clean() {
  951. this.name = "";
  952. this.setType = "";
  953. this.suitSex = "";
  954. this.dataSelect();
  955. },
  956. //上传成功
  957. handleUploadSuccess(file, fileList) {
  958. // this.goodsPicture += file.data + ','
  959. console.log(file, "轮播图上传成功");
  960. // if(this.potost.length>=4){
  961. // this.potost.shift()
  962. // }
  963. this.potost.unshift(file.data);
  964. this.addSetmealForm.imgs = this.potost.join(",");
  965. },
  966. onprogress1(event, file, fileList) {
  967. console.log("详情图上传进度", parseInt(event.percent));
  968. this.percentage1 = parseInt(event.percent);
  969. },
  970. handleRemove(index) {
  971. this.potost.splice(index, 1);
  972. this.addSetmealForm.imgs = this.potost.join(",");
  973. console.log("this.potost", this.potost);
  974. },
  975. // 添加套餐内容
  976. mealAdd(item, index) {
  977. this.addSetmealForm.loversSetContentDTOS.splice(index + 1, 0, {
  978. loversSetId: "",
  979. sort: index + 1, //排序
  980. contentName: "", //内容名称
  981. loversSetContentDetailDTOS: [
  982. {
  983. loversSetContentId: "",
  984. goodsData: [],
  985. goods: "", //商品id
  986. goodsId: "", //商品id
  987. goodsName: "", //商品名称
  988. shop: "", //店铺id
  989. shopId: "", //店铺id
  990. shopName: "", //店铺名称
  991. num: "", //数量
  992. price: "", //价格
  993. originalPrice: "" //原价
  994. }
  995. ] //内容详情内容列表
  996. });
  997. this.addSetmealForm.loversSetContentDTOS.forEach((j, jind) => {
  998. j.sort = jind + 1;
  999. });
  1000. },
  1001. // 删除套餐内容
  1002. mealRemove(item, index) {
  1003. if (this.addSetmealForm.loversSetContentDTOS.length > 1) {
  1004. this.addSetmealForm.loversSetContentDTOS.splice(index, 1);
  1005. this.addSetmealForm.loversSetContentDTOS.forEach((j, jind) => {
  1006. j.sort = jind + 1;
  1007. });
  1008. } else {
  1009. this.$message({
  1010. message: "至少需要一个套餐",
  1011. type: "warning",
  1012. duration: 1500,
  1013. onClose: () => {}
  1014. });
  1015. }
  1016. },
  1017. // 添加店铺名称
  1018. storeAdd(i, ind) {
  1019. console.log(i);
  1020. i.splice(ind + 1, 0, {
  1021. loversSetContentId: "",
  1022. goodsData: [],
  1023. goods: "", //商品id
  1024. goodsId: "", //商品id
  1025. goodsName: "", //商品名称
  1026. shop: "", //店铺id
  1027. shopId: "", //店铺id
  1028. shopName: "", //店铺名称
  1029. num: 1, //数量
  1030. price: "", //价格
  1031. originalPrice: "" //原价
  1032. });
  1033. this.viewupdate();
  1034. },
  1035. // 删除店铺名称
  1036. storeRemove(i, ind) {
  1037. if (i.length > 1) {
  1038. i.splice(ind, 1);
  1039. } else {
  1040. this.$message({
  1041. message: "套餐至少需要一个店铺",
  1042. type: "warning",
  1043. duration: 1500,
  1044. onClose: () => {}
  1045. });
  1046. }
  1047. this.viewupdate();
  1048. },
  1049. // 添加套餐
  1050. addSetmeal() {
  1051. this.addSetmealVisible = true;
  1052. this.addSetmealShow = true;
  1053. this.addSetmealTitle = "添加套餐";
  1054. this.roleList();
  1055. this.potost = [];
  1056. this.addSetmealForm = {
  1057. name: "", //套餐名称
  1058. subName: "", //套餐子名称
  1059. setTagArr: [], //套餐标签;多个标签之间使用,分割
  1060. setTag: "", //套餐标签;多个标签之间使用,分割
  1061. serviceTagArr: [], //服务标签;多个标签之间使用,分割
  1062. serviceTag: "", //服务标签;多个标签之间使用,分割
  1063. price: "", //价格
  1064. originalPrice: "", //原价
  1065. imgsArr: [], //图片;多张图片使用,分割,第一张为主图
  1066. imgs: "", //图片;多张图片使用,分割,第一张为主图
  1067. setType: "", //套餐类型;1月度套餐,2季度套餐,3年度套餐,4自定义
  1068. suitSex: "", //适用性别;1男、2女
  1069. ruleId: "", //规则id
  1070. setStatus: "", //状态;1可用、2不可用
  1071. subOrderGenerateTime: "", //子订单生成时机;单位:小时
  1072. time: "",
  1073. startTime: "", //套餐开始时间
  1074. endTime: "", //套餐结束时间
  1075. selfTime: "",
  1076. selfStartTime: "", //自定义时间段开始时间;type为4自定义时必填
  1077. selfEndTime: "", //自定义时间段结束时间;type为4自定义时必填
  1078. loversSetContentDTOS: [
  1079. {
  1080. loversSetId: "", //套餐id,修改时不能为空
  1081. sort: 1, //排序
  1082. contentName: "", //内容名称
  1083. loversSetContentDetailDTOS: [
  1084. {
  1085. loversSetContentId: "", //情侣套餐内容id,修改时不能为空
  1086. goodsData: [],
  1087. goods: "", //商品id
  1088. goodsId: "", //商品id
  1089. goodsName: "", //商品名称
  1090. shop: "", //店铺id
  1091. shopId: "", //店铺id
  1092. shopName: "", //店铺名称
  1093. num: 1, //数量
  1094. price: "", //价格
  1095. originalPrice: "" //原价
  1096. }
  1097. ] //内容详情内容列表
  1098. }
  1099. ]
  1100. };
  1101. },
  1102. // 规格下拉列表接口
  1103. updateMima(row) {
  1104. console.log(row);
  1105. this.addSetmealVisible = true; // 显示弹窗
  1106. this.addSetmealLoading = true; // 加载数据
  1107. this.addSetmealShow = false;
  1108. this.addSetmealTitle = "编辑套餐";
  1109. this.roleList();
  1110. this.potost = row.imgs ? row.imgs.split(",") : [];
  1111. // 用于存储所有接口的 Promise
  1112. const promises = [];
  1113. row.contentList.forEach(i => {
  1114. i.loversSetid = i.contentId;
  1115. i.loversSetContentDetailDTOS = [];
  1116. i.contentDetailList.forEach(j => {
  1117. // 将每个接口请求存入 promises 数组
  1118. const promise = this.$http({
  1119. url: this.$http.adornUrl("admin/goods/selectGoodsList"),
  1120. method: "get",
  1121. params: this.$http.adornParams({
  1122. page: 1,
  1123. limit: 10000,
  1124. shopId: j.shopId,
  1125. shopName: j.shopName
  1126. })
  1127. }).then(({ data }) => {
  1128. if (data.code == 0) {
  1129. console.log(data, "商品名称列表");
  1130. i.loversSetContentDetailDTOS.push({
  1131. loversSetContentId: j.contentDetailId, //情侣套餐内容id,修改时不能为空
  1132. goodsData: data.data.list,
  1133. goods: `${j.goodsId},${j.goodsName}`, //商品id
  1134. goodsId: j.goodsId, //商品id
  1135. goodsName: j.goodsName, //商品名称
  1136. shop: `${j.shopId},${j.shopName}`, //店铺id
  1137. shopId: j.shopId, //店铺id
  1138. shopName: j.shopName, //店铺名称
  1139. num: j.num, //数量
  1140. price: j.detailPrice, //价格
  1141. originalPrice: j.detailOriginalPrice //原价
  1142. });
  1143. }
  1144. });
  1145. promises.push(promise);
  1146. });
  1147. });
  1148. // 等待所有接口完成后再显示弹窗
  1149. Promise.all(promises).then(() => {
  1150. this.addSetmealLoading = false; // 加载数据
  1151. this.addSetmealShow = true;
  1152. console.log(this.addSetmealForm, "编辑套餐数据加载完成");
  1153. });
  1154. this.addSetmealForm = {
  1155. id: row.id,
  1156. name: row.name, //套餐名称
  1157. subName: row.subName, //套餐子名称
  1158. setTagArr: row.setTag ? row.setTag.split(",") : [], //套餐标签;多个标签之间使用,分割
  1159. setTag: row.setTag, //套餐标签;多个标签之间使用,分割
  1160. serviceTagArr: row.serviceTag ? row.serviceTag.split(",") : [], //服务标签;多个标签之间使用,分割
  1161. serviceTag: row.serviceTag, //服务标签;多个标签之间使用,分割
  1162. price: row.price, //价格
  1163. originalPrice: row.originalPrice, //原价
  1164. imgsArr: row.imgs ? row.imgs.split(",") : [], //图片;多张图片使用,分割,第一张为主图
  1165. imgs: row.imgs, //图片;多张图片使用,分割,第一张为主图
  1166. setType: Number(row.setType), //套餐类型;1月度套餐,2季度套餐,3年度套餐,4自定义
  1167. suitSex: Number(row.suitSex), //适用性别;1男、2女
  1168. ruleId: row.ruleId, //规则id
  1169. setStatus: Number(row.setStatus), //状态;1可用、2不可用
  1170. subOrderGenerateTime: row.subOrderGenerateTime, //子订单生成时机;单位:小时
  1171. time: [row.startTime, row.endTime],
  1172. startTime: row.startTime, //套餐开始时间
  1173. endTime: row.endTime, //套餐结束时间
  1174. selfTime: [row.selfStartTime, row.selfEndTime],
  1175. selfStartTime: row.selfStartTime, //自定义时间段开始时间;type为4自定义时必填
  1176. selfEndTime: row.selfEndTime, //自定义时间段结束时间;type为4自定义时必填
  1177. loversSetContentDTOS: row.contentList
  1178. };
  1179. },
  1180. roleList() {
  1181. this.$http({
  1182. url: this.$http.adornUrl("admin/lovers-set-rule/useList"),
  1183. method: "get",
  1184. params: this.$http.adornParams()
  1185. }).then(({ data }) => {
  1186. console.log(data, "规格下拉列表");
  1187. if (data.code == 0) {
  1188. this.roleData = data.data;
  1189. }
  1190. });
  1191. },
  1192. // 店铺名称列表接口
  1193. shopList() {
  1194. this.$http({
  1195. url: this.$http.adornUrl("admin/goods/selectAllShop"),
  1196. method: "get",
  1197. params: this.$http.adornParams({
  1198. page: 1,
  1199. limit: 10000
  1200. })
  1201. }).then(({ data }) => {
  1202. console.log(data, "店铺名称列表");
  1203. if (data.code == 0) {
  1204. this.shopData = data.data.list;
  1205. }
  1206. });
  1207. },
  1208. goodsList(shopId, shopName) {
  1209. this.$http({
  1210. url: this.$http.adornUrl("admin/goods/selectGoodsList"),
  1211. method: "get",
  1212. params: this.$http.adornParams({
  1213. page: 1,
  1214. limit: 10000,
  1215. shopId: shopId,
  1216. shopName: shopName
  1217. })
  1218. }).then(({ data }) => {
  1219. if (data.code == 0) {
  1220. console.log(data, "商品名称列表");
  1221. this.shopData = data.data.list;
  1222. }
  1223. });
  1224. },
  1225. shopNameChange(val, i) {
  1226. this.addSetmealLoading = true;
  1227. console.log(val, i);
  1228. i.goods = "";
  1229. i.originalPrice = "";
  1230. i.price = "";
  1231. i.num = 1;
  1232. let arr = val.split(",");
  1233. this.$http({
  1234. url: this.$http.adornUrl("admin/goods/selectGoodsList"),
  1235. method: "get",
  1236. params: this.$http.adornParams({
  1237. page: 1,
  1238. limit: 10000,
  1239. shopId: arr[0],
  1240. shopName: arr[1]
  1241. })
  1242. }).then(({ data }) => {
  1243. if (data.code == 0) {
  1244. console.log(data, "商品名称列表");
  1245. i.goodsData = data.data.list;
  1246. i.shopId = arr[0];
  1247. i.shopName = arr[1];
  1248. this.addSetmealForm = { ...this.addSetmealForm }; // 触发视图更新
  1249. this.addSetmealLoading = false;
  1250. }
  1251. });
  1252. },
  1253. goodsNameChange(val, i) {
  1254. this.addSetmealLoading = true;
  1255. console.log(val, i);
  1256. let arr = val.split(",");
  1257. i.goodsId = arr[0];
  1258. i.goodsName = arr[1];
  1259. i.goodsData.forEach(a => {
  1260. if (a.goodsId == arr[0]) {
  1261. i.originalPrice = a.originalMoney;
  1262. i.price = a.goodsMoney;
  1263. }
  1264. });
  1265. this.addSetmealForm = { ...this.addSetmealForm }; // 触发视图更新
  1266. this.addSetmealLoading = false;
  1267. },
  1268. // 触发视图更新
  1269. viewupdate() {
  1270. this.addSetmealForm = { ...this.addSetmealForm }; // 触发视图更新
  1271. this.addSetmealLoading = false;
  1272. },
  1273. // 套餐标签
  1274. handleSetTagClose(tag) {
  1275. this.addSetmealForm.setTagArr.splice(
  1276. this.addSetmealForm.setTagArr.indexOf(tag),
  1277. 1
  1278. );
  1279. this.addSetmealForm.setTag = this.addSetmealForm.setTagArr.join(",");
  1280. },
  1281. showSetTag() {
  1282. this.setTagVisible = true;
  1283. this.$nextTick(_ => {
  1284. this.$refs.saveSetTag.$refs.input.focus();
  1285. });
  1286. },
  1287. handleSetTagConfirm() {
  1288. let inputValue = this.setTagValue;
  1289. if (inputValue) {
  1290. this.addSetmealForm.setTagArr.push(inputValue);
  1291. }
  1292. this.setTagVisible = false;
  1293. this.setTagValue = "";
  1294. this.addSetmealForm.setTag = this.addSetmealForm.setTagArr.join(",");
  1295. },
  1296. // 服务标签
  1297. handleServiceTagClose(tag) {
  1298. this.addSetmealForm.serviceTagArr.splice(
  1299. this.addSetmealForm.serviceTagArr.indexOf(tag),
  1300. 1
  1301. );
  1302. this.addSetmealForm.serviceTag = this.addSetmealForm.serviceTagArr.join(
  1303. ","
  1304. );
  1305. },
  1306. showServiceTag() {
  1307. this.serviceTagVisible = true;
  1308. this.$nextTick(_ => {
  1309. this.$refs.saveServiceTag.$refs.input.focus();
  1310. });
  1311. },
  1312. handleServiceTagConfirm() {
  1313. let inputValue = this.serviceTagValue;
  1314. if (inputValue) {
  1315. this.addSetmealForm.serviceTagArr.push(inputValue);
  1316. }
  1317. this.serviceTagVisible = false;
  1318. this.serviceTagValue = "";
  1319. this.addSetmealForm.serviceTag = this.addSetmealForm.serviceTagArr.join(
  1320. ","
  1321. );
  1322. },
  1323. setTypeChange(val){
  1324. if(val==4){
  1325. this.addSetmealForm.selfTime=[]
  1326. }
  1327. },
  1328. // 改变时间段
  1329. selfTimeChange(val) {
  1330. this.addSetmealForm.selfStartTime = val[0];
  1331. this.addSetmealForm.selfEndTime = val[1];
  1332. },
  1333. // 改变有效期
  1334. timeChange(val) {
  1335. this.addSetmealForm.startTime = val[0];
  1336. this.addSetmealForm.endTime = val[1];
  1337. },
  1338. // 详情弹窗
  1339. infoMeal(row) {
  1340. console.log(row);
  1341. this.infoVisible=true
  1342. this.infoList=row.contentList
  1343. },
  1344. cancelInfo(){
  1345. this.infoVisible=false
  1346. },
  1347. deletes(row) {
  1348. this.$confirm(`确定删除此套餐?`, "提示", {
  1349. confirmButtonText: "确定",
  1350. cancelButtonText: "取消",
  1351. type: "warning"
  1352. }).then(() => {
  1353. this.$http({
  1354. url: this.$http.adornUrl(`admin/lover-set/delete`),
  1355. method: "post",
  1356. data: this.$http.adornData([row.id])
  1357. }).then(({ data }) => {
  1358. if (data.code == 0) {
  1359. this.$message({
  1360. message: "删除成功",
  1361. type: "success",
  1362. duration: 1500,
  1363. onClose: () => {
  1364. this.dataSelect();
  1365. }
  1366. });
  1367. } else {
  1368. this.$message({
  1369. message: data.msg,
  1370. type: "warning",
  1371. duration: 1500,
  1372. onClose: () => {}
  1373. });
  1374. }
  1375. });
  1376. });
  1377. },
  1378. handleSelectionChange(val) {
  1379. let arr = [];
  1380. val.forEach(i => {
  1381. arr.push(i.id);
  1382. });
  1383. this.selectDataId = arr;
  1384. },
  1385. // 批量删除
  1386. delSetmeal() {
  1387. console.log(this.selectDataId);
  1388. if (!this.selectDataId.length) {
  1389. this.$message({
  1390. message: "请勾选需要删除的数据",
  1391. type: "warning",
  1392. duration: 1500,
  1393. onClose: () => {}
  1394. });
  1395. return false;
  1396. }
  1397. this.$http({
  1398. url: this.$http.adornUrl(`admin/lover-set/delete`),
  1399. method: "post",
  1400. data: this.$http.adornData(this.selectDataId)
  1401. }).then(({ data }) => {
  1402. if (data.code == 0) {
  1403. this.$message({
  1404. message: "删除成功",
  1405. type: "success",
  1406. duration: 1500,
  1407. onClose: () => {
  1408. this.dataSelect();
  1409. }
  1410. });
  1411. } else {
  1412. this.$message({
  1413. message: data.msg,
  1414. type: "warning",
  1415. duration: 1500,
  1416. onClose: () => {}
  1417. });
  1418. }
  1419. });
  1420. },
  1421. cancelSetmeal() {
  1422. this.addSetmealVisible = false;
  1423. },
  1424. amendSetmeal() {
  1425. console.log(this.addSetmealForm, "添加套餐参数");
  1426. if (this.addSetmealForm.id) {
  1427. this.$http({
  1428. url: this.$http.adornUrl("admin/lover-set/update"),
  1429. method: "post",
  1430. data: this.$http.adornData(this.addSetmealForm)
  1431. }).then(({ data }) => {
  1432. console.log(data);
  1433. if (data.code == 0) {
  1434. this.$message({
  1435. message: "操作成功",
  1436. type: "success",
  1437. duration: 1500,
  1438. onClose: () => {
  1439. this.dataSelect();
  1440. this.addSetmealVisible = false;
  1441. }
  1442. });
  1443. } else {
  1444. this.$message({
  1445. message: data.msg,
  1446. type: "error",
  1447. duration: 1500,
  1448. onClose: () => {}
  1449. });
  1450. }
  1451. });
  1452. } else {
  1453. this.$http({
  1454. url: this.$http.adornUrl("admin/lover-set/add"),
  1455. method: "post",
  1456. data: this.$http.adornData(this.addSetmealForm)
  1457. }).then(({ data }) => {
  1458. console.log(data);
  1459. if (data.code == 0) {
  1460. this.$message({
  1461. message: "操作成功",
  1462. type: "success",
  1463. duration: 1500,
  1464. onClose: () => {
  1465. this.dataSelect();
  1466. this.addSetmealVisible = false;
  1467. }
  1468. });
  1469. } else {
  1470. this.$message({
  1471. message: data.msg,
  1472. type: "error",
  1473. duration: 1500,
  1474. onClose: () => {}
  1475. });
  1476. }
  1477. });
  1478. }
  1479. },
  1480. setmealImp() {},
  1481. // 规则配置
  1482. searchRule() {
  1483. this.dataSelect1();
  1484. },
  1485. cleanRule() {
  1486. this.ruleName = "";
  1487. this.dataSelect1();
  1488. },
  1489. dataSelect1() {
  1490. this.tableDataLoading = true;
  1491. this.$http({
  1492. url: this.$http.adornUrl("admin/lovers-set-rule/page"),
  1493. method: "get",
  1494. params: this.$http.adornParams({
  1495. page: this.page1,
  1496. limit: this.limit1,
  1497. name: this.ruleName
  1498. })
  1499. }).then(({ data }) => {
  1500. console.log(data, "情侣套餐规则分页");
  1501. this.tableDataLoading = false;
  1502. this.typeDatas1.list = data.data.list;
  1503. this.typeDatas1.total = data.data.totalCount;
  1504. });
  1505. },
  1506. // 添加规则
  1507. addRule() {
  1508. this.addRuleVisible = true;
  1509. this.addRuleTitle = "添加规则";
  1510. this.addRuleForm.name = "";
  1511. this.addRuleForm.sort = 1;
  1512. this.addRuleForm.content = "";
  1513. this.addRuleForm.status = 1;
  1514. this.addRuleForm.id = "";
  1515. },
  1516. // 编辑规则
  1517. editRule(row) {
  1518. console.log(row);
  1519. this.addRuleVisible = true;
  1520. this.addRuleTitle = "编辑规则";
  1521. this.addRuleForm.name = row.name;
  1522. this.addRuleForm.sort = row.sort;
  1523. this.addRuleForm.content = row.content;
  1524. this.addRuleForm.status = row.status;
  1525. this.addRuleForm.id = row.id;
  1526. },
  1527. // 编辑表格中的状态按钮
  1528. editSwitch(row) {
  1529. console.log(row);
  1530. this.$http({
  1531. url: this.$http.adornUrl("admin/lovers-set-rule/update"),
  1532. method: "post",
  1533. data: this.$http.adornData({
  1534. id: row.id,
  1535. name: row.name,
  1536. sort: row.sort,
  1537. content: row.content,
  1538. status: row.status
  1539. })
  1540. }).then(({ data }) => {
  1541. console.log(data);
  1542. if (data.code == 0) {
  1543. this.$message({
  1544. message: "操作成功",
  1545. type: "success",
  1546. duration: 500,
  1547. onClose: () => {
  1548. this.dataSelect1();
  1549. }
  1550. });
  1551. } else {
  1552. this.$message({
  1553. message: data.msg,
  1554. type: "error",
  1555. duration: 500,
  1556. onClose: () => {}
  1557. });
  1558. }
  1559. });
  1560. },
  1561. delRule(row) {
  1562. let delid = row.id;
  1563. this.$confirm(`确定删除此规则?`, "提示", {
  1564. confirmButtonText: "确定",
  1565. cancelButtonText: "取消",
  1566. type: "warning"
  1567. }).then(() => {
  1568. this.$http({
  1569. url: this.$http.adornUrl(`admin/lovers-set-rule/delete/${delid}`),
  1570. method: "get",
  1571. params: this.$http.adornParams({})
  1572. }).then(({ data }) => {
  1573. if (data.code == 0) {
  1574. this.$message({
  1575. message: "删除成功",
  1576. type: "success",
  1577. duration: 1500,
  1578. onClose: () => {
  1579. this.dataSelect1();
  1580. }
  1581. });
  1582. } else {
  1583. this.$message({
  1584. message: data.msg,
  1585. type: "warning",
  1586. duration: 1500,
  1587. onClose: () => {}
  1588. });
  1589. }
  1590. });
  1591. });
  1592. },
  1593. cancelRule() {
  1594. this.addRuleVisible = false;
  1595. },
  1596. amendRule() {
  1597. console.log("确定");
  1598. if (this.addRuleForm.id) {
  1599. this.$http({
  1600. url: this.$http.adornUrl("admin/lovers-set-rule/update"),
  1601. method: "post",
  1602. data: this.$http.adornData({
  1603. id: this.addRuleForm.id,
  1604. name: this.addRuleForm.name,
  1605. sort: this.addRuleForm.sort,
  1606. content: this.addRuleForm.content,
  1607. status: this.addRuleForm.status
  1608. })
  1609. }).then(({ data }) => {
  1610. console.log(data);
  1611. if (data.code == 0) {
  1612. this.$message({
  1613. message: "操作成功",
  1614. type: "success",
  1615. duration: 1500,
  1616. onClose: () => {
  1617. this.addRuleForm.name = "";
  1618. this.addRuleForm.sort = 1;
  1619. this.addRuleForm.content = "";
  1620. this.addRuleForm.status = "";
  1621. this.dataSelect1();
  1622. this.addRuleVisible = false;
  1623. }
  1624. });
  1625. } else {
  1626. this.$message({
  1627. message: data.msg,
  1628. type: "error",
  1629. duration: 1500,
  1630. onClose: () => {}
  1631. });
  1632. }
  1633. });
  1634. } else {
  1635. this.$http({
  1636. url: this.$http.adornUrl("admin/lovers-set-rule/add"),
  1637. method: "post",
  1638. data: this.$http.adornData({
  1639. name: this.addRuleForm.name,
  1640. sort: this.addRuleForm.sort,
  1641. content: this.addRuleForm.content,
  1642. status: 1
  1643. })
  1644. }).then(({ data }) => {
  1645. console.log(data);
  1646. if (data.code == 0) {
  1647. this.$message({
  1648. message: "操作成功",
  1649. type: "success",
  1650. duration: 1500,
  1651. onClose: () => {
  1652. this.addRuleForm.name = "";
  1653. this.addRuleForm.sort = 1;
  1654. this.addRuleForm.content = "";
  1655. this.addRuleForm.status = "";
  1656. this.dataSelect1();
  1657. this.addRuleVisible = false;
  1658. }
  1659. });
  1660. } else {
  1661. this.$message({
  1662. message: data.msg,
  1663. type: "error",
  1664. duration: 1500,
  1665. onClose: () => {}
  1666. });
  1667. }
  1668. });
  1669. }
  1670. },
  1671. setRuleImp() {}
  1672. },
  1673. mounted() {
  1674. this.dataSelect();
  1675. this.shopList();
  1676. }
  1677. };
  1678. </script>
  1679. <style scope>
  1680. .imgs {
  1681. position: relative;
  1682. border-radius: 6px;
  1683. width: 148px;
  1684. height: 148px;
  1685. margin-right: 10px;
  1686. display: inline-block;
  1687. }
  1688. .dels {
  1689. position: absolute;
  1690. top: 0;
  1691. left: 0;
  1692. display: none;
  1693. }
  1694. .dels .el-icon-delete {
  1695. line-height: 148px;
  1696. padding-left: 58px;
  1697. font-size: 25px;
  1698. color: #fff;
  1699. }
  1700. .imgs:hover .dels {
  1701. width: 100%;
  1702. height: 100%;
  1703. background: #000;
  1704. display: block;
  1705. opacity: 0.5;
  1706. }
  1707. .bqList {
  1708. padding: 4px 14px;
  1709. margin: 4px;
  1710. border: 1px solid #efefef;
  1711. font-size: 12px;
  1712. color: #999;
  1713. border-radius: 4px;
  1714. margin-right: 15px;
  1715. }
  1716. .delss {
  1717. display: none;
  1718. position: relative;
  1719. }
  1720. .delss .el-icon-delete {
  1721. position: absolute;
  1722. top: 0;
  1723. }
  1724. .bqList:hover .delss {
  1725. display: initial;
  1726. opacity: 0.5;
  1727. }
  1728. .tj {
  1729. padding: 6px !important;
  1730. margin: 4px;
  1731. font-size: 12px;
  1732. border: 1px solid #ccc;
  1733. border-radius: 4px;
  1734. }
  1735. .divs img {
  1736. width: 100%;
  1737. }
  1738. /* //参与活动 */
  1739. .canquxiao {
  1740. margin-top: 20px;
  1741. margin-left: 287px;
  1742. width: 76px;
  1743. height: 35px;
  1744. opacity: 1;
  1745. border-radius: 5px;
  1746. border: 1px solid rgba(0, 0, 0, 1);
  1747. font-size: 16px;
  1748. font-weight: 400;
  1749. line-height: 35px;
  1750. color: rgba(0, 0, 0, 1);
  1751. text-align: center;
  1752. }
  1753. .canqueding {
  1754. margin-top: -35px;
  1755. margin-left: 407px;
  1756. width: 76px;
  1757. height: 35px;
  1758. opacity: 1;
  1759. border-radius: 5px;
  1760. background: rgba(62, 142, 247, 1);
  1761. font-size: 16px;
  1762. font-weight: 400;
  1763. line-height: 35px;
  1764. color: rgba(255, 255, 255, 1);
  1765. text-align: center;
  1766. }
  1767. .setmeal {
  1768. width: 1000px;
  1769. margin: 45px auto !important;
  1770. }
  1771. .setmeal .el-form-item {
  1772. display: flex;
  1773. margin: 0 40px 20px 0;
  1774. }
  1775. .setmeal .dialog-footer {
  1776. display: flex;
  1777. flex-direction: row-reverse;
  1778. }
  1779. .setmeal .divhove {
  1780. position: absolute;
  1781. width: 100%;
  1782. height: 100%;
  1783. left: 0;
  1784. top: 0;
  1785. opacity: 0;
  1786. cursor: default;
  1787. text-align: center;
  1788. padding-top: 43%;
  1789. border-radius: 6px;
  1790. background-color: rgba(0, 0, 0, 0.5);
  1791. -webkit-transition: opacity 0.3s;
  1792. transition: opacity 0.3s;
  1793. }
  1794. .setmeal .divhove:hover {
  1795. opacity: 0.8;
  1796. }
  1797. .setRule {
  1798. width: 600px;
  1799. }
  1800. </style>