Quanyi.vue 22 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661
  1. <template>
  2. <div>
  3. <el-breadcrumb separator="/">
  4. <el-breadcrumb-item :to="{ path: '/' }">{{ $t('cuxiao.home') }}</el-breadcrumb-item>
  5. <el-breadcrumb-item>{{ $t('cuxiao.yuiquangl') }}</el-breadcrumb-item>
  6. <el-breadcrumb-item>{{ $t('quanyi.kyyhq') }}</el-breadcrumb-item>
  7. </el-breadcrumb>
  8. <div style="margin-top: 30px;display: flex;align-items: center;">
  9. <el-button v-for="item in storeList" :type="dqmd==item.id?'primary':'info'" class="biaoqian" @click="xuanzhemd(item.id)">{{item.posName}}</el-button>
  10. </div>
  11. <el-row :gutter="10" style="margin-top: 20px;margin-bottom: 20px;">
  12. <el-col :span="1.5">
  13. <el-button
  14. type="primary"
  15. plain
  16. icon="el-icon-plus"
  17. size="mini"
  18. @click="handleAdd"
  19. >{{ $t('quanyi.add') }}
  20. </el-button>
  21. </el-col>
  22. </el-row>
  23. <el-table ref="filterTable" v-loading="loding" :data="tableData" :header-cell-style="{background:'#f0f0f0'}">
  24. <el-table-column
  25. prop="id"
  26. label="id"
  27. >
  28. </el-table-column>
  29. <el-table-column
  30. prop="name"
  31. :label="$t('quanyi.yhmc')"
  32. >
  33. </el-table-column>
  34. <el-table-column
  35. prop="yhfangs"
  36. :label="$t('quanyi.yhfs')"
  37. width="200"
  38. >
  39. <template slot-scope="scope">
  40. <span v-if="scope.row.yhfangs== '1'">{{ $t('quanyi.yhqlx1') }}</span>
  41. <span v-else-if="scope.row.yhfangs == '2'">{{ $t('quanyi.yhqlx2') }}</span>
  42. <span v-else-if="scope.row.yhfangs == '3'">{{ $t('quanyi.yhqlx3') }}</span>
  43. <!-- <span v-else-if="scope.row.yhfangs == '3'">{{ $t('quanyi.yhqlx4') }}</span>-->
  44. <span v-else>-</span>
  45. </template>
  46. </el-table-column>
  47. <el-table-column
  48. prop="total"
  49. :label="$t('quanyi.total')"
  50. >
  51. </el-table-column>
  52. <el-table-column
  53. prop="claimedCount"
  54. :label="$t('quanyi.claimedCount')"
  55. >
  56. </el-table-column>
  57. <el-table-column
  58. prop="createTime"
  59. :label="$t('quanyi.creatTime')"
  60. width="200"
  61. >
  62. </el-table-column>
  63. <el-table-column
  64. prop="state"
  65. :label="$t('quanyi.zt')"
  66. >
  67. <template slot-scope="scope">
  68. <span v-if="scope.row.state == '0'">{{ $t('quanyi.qy') }}</span>
  69. <span v-else-if="scope.row.state == '1'">{{ $t('quanyi.gb') }}</span>
  70. <span v-else>-</span>
  71. </template>
  72. </el-table-column>
  73. <el-table-column
  74. fixed="right"
  75. :label="$t('mendian.operate')"
  76. width="120">
  77. <template slot-scope="scope">
  78. <el-button @click="handleUpdate(scope.row)" type="text" size="small">{{ $t('cuxiao.modify') }}</el-button>
  79. <el-button @click="delechansu(scope.row)" type="text" size="small">{{ $t('cuxiao.delete') }}</el-button>
  80. </template>
  81. </el-table-column>
  82. </el-table>
  83. <div style="width: 100%;display: flex;justify-content: flex-end;">
  84. <el-pagination
  85. @size-change="handleSizeChange"
  86. @current-change="handleCurrentChange"
  87. :current-page="queryParams.page"
  88. :page-size="queryParams.size"
  89. layout="total, prev, pager, next"
  90. :total="total">
  91. </el-pagination>
  92. </div>
  93. <!-- 添加或修改对话框 -->
  94. <el-dialog :title="text" :visible.sync="open"
  95. :width="$t('loding.language')=='en'||$t('loding.language')=='vi'?'650px':'600px'" append-to-body>
  96. <el-alert
  97. v-if="!form.edit"
  98. :title="$t('quanyi.bnxg')"
  99. type="error"
  100. show-icon
  101. :closable="false"
  102. style="margin-bottom: 16px;"
  103. />
  104. <el-form ref="form" :model="form" :rules="rules"
  105. :label-width="$t('loding.language')=='en'||$t('loding.language')=='vi'?'180px':'100px'">
  106. <el-form-item :label="$t('quanyi.md')">
  107. <el-select :disabled="!form.edit" v-model="form.shId" :placeholder="$t('quanyi.xcmd')" style="width: 180px;" @change="handleStoreChange">
  108. <el-option v-for="item in storeList" :key="item.id" :label="item.posName" :value="item.id" />
  109. </el-select>
  110. </el-form-item>
  111. <el-form-item :label="$t('quanyi.yhmc')" prop="name">
  112. <el-input v-model="form.name" :placeholder="$t('quanyi.sryhmc')" :readonly="!form.edit"/>
  113. </el-form-item>
  114. <!-- <el-form-item :label="$t('cuxiao.hdhb')" prop="poster">-->
  115. <!-- <el-upload-->
  116. <!-- class="avatar-uploader"-->
  117. <!-- :action="seruer+'/utils/Upload'"-->
  118. <!-- :show-file-list="false"-->
  119. <!-- :on-success="handleAvatarlogo"-->
  120. <!-- :before-upload="beforeAvatarUpload">-->
  121. <!-- <img v-if="form.poster" :src="seruer+form.poster" class="avatar">-->
  122. <!-- <i v-else class="el-icon-plus avatar-uploader-icon"></i>-->
  123. <!-- </el-upload>-->
  124. <!-- </el-form-item>-->
  125. <el-form-item :label="$t('quanyi.yhfs')" prop="yhfangs" >
  126. <el-radio :disabled="!form.edit" v-model="form.yhfangs" :label="1">{{ $t('quanyi.yhqlx1') }}</el-radio>
  127. <el-radio :disabled="!form.edit" v-model="form.yhfangs" :label="2">{{ $t('quanyi.yhqlx2') }}</el-radio>
  128. <el-radio :disabled="!form.edit" v-model="form.yhfangs" :label="3">{{ $t('quanyi.yhqlx3') }}</el-radio>
  129. <!-- <el-radio v-model="form.yhfangs" :label="3">{{ $t('quanyi.yhqlx4') }}</el-radio>-->
  130. </el-form-item>
  131. <!-- <el-form-item v-if="form.yhfangs == '3'" :label="$t('quanyi.xcsp')" prop="spId">-->
  132. <!-- <div style="display: flex; align-items: center;">-->
  133. <!-- <el-button type="primary" @click="openSelectProductDialog">{{$t('quanyi.xcsp')}}</el-button>-->
  134. <!-- <div v-if="selectedProduct && selectedProduct.name" style="margin-left: 16px;display: flex;align-items: center;">-->
  135. <!-- <img v-if="selectedProduct.image" :src="seruer+selectedProduct.image" style="width:40px;height:40px;margin-right:8px;" />-->
  136. <!-- <span>{{selectedProduct.name}}</span>-->
  137. <!-- </div>-->
  138. <!-- </div>-->
  139. <!-- </el-form-item>-->
  140. <el-form-item :label="$t('quanyi.yhnum')" prop="yhnum">
  141. <el-input type="number" v-model="form.yhnum" :placeholder="$t('quanyi.sryhnum')" :readonly="!form.edit"/>
  142. </el-form-item>
  143. <el-form-item :label="$t('quanyi.total')" prop="total">
  144. <el-input type="number" v-model="form.total" :placeholder="$t('quanyi.srtotal')" :readonly="!form.edit"/>
  145. </el-form-item>
  146. <el-form-item :label="$t('quanyi.lqxz')" prop="lqxz">
  147. <el-input type="number" v-model="form.lqxz" :placeholder="$t('quanyi.srlqxz')" :readonly="!form.edit"/>
  148. </el-form-item>
  149. <el-form-item :label="$t('quanyi.validity')" prop="validity">
  150. <el-input type="number" v-model="form.validity" min="1" :placeholder="$t('quanyi.srvalidity')" :readonly="!form.edit"/>
  151. </el-form-item>
  152. <el-form-item :label="$t('quanyi.tiaojian')" prop="tiaojian">
  153. <el-input type="number" v-model="form.tiaojian" :placeholder="$t('quanyi.srtiaojian')" :readonly="!form.edit"/>
  154. </el-form-item>
  155. <el-form-item :label="$t('quanyi.zt')" prop="state">
  156. <el-radio v-model="form.state" label="0">{{ $t('quanyi.qy') }}</el-radio>
  157. <el-radio v-model="form.state" label="1">{{ $t('quanyi.gb') }}</el-radio>
  158. </el-form-item>
  159. <el-form-item :label="$t('quanyi.shuoming')" prop="shuoming">
  160. <el-input type="textarea" v-model="form.shuoming" :placeholder="$t('quanyi.srshuoming')"/>
  161. </el-form-item>
  162. </el-form>
  163. <div slot="footer" class="dialog-footer">
  164. <el-button type="primary" @click="tijiaobaocun">{{ $t('mendian.determine') }}</el-button>
  165. <el-button @click="cancel">{{ $t('mendian.cancellation') }}</el-button>
  166. </div>
  167. </el-dialog>
  168. <el-dialog :title="$t('quanyi.xcsp')" :visible.sync="selectProductDialogVisible" width="800px">
  169. <div style="margin-bottom: 12px;">
  170. <el-form inline>
  171. <!-- <el-form-item :label="$t('quanyi.md')">-->
  172. <!-- <el-select v-model="selectedStoreId" :placeholder="$t('quanyi.xcmd')" style="width: 180px;" @change="handleStoreChange">-->
  173. <!-- <el-option v-for="item in storeList" :key="item.id" :label="item.posName" :value="item.id" />-->
  174. <!-- </el-select>-->
  175. <!-- </el-form-item>-->
  176. <el-form-item :label="$t('quanyi.spfl')">
  177. <el-select v-model="selectedProductCategory" :placeholder="$t('quanyi.spfl')" style="width: 180px;" @change="handleCategoryChange">
  178. <el-option v-for="item in productCategoryList" :key="item.id" :label="item.name" :value="item.id" />
  179. </el-select>
  180. </el-form-item>
  181. <el-form-item :label="$t('quanyi.spmc')">
  182. <el-input v-model="productTableQuery.name" :placeholder="$t('quanyi.spmc')" style="width: 180px;" @keyup.enter.native="getProductTableData" />
  183. </el-form-item>
  184. <el-form-item>
  185. <el-button type="primary" icon="el-icon-search" @click="getProductTableData">{{$t('quanyi.cx')}}</el-button>
  186. </el-form-item>
  187. </el-form>
  188. </div>
  189. <el-table :data="productTableData" highlight-current-row @current-change="handleProductTableSelect" :row-key="row=>row.id" style="width:100%;">
  190. <el-table-column type="index" label="#" width="50" />
  191. <el-table-column prop="name" :label="$t('quanyi.spmc')" />
  192. <el-table-column prop="image" :label="$t('quanyi.tp')" width="80">
  193. <template slot-scope="scope">
  194. <img v-if="scope.row.image" :src="seruer+scope.row.image" style="width:40px;height:40px;" />
  195. </template>
  196. </el-table-column>
  197. <el-table-column prop="price" :label="$t('quanyi.jg')" />
  198. </el-table>
  199. <div style="margin-top: 10px;text-align: right;">
  200. <el-pagination
  201. @size-change="handleProductTableSizeChange"
  202. @current-change="handleProductTableCurrentChange"
  203. :current-page="productTableQuery.page"
  204. :page-size="productTableQuery.size"
  205. layout="total, prev, pager, next"
  206. :total="productTableTotal">
  207. </el-pagination>
  208. </div>
  209. <span slot="footer" class="dialog-footer">
  210. <el-button @click="selectProductDialogVisible=false">{{$t('quanyi.qx')}}</el-button>
  211. <el-button type="primary" @click="handleProductSelectConfirm">{{$t('quanyi.qd')}}</el-button>
  212. </span>
  213. </el-dialog>
  214. </div>
  215. </template>
  216. <script>
  217. import {listQuanyi,getQuanyi,addQuanyi,updateQuanyi,delQuanyi} from '@/api/quanyi';
  218. import googmap from "@/components/googmap.vue";
  219. import { storelistlist, getordfenlei,getFoodPageList,getFood } from '@/api/food';
  220. import Bus from "@/utils/Bus"; // 路径按你实际情况
  221. export default {
  222. name: "AcidrollingCapacity",
  223. components: {
  224. googmap
  225. },
  226. data() {
  227. return {
  228. seruer: process.env.VUE_APP_BASE_URL ,
  229. loding: false,
  230. tableData: [],
  231. total: 0,
  232. checkList: [],
  233. //分页
  234. queryParams: {
  235. page: 1,
  236. size: 10,
  237. language:this.$t('loding.lass')
  238. },
  239. fenlei: [],
  240. fwlxlist: [],
  241. open: false,
  242. opmap: false,
  243. form: {edit:true},
  244. user: {},
  245. mdid: '',
  246. // 表单校验
  247. rules: {
  248. name: [
  249. {
  250. required: true,
  251. validator: (rule, value, callback) => {
  252. if (!value) {
  253. callback(new Error(this.$t('quanyi.nameEpty')));
  254. } else {
  255. callback();
  256. }
  257. },
  258. trigger: 'blur'
  259. }
  260. ],
  261. yhfangs: [
  262. {
  263. required: true,
  264. validator: (rule, value, callback) => {
  265. if (!value && value !== 0) {
  266. callback(new Error(this.$t('quanyi.yhfangsEmpty')));
  267. } else {
  268. callback();
  269. }
  270. },
  271. trigger: 'change'
  272. }
  273. ],
  274. yhnum: [
  275. {
  276. required: true,
  277. validator: (rule, value, callback) => {
  278. if (!value && value !== 0) {
  279. callback(new Error(this.$t('quanyi.yhnumEmty')));
  280. } else if (this.form.yhfangs != 1 && value <= 0) {
  281. callback(new Error(this.$t('quanyi.yhmnum0')));
  282. } else {
  283. callback();
  284. }
  285. },
  286. trigger: 'blur'
  287. }
  288. ],
  289. total: [
  290. {
  291. required: true,
  292. validator: (rule, value, callback) => {
  293. if (!value && value !== 0) {
  294. callback(new Error(this.$t('quanyi.totalEmty')));
  295. } else {
  296. callback();
  297. }
  298. },
  299. trigger: 'blur'
  300. }
  301. ],
  302. lqxz: [
  303. {
  304. required: true,
  305. validator: (rule, value, callback) => {
  306. if (!value && value !== 0) {
  307. callback(new Error(this.$t('quanyi.lqxzEmty')));
  308. } else {
  309. callback();
  310. }
  311. },
  312. trigger: 'blur'
  313. }
  314. ],
  315. validity:[
  316. {
  317. required: true,
  318. validator: (rule, value, callback) => {
  319. if (!value && value !== 0) {
  320. callback(new Error(this.$t('quanyi.validityEmty')));
  321. } else {
  322. callback();
  323. }
  324. },
  325. trigger: 'blur'
  326. }
  327. ],
  328. state:[
  329. {
  330. required: true,
  331. validator: (rule, value, callback) => {
  332. if (!value && value !== 0) {
  333. callback(new Error(this.$t('quanyi.stateEmty')));
  334. } else {
  335. callback();
  336. }
  337. },
  338. trigger: 'change'
  339. }
  340. ],
  341. spId: [
  342. {
  343. validator: (rule, value, callback) => {
  344. if (this.form.yhfangs == '3' && !value) {
  345. callback(new Error(this.$t('quanyi.qxcsp')));
  346. } else {
  347. callback();
  348. }
  349. },
  350. trigger: 'change'
  351. }
  352. ]
  353. },
  354. mapaddress: null,
  355. text: '',
  356. productList: [],
  357. selectProductDialogVisible: false,
  358. productTableData: [],
  359. productTableTotal: 0,
  360. productTableQuery: { page: 1, size: 8, name: '', type: '' },
  361. selectedProduct: {},
  362. storeList: [], // 门店列表
  363. selectedStoreId: '', // 当前选中的门店ID
  364. productCategoryList: [], // 分类列表
  365. selectedProductCategory: '', // 当前选中的分类ID
  366. language:this.$t('loding.lass'),
  367. dqmd:null,
  368. }
  369. },
  370. created() {
  371. this.getStoreList();
  372. const that = this;
  373. Bus.$on('l18zh',function(res){
  374. that.language = res;
  375. })
  376. },
  377. watch: {
  378. language(newVal) {
  379. // 语言变化时执行逻辑
  380. this.listQuanyi();
  381. }
  382. },
  383. methods: {
  384. xuanzhemd(id){
  385. this.dqmd = id;
  386. this.listQuanyi()
  387. },
  388. delechansu(e) {
  389. this.$confirm(this.$t('cuxiao.delSm'), this.$t('mendian.prompt'), {
  390. confirmButtonText: this.$t('mendian.determine'),
  391. cancelButtonText: this.$t('mendian.cancellation'),
  392. type: 'warning'
  393. }).then(() => {
  394. delQuanyi(e.id).then(res => {
  395. // console.log('删除',res);
  396. if (res.code == 200) {
  397. this.listQuanyi();
  398. this.$message({
  399. type: 'success',
  400. message: this.$t('mendian.successful')
  401. });
  402. } else {
  403. this.$message({
  404. type: 'info',
  405. message: this.$t('mendian.Deletefailed')
  406. });
  407. }
  408. })
  409. }).catch(() => {
  410. this.$message({
  411. type: 'info',
  412. message: this.$t('mendian.undelete')
  413. });
  414. });
  415. },
  416. tijiaobaocun() {
  417. console.log(this.form)
  418. this.$refs["form"].validate(valid => {
  419. if (valid) {
  420. if (this.form.id != null) {
  421. updateQuanyi(this.form).then(res => {
  422. // console.log('操作成功',res)
  423. if (res.code == 200) {
  424. this.listQuanyi();
  425. this.open = false;
  426. this.reset();
  427. }
  428. })
  429. } else {
  430. this.form.language=this.language=='zh'?'2':this.language=='tw'?'3':this.language=='en'?'1':'0';
  431. addQuanyi(this.form).then(res => {
  432. // console.log('操作成功',res)
  433. if (res.code == 200) {
  434. this.listQuanyi();
  435. this.open = false;
  436. this.reset();
  437. }
  438. })
  439. }
  440. }
  441. });
  442. },
  443. /** 修改按钮操作 */
  444. handleUpdate(row) {
  445. this.reset();
  446. const id = row.id;
  447. getQuanyi(id).then(response => {
  448. this.form = response.data;
  449. this.open = true;
  450. this.text = this.$t('cuxiao.modify');
  451. // 关键:如果是减免个别商品,并且有 spId,查商品详情
  452. if(this.form.yhfangs == '3' && this.form.spId) {
  453. getFood(this.form.spId).then(f => {
  454. this.selectedProduct = {
  455. id: f.data.id,
  456. name: f.data.name,
  457. image: f.data.image
  458. };
  459. });
  460. } else {
  461. this.selectedProduct = {};
  462. }
  463. });
  464. },
  465. reset() {
  466. this.form = {
  467. id: null,
  468. vip: null,
  469. yhfangs: null,
  470. yhnum: null,
  471. name: null,
  472. shuoming: null,
  473. tiaojian: null,
  474. num: null,
  475. state: null,
  476. total: null,
  477. validity: null,
  478. lqxz: null,
  479. shId:null,
  480. spId: null,
  481. poster:null,
  482. language:null,
  483. edit:true
  484. };
  485. this.selectedProduct = {};
  486. },
  487. handleAdd() {
  488. this.reset();
  489. this.text = this.$t('quanyi.add');
  490. this.open = true;
  491. this.form.shId=this.dqmd;
  492. },
  493. cancel() {
  494. this.open = false;
  495. this.reset();
  496. },
  497. listQuanyi() {
  498. var that = this;
  499. that.loding = true;
  500. this.queryParams.language= this.language=='zh'?'2':this.language=='tw'?'3':this.language=='en'?'1':'0';
  501. this.queryParams.shId= this.dqmd;
  502. listQuanyi(this.queryParams).then(response => {
  503. that.loding = false;
  504. this.total = response.data.total;
  505. this.tableData = response.data.records;
  506. });
  507. },
  508. //翻页
  509. handleSizeChange(val) {
  510. // console.log(`每页 ${val} 条`);
  511. this.queryParams.size = val;
  512. this.listQuanyi();
  513. },
  514. handleCurrentChange(val) {
  515. // console.log(`当前页: ${val}`);
  516. this.queryParams.page = val;
  517. this.listQuanyi();
  518. },
  519. handleAvatarlogo(res, file) {
  520. // this.upimg = URL.createObjectURL(file.raw);
  521. this.form.poster = file.response.data;
  522. // console.log('上传图片',file.response);
  523. },
  524. beforeAvatarUpload(file) {
  525. const isJPG = file.type === 'image/jpeg';
  526. const isLt2M = file.size / 1024 / 1024 < 2;
  527. if (!isJPG) {
  528. this.$message.error(this.$t('quanyi.ItcanonlyJPG'));
  529. }
  530. if (!isLt2M) {
  531. this.$message.error(this.$t('quanyi.Cannotexceed'));
  532. }
  533. return isJPG && isLt2M;
  534. },
  535. openSelectProductDialog() {
  536. this.selectProductDialogVisible = true;
  537. },
  538. getStoreList() {
  539. storelistlist().then(res => {
  540. if (res.data && res.data.records && res.data.records.length > 0) {
  541. this.storeList = res.data.records;
  542. this.selectedStoreId = res.data.records[0].id;
  543. this.dqmd=res.data.records[0].id;
  544. this.listQuanyi()
  545. this.getProductCategoryList(); // 获取第一个门店的分类
  546. }
  547. });
  548. },
  549. getProductCategoryList() {
  550. if (!this.selectedStoreId) {
  551. this.productCategoryList = [];
  552. this.selectedProductCategory = '';
  553. return;
  554. }
  555. const language =this.language=='zh'?'2':this.language=='tw'?'3':this.language=='en'?'1':'0';
  556. getordfenlei(this.selectedStoreId, language).then(res => {
  557. if (res.data && res.data.length > 0) {
  558. this.productCategoryList = res.data;
  559. this.selectedProductCategory = res.data[0].id;
  560. this.getProductTableData();
  561. } else {
  562. this.productCategoryList = [];
  563. this.selectedProductCategory = '';
  564. this.productTableData = [];
  565. }
  566. });
  567. },
  568. handleProductTableCurrentChange(val) {
  569. this.productTableQuery.page = val;
  570. this.getProductTableData();
  571. },
  572. handleProductTableSizeChange(val) {
  573. this.productTableQuery.size = val;
  574. this.getProductTableData();
  575. },
  576. handleProductTableSelect(row) {
  577. this.selectedProduct = row;
  578. },
  579. handleProductSelectConfirm() {
  580. if(this.selectedProduct) {
  581. this.form.spId = this.selectedProduct.id;
  582. this.selectProductDialogVisible = false;
  583. } else {
  584. this.$message.warning('请选择商品');
  585. }
  586. },
  587. // 门店切换
  588. handleStoreChange() {
  589. this.selectedStoreId =this.form.shId
  590. this.getProductCategoryList();
  591. },
  592. // 分类切换
  593. handleCategoryChange() {
  594. this.getProductTableData();
  595. },
  596. // 获取商品列表
  597. getProductTableData() {
  598. const lang = this.$t('loding.language')=='zh'?'2':this.$t('loding.language')=='tw'?'3':this.$t('loding.language')=='en'?'1':'0';
  599. const params = {
  600. page: this.productTableQuery.page,
  601. size: this.productTableQuery.size,
  602. name: this.productTableQuery.name,
  603. lang: lang,
  604. flId: this.selectedProductCategory,
  605. mdId: this.selectedStoreId // 如果接口需要门店id
  606. };
  607. getFoodPageList(params).then(res => {
  608. if(res.data && res.data.records) {
  609. this.productTableData = res.data.records || [];
  610. this.productTableTotal = res.data.total || 0;
  611. }
  612. });
  613. },
  614. }
  615. }
  616. </script>
  617. <style>
  618. .avatar-uploader .el-upload {
  619. border: 1px dashed #d9d9d9;
  620. border-radius: 6px;
  621. cursor: pointer;
  622. position: relative;
  623. overflow: hidden;
  624. }
  625. .avatar-uploader .el-upload:hover {
  626. border-color: #409EFF;
  627. }
  628. .avatar-uploader-icon {
  629. font-size: 28px;
  630. color: #8c939d;
  631. width: 100px;
  632. height: 100px;
  633. line-height: 100px;
  634. text-align: center;
  635. }
  636. .avatar {
  637. width: 100px;
  638. height: 100px;
  639. display: block;
  640. }
  641. </style>