AcidrollingCapacity.vue 21 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657
  1. <template>
  2. <div>
  3. <el-breadcrumb separator="/">
  4. <el-breadcrumb-item :to="{ path: '/' }">{{$t('mendian.home')}}</el-breadcrumb-item>
  5. <el-breadcrumb-item>{{$t('mendian.Management')}}</el-breadcrumb-item>
  6. <el-breadcrumb-item>{{$t('mendian.StoreList')}}</el-breadcrumb-item>
  7. </el-breadcrumb>
  8. <el-row :gutter="10" style="margin-top: 20px;margin-bottom: 20px;">
  9. <el-col :span="1.5">
  10. <el-button
  11. type="primary"
  12. plain
  13. icon="el-icon-plus"
  14. size="mini"
  15. @click="handleAdd"
  16. >{{$t('mendian.AddStore')}}</el-button>
  17. </el-col>
  18. </el-row>
  19. <el-table ref="filterTable" v-loading="loding" :data="tableData" :header-cell-style="{background:'#f0f0f0'}">
  20. <el-table-column
  21. prop="id"
  22. label="id"
  23. >
  24. </el-table-column>
  25. <el-table-column
  26. prop="image"
  27. :label="$t('mendian.StoreCover')"
  28. >
  29. <template slot-scope="scope">
  30. <img style="width: 50px;height: 50px;" :src="seruer+scope.row.image" alt="" />
  31. </template>
  32. </el-table-column>
  33. <el-table-column
  34. prop="posName"
  35. :label="$t('mendian.StoreName')"
  36. width="200"
  37. >
  38. </el-table-column>
  39. <el-table-column
  40. prop="posPrice"
  41. :label="$t('mendian.Startingprice')"
  42. width="200"
  43. >
  44. </el-table-column>
  45. <!-- <el-table-column-->
  46. <!-- prop="businessHours"-->
  47. <!-- :label="$t('mendian.businesshours')"-->
  48. <!-- >-->
  49. <!-- </el-table-column>-->
  50. <el-table-column
  51. prop="area"
  52. :label="$t('mendian.area')"
  53. >
  54. </el-table-column>
  55. <el-table-column
  56. prop="telephone"
  57. :label="$t('mendian.Telephone')"
  58. width="200"
  59. >
  60. </el-table-column>
  61. <el-table-column
  62. fixed="right"
  63. :label="$t('mendian.operate')"
  64. width="120">
  65. <template slot-scope="scope">
  66. <el-button @click="handleClick(scope.row)" type="text" size="small">{{$t('mendian.modify')}}</el-button>
  67. <el-button @click="delechansu(scope.row)" type="text" size="small">{{$t('mendian.delete')}}</el-button>
  68. </template>
  69. </el-table-column>
  70. </el-table>
  71. <div style="width: 100%;display: flex;justify-content: flex-end;">
  72. <el-pagination
  73. @size-change="handleSizeChange"
  74. @current-change="handleCurrentChange"
  75. :current-page="queryParams.page"
  76. :page-size="queryParams.size"
  77. layout="total, prev, pager, next"
  78. :total="total">
  79. </el-pagination>
  80. </div>
  81. <!-- 添加或修改门店分类对话框 -->
  82. <el-dialog :title="text" :visible.sync="open" :width="$t('loding.language')=='en'||$t('loding.language')=='vi'?'650px':'600px'" append-to-body>
  83. <el-form ref="form" :model="form" :rules="rules" :label-width="$t('loding.language')=='en'||$t('loding.language')=='vi'?'180px':'100px'">
  84. <el-form-item :label="$t('mendian.logo')" prop="logo">
  85. <el-upload
  86. class="avatar-uploader"
  87. :action="seruer+'/utils/Upload'"
  88. :show-file-list="false"
  89. :on-success="handleAvatarlogo"
  90. :before-upload="beforeAvatarUpload">
  91. <img v-if="form.logo" :src="seruer+form.logo" class="avatar">
  92. <i v-else class="el-icon-plus avatar-uploader-icon"></i>
  93. </el-upload>
  94. </el-form-item>
  95. <el-form-item :label="$t('mendian.StoreCover')" prop="image">
  96. <el-upload
  97. class="avatar-uploader"
  98. :action="seruer+'/utils/Upload'"
  99. :show-file-list="false"
  100. :on-success="handleAvatarSuccess"
  101. :before-upload="beforeAvatarUpload">
  102. <img v-if="form.image" :src="seruer+form.image" class="avatar">
  103. <i v-else class="el-icon-plus avatar-uploader-icon"></i>
  104. </el-upload>
  105. </el-form-item>
  106. <el-form-item :label="$t('mendian.StoreName')" prop="posName">
  107. <el-input v-model="form.posName" :placeholder="$t('mendian.Enterstorename')" />
  108. </el-form-item>
  109. <el-form-item :label="$t('mendian.address')" prop="address">
  110. <div style="display: flex;align-items: center;">
  111. <el-input v-model="form.address" :placeholder="$t('mendian.InputAddress')" />
  112. <i style="color: #55aaff; margin-left: 10px;font-size: 25px;" class="el-icon-location" @click="xuanzhemap"></i>
  113. </div>
  114. </el-form-item>
  115. <el-form-item :label="$t('mendian.coordinate')" prop="longitude">
  116. <div style="display: flex;align-items: center;" @click="xuanzhemap">
  117. <div>{{form.longitude==null?$t('mendian.Positioningobtaincoordinates'):form.longitude+','+form.latitude}}</div>
  118. </div>
  119. </el-form-item>
  120. <el-form-item :label="$t('mendian.Storetype')" prop="type">
  121. <el-radio v-model="form.type" :label="0" @change="handleTypeChange">{{$t('mendian.Restaurant')}}</el-radio>
  122. <el-radio v-model="form.type" :label="1" @change="handleTypeChange">{{$t('mendian.Supermarket')}}</el-radio>
  123. </el-form-item>
  124. <el-form-item :label="'是否关联夜市'" prop="isNightMarket">
  125. <el-radio v-model="form.isNightMarket" :label="1">是</el-radio>
  126. <el-radio v-model="form.isNightMarket" :label="0">否</el-radio>
  127. </el-form-item>
  128. <el-form-item v-if="form.isNightMarket === 1" :label="'夜市'" prop="nightMarketId">
  129. <el-select v-model="form.nightMarketId" placeholder="请选择夜市">
  130. <el-option
  131. v-for="item in nightMarketList"
  132. :key="item.userId"
  133. :label="item.nickName"
  134. :value="item.userId">
  135. </el-option>
  136. </el-select>
  137. </el-form-item>
  138. <el-form-item :label="$t('mendian.Startingprice')" prop="posPrice">
  139. <el-input v-model="form.posPrice" :placeholder="$t('mendian.Fillintheprice')" />
  140. </el-form-item>
  141. <el-form-item :label="$t('mendian.Telephone')" prop="telephone">
  142. <el-input v-model="form.telephone" :placeholder="$t('mendian.Fillphonenumber')" />
  143. </el-form-item>
  144. <el-form-item :label="$t('mendian.openingtime')" prop="businessHours">
  145. <div v-for="(item, idx) in form.businessHours" :key="idx" style="display: flex; align-items: center; margin-bottom: 8px;">
  146. <el-time-picker
  147. v-model="item.startTime"
  148. :placeholder="$t('mendian.FillopenBusiness')"
  149. value-format="HH:mm"
  150. format="HH:mm"
  151. style="width: 110px;"
  152. />
  153. <span style="margin: 0 8px;">—</span>
  154. <el-time-picker
  155. v-model="item.endTime"
  156. :placeholder="$t('mendian.FillwindingUp')"
  157. value-format="HH:mm"
  158. format="HH:mm"
  159. style="width: 110px;"
  160. />
  161. <el-button
  162. v-if="form.businessHours.length > 1"
  163. icon="el-icon-minus"
  164. type="danger"
  165. size="mini"
  166. @click="removeBusinessHour(idx)"
  167. style="margin-left: 8px;"
  168. ></el-button>
  169. </div>
  170. <el-button
  171. icon="el-icon-plus"
  172. type="primary"
  173. size="mini"
  174. @click="addBusinessHour"
  175. >{{$t('mendian.addTime')}}</el-button>
  176. </el-form-item>
  177. <el-form-item :label="$t('mendian.classification')" prop="sort">
  178. <el-select v-model="form.sort" multiple placeholder="请选择分类" @change="handleSortChange">
  179. <el-option
  180. v-for="item in fenlei"
  181. :key="item.id"
  182. :label="$t('loding.language')=='zh-CN'?item.name:$t('loding.language')=='en'?item.nameEn:$t('loding.language')=='zh-TW'?item.nameTw:item.nameVi"
  183. :value="item.id">
  184. </el-option>
  185. </el-select>
  186. <!-- 显示选中的分类名称 -->
  187. <div v-if="selectedCategoryNames && selectedCategoryNames.length > 0" style="margin-top: 5px;">
  188. <el-tag
  189. v-for="(name, index) in selectedCategoryNames"
  190. :key="index"
  191. size="small"
  192. style="margin-right: 5px; margin-bottom: 5px;">
  193. {{ name }}
  194. </el-tag>
  195. </div>
  196. </el-form-item>
  197. <el-form-item :label="$t('mendian.ServiceType')" prop="serverType">
  198. <el-checkbox-group v-model="checkList">
  199. <el-checkbox v-for="item in fwlxlist" :label="item.id" @change="huoqujieguo">{{$t('loding.language')=='zh-CN'?item.nameCn:$t('loding.language')=='en'?item.nameEn:$t('loding.language')=='zh-TW'?item.nameTw:item.nameVi}}</el-checkbox>
  200. </el-checkbox-group>
  201. </el-form-item>
  202. <el-form-item :label="$t('mendian.state')" prop="state">
  203. <el-radio v-model="form.state" :label="0">{{$t('mendian.trade')}}</el-radio>
  204. <el-radio v-model="form.state" :label="1">{{$t('mendian.close')}}</el-radio>
  205. </el-form-item>
  206. </el-form>
  207. <div slot="footer" class="dialog-footer">
  208. <el-button type="primary" @click="tijiaobaocun">{{$t('mendian.determine')}}</el-button>
  209. <el-button @click="cancel">{{$t('mendian.cancellation')}}</el-button>
  210. </div>
  211. </el-dialog>
  212. <!-- 地图 -->
  213. <el-dialog :title="$t('mendian.selectaddress')" :visible.sync="opmap" width="1000px" append-to-body>
  214. <googmap mapID="googleMap" @golat="huichuandizhi"></googmap>
  215. <div slot="footer" class="dialog-footer">
  216. <el-button type="primary" @click="dituqiueing">{{$t('mendian.determine')}}</el-button>
  217. <el-button @click="guanbimay">{{$t('mendian.cancellation')}}</el-button>
  218. </div>
  219. </el-dialog>
  220. </div>
  221. </template>
  222. <script>
  223. import {
  224. getfenlei,
  225. storelistlist,
  226. getAddr,
  227. addmendian,
  228. delemendian,
  229. getfwleixing,
  230. getNightMarketlist,
  231. getfenleilistByTag
  232. } from '@/api/store';
  233. import googmap from "@/components/googmap.vue";
  234. export default{
  235. name:"AcidrollingCapacity",
  236. components:{
  237. googmap
  238. },
  239. data(){
  240. return {
  241. seruer: process.env.VUE_APP_BASE_URL,
  242. loding:false,
  243. tableData:[],
  244. total:0,
  245. checkList:[],
  246. //分页
  247. queryParams: {
  248. page: 1,
  249. size: 10,
  250. },
  251. fenlei:[],
  252. fwlxlist:[],
  253. nightMarketList:[],
  254. open:false,
  255. opmap:false,
  256. form:{
  257. businessHours: [{ startTime: '', endTime: '' }]
  258. },
  259. user:{},
  260. mdid:'',
  261. // 表单校验
  262. rules: {
  263. image: [
  264. { required: true, message:this.$t('mendian.Covercannotempty'), trigger: "blur" }
  265. ],
  266. posName: [
  267. { required: true, message: this.$t('mendian.Namecannotempty'), trigger: "blur" }
  268. ],
  269. address: [
  270. { required: true, message: this.$t('mendian.Addresscannotempty'), trigger: "blur" }
  271. ],
  272. longitude: [
  273. { required: true, message: this.$t('mendian.Coordinatescannotempty'), trigger: "blur" }
  274. ],
  275. sort: [
  276. {
  277. type: 'array',
  278. required: true,
  279. message: this.$t('mendian.Classifiedmandatory'),
  280. trigger: "change"
  281. }
  282. ],
  283. serverType: [
  284. { required: true, message: this.$t('mendian.Selectservicetype'), trigger: "blur" }
  285. ],
  286. nightMarketId: [
  287. {
  288. validator: (rule, value, callback) => {
  289. if (this.form.isNightMarket === 1 && (!value || value === null)) {
  290. callback(new Error('请选择夜市'));
  291. } else {
  292. callback();
  293. }
  294. },
  295. trigger: 'change'
  296. }],
  297. businessHours: [
  298. {
  299. validator: (rule, value, callback) => {
  300. if (!value || value.length === 0) {
  301. callback(new Error(this.$t('mendian.zssjd')));
  302. } else if (value.some(v => !v.startTime || !v.endTime)) {
  303. callback(new Error(this.$t('mendian.mgsjd')));
  304. } else {
  305. callback();
  306. }
  307. },
  308. trigger: 'change'
  309. }]
  310. },
  311. mapaddress:null,
  312. text: '',
  313. }
  314. },
  315. computed: {
  316. // 获取选中分类的名称列表
  317. selectedCategoryNames() {
  318. if (!this.form.sort || !Array.isArray(this.form.sort)) {
  319. return [];
  320. }
  321. return this.form.sort.map(id => {
  322. const category = this.fenlei.find(item => item.id === id);
  323. if (category) {
  324. return this.$t('loding.language')=='zh-CN'?category.name:this.$t('loding.language')=='en'?category.nameEn:this.$t('loding.language')=='zh-TW'?category.nameTw:category.nameVi;
  325. }
  326. return '';
  327. }).filter(name => name);
  328. }
  329. },
  330. created() {
  331. this.getpinguilist();
  332. this.getfuleix();
  333. this.getNightMarketList();
  334. this.user = JSON.parse(localStorage.getItem('user'));
  335. // console.log('1111111111',this.user);
  336. },
  337. methods:{
  338. huoqujieguo(){
  339. this.form.serverType = this.checkList.length>0?JSON.stringify(this.checkList):null;
  340. console.log(this.form.serverType)
  341. },
  342. delechansu(e){
  343. this.$confirm(this.$t('mendian.youwanttodeleteit'), this.$t('mendian.prompt'), {
  344. confirmButtonText: this.$t('mendian.determine'),
  345. cancelButtonText: this.$t('mendian.cancellation'),
  346. type: 'warning'
  347. }).then(() => {
  348. delemendian(e.id).then(res=>{
  349. // console.log('删除',res);
  350. if(res.code==200){
  351. this.getpinguilist();
  352. this.$message({
  353. type: 'success',
  354. message: this.$t('mendian.successful')
  355. });
  356. }else{
  357. this.$message({
  358. type: 'info',
  359. message: this.$t('mendian.Deletefailed')
  360. });
  361. }
  362. })
  363. }).catch(() => {
  364. this.$message({
  365. type: 'info',
  366. message: this.$t('mendian.undelete')
  367. });
  368. });
  369. },
  370. tijiaobaocun(){
  371. this.$refs["form"].validate(valid => {
  372. if (valid) {
  373. // 深拷贝 businessHours,去除响应式属性
  374. const submitForm = { ...this.form };
  375. submitForm.businessHours = JSON.parse(JSON.stringify(this.form.businessHours));
  376. // 确保分类字段是英文逗号分隔的字符串格式
  377. if (Array.isArray(submitForm.sort)) {
  378. submitForm.sort = submitForm.sort.join(',');
  379. }
  380. console.log('发送到后端的数据:', submitForm);
  381. console.log('分类字段格式:', submitForm.sort);
  382. addmendian(submitForm).then(res=>{
  383. // console.log('操作成功',res)
  384. if(res.code==200){
  385. this.getpinguilist();
  386. this.open = false;
  387. this.checkList = [];
  388. this.reset();
  389. }
  390. })
  391. }
  392. });
  393. },
  394. //地图回传地址
  395. huichuandizhi(res){
  396. console.log('地址回传',res);
  397. console.log('回传数据类型:', typeof res);
  398. console.log('回传数据内容:', JSON.stringify(res));
  399. this.mapaddress = res;
  400. console.log('设置后的mapaddress:', this.mapaddress);
  401. },
  402. // 修改门店
  403. handleClick(res){
  404. this.text = this.$t('mendian.ModifyStore');
  405. console.log('修改门店',res);
  406. this.form = res;
  407. this.getfenleilistByTag();
  408. // 确保夜市字段有默认值
  409. if (this.form.isNightMarket === undefined || this.form.isNightMarket === null) {
  410. this.form.isNightMarket = 0;
  411. }
  412. if (this.form.nightMarketId === undefined || this.form.nightMarketId === null) {
  413. this.form.nightMarketId = null;
  414. }
  415. // 处理分类字段,如果是字符串则转换为数组
  416. if (typeof this.form.sort === 'string') {
  417. try {
  418. // 尝试解析JSON格式
  419. this.form.sort = JSON.parse(this.form.sort);
  420. } catch(e) {
  421. // 如果不是JSON格式,尝试按逗号分割
  422. if (this.form.sort.includes(',')) {
  423. this.form.sort = this.form.sort.split(',').map(id => parseInt(id.trim())).filter(id => !isNaN(id));
  424. } else {
  425. this.form.sort = this.form.sort ? [parseInt(this.form.sort)] : [];
  426. }
  427. }
  428. } else if (!Array.isArray(this.form.sort)) {
  429. this.form.sort = this.form.sort ? [this.form.sort] : [];
  430. }
  431. this.checkList = JSON.parse(res.serverType);
  432. if (res.businessHours && typeof res.businessHours === 'string') {
  433. try {
  434. this.form.businessHours = JSON.parse(res.businessHours);
  435. } catch(e) {
  436. this.$set(this.form, 'businessHours', [{ startTime: '', endTime: '' }]);
  437. }
  438. } else {
  439. this.$set(this.form, 'businessHours', res.businessHours || [{ startTime: '', endTime: '' }]);
  440. }
  441. if(!Array.isArray(this.form.businessHours) || this.form.businessHours.length === 0) {
  442. this.$set(this.form, 'businessHours', [{ startTime: '', endTime: '' }]);
  443. }
  444. this.open = true;
  445. },
  446. xuanzhemap(){
  447. this.opmap = true;
  448. // 重置地图地址数据
  449. this.mapaddress = null;
  450. },
  451. // 确认地址坐标选择
  452. dituqiueing(){
  453. console.log('当前地图地址数据:', this.mapaddress);
  454. if(this.mapaddress==null || !this.mapaddress.address || this.mapaddress.address === '地址获取失败'){
  455. this.$message.error(this.$t('mendian.Selectmapobtainaddress'));
  456. return
  457. }
  458. this.form.address = this.mapaddress.address;
  459. var lat = this.mapaddress.lat.split(",");
  460. this.form.latitude = lat[0];
  461. this.form.longitude = lat[1];
  462. console.log('设置坐标:', this.form.latitude, this.form.longitude);
  463. this.opmap = false;
  464. },
  465. guanbimay(){
  466. this.mapaddress =null;
  467. this.opmap = false;
  468. },
  469. reset() {
  470. this.form = {
  471. image: null,
  472. posName: null,
  473. posPrice:null,
  474. area:'',
  475. address:null,
  476. longitude:null,
  477. latitude:null,
  478. briefIntroduction:null,
  479. type:0, // 设置默认门店类型为餐厅
  480. isNightMarket:0,
  481. nightMarketId:null,
  482. hygienePermit:null,
  483. openBusiness:null,
  484. windingUp:null,
  485. sort:[],
  486. userId:this.user.userId,
  487. state:0,
  488. serverType:null,
  489. telephone:null,
  490. logo:null,
  491. businessHours: [{ startTime: '', endTime: '' }]
  492. };
  493. },
  494. handleAdd(){
  495. this.reset();
  496. this.text = this.$t('mendian.AddStore');
  497. this.checkList = [];
  498. // 设置默认门店类型为餐厅(0)
  499. this.form.type = 0;
  500. this.open = true;
  501. // 根据默认门店类型获取对应的分类
  502. this.getfenleilistByTag();
  503. },
  504. cancel() {
  505. this.open = false;
  506. this.checkList = [];
  507. this.reset();
  508. },
  509. getpinguilist(){
  510. var that = this;
  511. that.loding = true;
  512. storelistlist(this.queryParams).then(response => {
  513. that.loding = false;
  514. this.total = response.data.total;
  515. this.tableData = response.data.records;
  516. // console.log("获取门店列表",response);
  517. });
  518. },
  519. getfenlei(){
  520. getfenlei().then(res=>{
  521. console.log('获取分类',res);
  522. this.fenlei = res.rows;
  523. })
  524. },
  525. getfenleilistByTag(){
  526. if(this.form.type === undefined || this.form.type === null){
  527. this.$message.warning("请先选择门店类型");
  528. return;
  529. }
  530. let tag = this.form.type === 0 ? "food" : "mall";
  531. console.log('正在获取分类,门店类型:', this.form.type, '标签:', tag);
  532. getfenleilistByTag(tag).then(res=>{
  533. console.log('获取分类成功:', res);
  534. if (res && res.data) {
  535. this.fenlei = res.data;
  536. console.log('分类列表已更新:', this.fenlei);
  537. } else {
  538. this.fenlei = [];
  539. console.log('分类数据为空或格式不正确');
  540. }
  541. }).catch(error => {
  542. console.error('获取分类失败:', error);
  543. this.$message.error('获取分类失败,请重试');
  544. this.fenlei = [];
  545. })
  546. },
  547. handleTypeChange(){
  548. // 清空已选择的分类
  549. this.form.sort = [];
  550. // 根据门店类型获取对应的分类
  551. this.getfenleilistByTag();
  552. },
  553. handleSortChange(){
  554. console.log('分类选择变化:', this.form.sort);
  555. },
  556. // 调试方法:检查分类数据状态
  557. debugCategoryData(){
  558. console.log('=== 分类数据调试信息 ===');
  559. console.log('门店类型:', this.form.type);
  560. console.log('分类列表长度:', this.fenlei ? this.fenlei.length : 0);
  561. console.log('分类列表数据:', this.fenlei);
  562. console.log('已选择的分类:', this.form.sort);
  563. console.log('选中的分类名称:', this.selectedCategoryNames);
  564. console.log('分类数据类型:', typeof this.form.sort);
  565. console.log('分类数据是否为数组:', Array.isArray(this.form.sort));
  566. if (typeof this.form.sort === 'string') {
  567. console.log('字符串格式的分类数据:', this.form.sort);
  568. }
  569. console.log('======================');
  570. },
  571. getfuleix(){
  572. getfwleixing().then(res=>{
  573. console.log('获取服务类型',res);
  574. this.fwlxlist = res.rows;
  575. })
  576. },
  577. getNightMarketList(){
  578. getNightMarketlist().then(res=>{
  579. console.log('获取夜市列表',res);
  580. this.nightMarketList = res.data || [];
  581. })
  582. },
  583. //翻页
  584. handleSizeChange(val) {
  585. // console.log(`每页 ${val} 条`);
  586. this.queryParams.size = val;
  587. this.getpinguilist();
  588. },
  589. handleCurrentChange(val) {
  590. // console.log(`当前页: ${val}`);
  591. this.queryParams.page = val;
  592. this.getpinguilist();
  593. },
  594. handleAvatarlogo(res, file) {
  595. // this.upimg = URL.createObjectURL(file.raw);
  596. this.form.logo = file.response.data;
  597. // console.log('上传图片',file.response);
  598. },
  599. handleAvatarSuccess(res, file) {
  600. // this.upimg = URL.createObjectURL(file.raw);
  601. this.form.image = file.response.data;
  602. // console.log('上传图片',file.response);
  603. },
  604. beforeAvatarUpload(file) {
  605. const isJPG = file.type === 'image/jpeg';
  606. const isLt2M = file.size / 1024 / 1024 < 2;
  607. if (!isJPG) {
  608. this.$message.error(this.$t('mendian.ItcanonlyJPG'));
  609. }
  610. if (!isLt2M) {
  611. this.$message.error(this.$t('mendian.Cannotexceed'));
  612. }
  613. return isJPG && isLt2M;
  614. },
  615. addBusinessHour() {
  616. this.form.businessHours.push({ startTime: '', endTime: '' });
  617. },
  618. removeBusinessHour(idx) {
  619. this.form.businessHours.splice(idx, 1);
  620. },
  621. }
  622. }
  623. </script>
  624. <style>
  625. .avatar-uploader .el-upload {
  626. border: 1px dashed #d9d9d9;
  627. border-radius: 6px;
  628. cursor: pointer;
  629. position: relative;
  630. overflow: hidden;
  631. }
  632. .avatar-uploader .el-upload:hover {
  633. border-color: #409EFF;
  634. }
  635. .avatar-uploader-icon {
  636. font-size: 28px;
  637. color: #8c939d;
  638. width: 100px;
  639. height: 100px;
  640. line-height: 100px;
  641. text-align: center;
  642. }
  643. .avatar {
  644. width: 100px;
  645. height: 100px;
  646. display: block;
  647. }
  648. </style>