addmendian.vue 25 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978
  1. <template>
  2. <view class="contentV">
  3. <customNav :shownav="true" :deleteBt="edeatState" :title="$t('index.mendianguanli')" titledetl="" v-on:Enavbarsel="navbarsel"></customNav>
  4. <view v-if="auditStatus!=1" class="yzmctV">
  5. <text style="font-size: 30rpx;color:green;margin-left: 4%;width: 92%;">{{noteStatus}}</text>
  6. </view>
  7. <view class="yzmctV">
  8. <text class="yzmbt">{{$t('mend.mendianmc')}}:</text>
  9. <input class="noinputV" type="text" :placeholder="$t('mend.qingshurdm')" :value="posName" @input="inpuact1">
  10. </view>
  11. <!-- <view class="yzmctV">
  12. <text class="yzmbt">{{$t('mend.fuzheren')}}:</text>
  13. <input class="noinputV" type="text" :placeholder="$t('mend.fuzheren')" :value="fuzheren" @input="fuzherenip">
  14. </view> -->
  15. <view class="yzmctV">
  16. <text class="yzmbt">{{$t('mend.kefudianhua')}}:</text>
  17. <input class="noinputV" type="number" :placeholder="$t('mend.qingshurkfdh')" :value="telephone" @input="phoneinput">
  18. </view>
  19. <view class="yzmctV">
  20. <text class="yzmbt">{{$t('mend.xukezhenghao')}}:</text>
  21. <input class="noinputV" type="text" :value="xukezheng" :placeholder="$t('mend.jingyingxkzh')" @input="inpuact3">
  22. </view>
  23. <view class="contentInRowL" style="margin-left: 8%;margin-top: 40rpx;align-items: center;">
  24. <text class="yzmbt" style="width: 50%;">{{$t('mend.yingyeshijan')}}:</text>
  25. </view>
  26. <view class="contentInRowL" style="margin-left: 8%;margin-top: 10rpx;align-items: center;">
  27. <view class="contentColumn">
  28. <view class="contentInRowL" v-for="(Ytime,index) in yingyeTime">
  29. <view class="timetext" style="color: green;">{{Ytime.startTime}}</view>
  30. <text> — </text>
  31. <view class="timetext" style="color: crimson;">{{Ytime.endTime}}</view>
  32. <image style="width: 54rpx;height: 54rpx; margin-left:40rpx;" src="/static/images/jian@3x.png" mode="scaleToFill" @click="delyysj(index)"></image>
  33. </view>
  34. <view class="contentInRowL" >
  35. <picker mode="multiSelector" :value="timeB" :range="array" @change="TimeChangeB">
  36. <view class="timetext" style="color: green;">{{timeB!=''?timeB:$t('mend.kaishisj')}}</view>
  37. </picker>
  38. <text> — </text>
  39. <picker mode="multiSelector" :value="timeN" :range="array" @change="TimeChangeN">
  40. <view class="timetext" style="color: crimson;">{{timeN!=''?timeN:$t('mend.jieshusj')}}</view>
  41. </picker>
  42. <image style="width: 50rpx;height: 50rpx;padding-left: 40rpx;" src="/static/images/plus-circle-fill@3x.png" mode="scaleToFill" @click="addyysj"></image>
  43. </view>
  44. </view>
  45. </view>
  46. <view class="contentInRowL" style="margin-left: 8%;margin-top: 40rpx;">
  47. <text class="yzmbt">{{$t('mend.hangyeleix')}}:</text>
  48. <radio-group @change="radioChange">
  49. <radio value="0" :checked="type==0"/>
  50. {{$t('mend.canyin')}}
  51. <radio value="1" :checked="type==1" />
  52. {{$t('mend.shangchao')}}
  53. </radio-group>
  54. </view>
  55. <view class="yzmctV">
  56. <text class="yzmbt">{{$t('mend.mendianleix')}}:</text>
  57. <view class="xialakuang">
  58. <uni-data-select class="" v-model="fltype" :placeholder="$t('mend.qingxuanze')" :localdata="range" @change="selectchange" ></uni-data-select>
  59. </view>
  60. </view>
  61. <view v-if="fwrange.length>0" class="skuViewCt">
  62. <text class="fwyzmbt">{{$t('mend.fuwuleix')}}:</text>
  63. <view class="contensbgg">
  64. <checkbox-group v-for="(itemc,index) in fwrange" >
  65. <text @click="selectfwtye(index)"><checkbox :value="itemc.value" :checked="itemc.state==1?true:false" />{{itemc.text}}</text>
  66. </checkbox-group>
  67. </view>
  68. </view>
  69. <view class="contentColumn" style="margin-top: 40rpx;width: 82%;margin-left: 9%;">
  70. <text class="yzmbt">{{$t('mend.mendianweiz')}}:</text>
  71. <view class="contentInRowS" style="width: 100%;">
  72. <textarea class="textinput" auto-height="true"
  73. :disabled="addrinputact"
  74. :always-embed='false'
  75. :adjust-position='true'
  76. :value="address"
  77. cursor-spacing='30'
  78. confirm-hold='true'
  79. :focus='false'
  80. maxlength='300'
  81. @input='inpuact6'
  82. ></textarea>
  83. <!-- <input class="addrinputV" :disabled="addrinputact" type="text" :value="address" @input="inpuact6"> -->
  84. <uni-icons custom-prefix="custom-icon" color="#006AFF" type="location-filled" size="36" @click="selctAddr"></uni-icons>
  85. </view>
  86. </view>
  87. <view class="yzmctV">
  88. <text class="yzmbt">{{$t('mend.qisongjine')}}:</text>
  89. <input class="noinputV" type="number" :value="posPrice" :placeholder="$t('mend.qingsrwszd')" @input="inpuact2">
  90. </view>
  91. <view class="contentInRowL">
  92. <text style="font-size: 28rpx;text-align: left;margin-left: 8%;margin-top: 40rpx;">{{$t('mend.logo')}}:</text>
  93. </view>
  94. <view class="yzmctV" @click="logoimge">
  95. <netImage width="190" height="190" bradius="4" :mysrc="lgImage" mymode="scaleToFill"></netImage>
  96. </view>
  97. <view class="contentInRowL">
  98. <text style="font-size: 28rpx;text-align: left;margin-left: 8%;margin-top: 40rpx;">{{$t('mend.mendiantp')}}:</text>
  99. </view>
  100. <view class="yzmctV" @click="mdselectImage">
  101. <netImage width="610" height="340" bradius="4" :mysrc="spImage" mymode="scaleToFill"></netImage>
  102. </view>
  103. <view class="contentInRowL">
  104. <text style="font-size: 28rpx;text-align: left;margin-left: 8%;margin-top: 40rpx;">{{$t('mend.jingyingzhtp')}}:</text>
  105. </view>
  106. <view class="yzmctV" @click="zhengjianImage(0)">
  107. <netImage width="610" height="610" bradius="4" :mysrc="Image0" mymode="scaleToFill"></netImage>
  108. </view>
  109. <view class="contentInRowL">
  110. <text style="font-size: 28rpx;text-align: left;margin-left: 8%;margin-top: 40rpx;">{{$t('mend.weituosq')}}:</text>
  111. </view>
  112. <view class="yzmctV" @click="zhengjianImage(1)">
  113. <netImage width="610" height="610" bradius="4" :mysrc="Image1" mymode="scaleToFill"></netImage>
  114. </view>
  115. <view class="contentInRowL">
  116. <text style="font-size: 28rpx;text-align: left;margin-left: 8%;margin-top: 40rpx;">{{$t('mend.shipinanquan')}}:</text>
  117. </view>
  118. <view class="yzmctV" @click="zhengjianImage(2)">
  119. <netImage width="610" height="610" bradius="4" :mysrc="Image2" mymode="scaleToFill"></netImage>
  120. </view>
  121. <view class="contentInRowL">
  122. <text style="font-size: 28rpx;text-align: left;margin-left: 8%;margin-top: 40rpx;">{{$t('mend.caidantup')}}:</text>
  123. </view>
  124. <view class="yzmctV" @click="zhengjianImage(3)">
  125. <netImage width="610" height="610" bradius="4" :mysrc="Image3" mymode="scaleToFill"></netImage>
  126. </view>
  127. <view class="yzmctV">
  128. <text style="font-size: 30rpx;color: darkgray;">{{$t('mend.yishangbitian')}}</text>
  129. </view>
  130. <view class="yzmctV" style="margin-bottom: 40rpx;">
  131. <text class="querenBt" @click="tijiao">{{$t('index.tijiao')}}</text>
  132. </view>
  133. <yhdslCropper ref="yhdslCropper" :quality="1" mode="scale" @uploadImg="uploadImg" :scale="scale"></yhdslCropper>
  134. </view>
  135. </template>
  136. <script>
  137. import api from "@/pages/api/api.js"
  138. import ApibaseUrl from "@/config/urlConfig.js"
  139. import yhdslCropper from '@/components/yhdsl-cropper/yhdsl-cropper.vue';
  140. export default {
  141. components: {
  142. yhdslCropper
  143. },
  144. data() {
  145. return {
  146. value:0,
  147. id:-1,
  148. range: [],
  149. fwrange: [],
  150. selectindex:['0','0','0','0'],
  151. mendianMs:[],
  152. latitude:0,
  153. longitude:0,
  154. area: "",
  155. address: this.$t('mend.qingxzdz'),
  156. addrNamedetl:this.$t('mend.qingxzdz'),
  157. posName: "",
  158. fuzheren:'',
  159. telephone:'',
  160. image: "",
  161. posPrice:0,
  162. xukezheng:'',
  163. yingyesj:'',
  164. fltype:0,
  165. type:0,
  166. userInfo:{},
  167. fenleiLst:{},
  168. fuwuList:{},
  169. spImage:'',
  170. lgImage:'',
  171. baseUrl:this.$baseImagurl,
  172. scale:1.8,
  173. edeatState:0,
  174. addrinputact:true,
  175. auditStatus:0,
  176. noteStatus:'',
  177. annexList:['','','',''],
  178. imgeState:0,
  179. array:[],
  180. yingyeTime:[],
  181. timeB:'',
  182. timeN:'',
  183. Image0:'',
  184. Image1:'',
  185. Image2:'',
  186. Image3:'',
  187. }
  188. },
  189. onLoad(option) {
  190. this.id=option.id;
  191. this.getfwlxlist();
  192. this.array=[
  193. ['00','01','02','03','04','05','06','07','08','09','10','11','12','13','14','15','16','17','18','19','20','21','22','23'],
  194. ['00','01','02','03','04','05','06','07','08','09','10','11','12','13','14','15','16','17','18','19','20','21','22','23','24','25','26','27','28','29','30','31','32','33','34','35','36','37','38','39','40','41','42','43','44','45','46','47','48','49','50','51','52','53','54','55','56','57','58','59']
  195. ];
  196. },
  197. onShow() {
  198. this.gettempLocate();
  199. var data = uni.getStorageSync('userInfo');
  200. this.userInfo = JSON.parse(data);
  201. this.auditStatus=this.userInfo.auditStatus;
  202. if(this.userInfo.auditStatus==0){//未审核
  203. this.noteStatus=this.$t('user.zhhwsh');
  204. }
  205. else if(this.userInfo.auditStatus!=1){
  206. this.noteStatus=this.$t('user.zhhyc');
  207. }
  208. this.getmendianfenlei();
  209. },
  210. methods: {
  211. radioChange(e){
  212. console.log(e.detail.value)
  213. this.type=e.detail.value;
  214. },
  215. inpuact1(v){
  216. this.posName = v.target.value;
  217. },
  218. inpuact2(v){v
  219. this.posPrice = v.target.value;
  220. },
  221. inpuact3(v){v
  222. this.xukezheng = v.target.value;
  223. },
  224. inpuact4(v){
  225. this.yingyesj = v.target.value;
  226. },
  227. inpuact6(v){
  228. this.address = v.target.value;
  229. },
  230. fuzherenip(v){
  231. this.fuzheren = v.target.value;
  232. },
  233. phoneinput(v){
  234. this.telephone = v.target.value;
  235. },
  236. delyysj(i){
  237. if(this.yingyeTime.length>i){
  238. this.delYingyeshijian(this.yingyeTime[i].id);
  239. // var tempList = this.yingyeTime;
  240. // tempList.splice(i,1);
  241. // this.yingyeTime=tempList;
  242. }
  243. },
  244. addyysj(){
  245. if(this.timeN!=''&&this.timeB!=''){
  246. var lastT={
  247. startTime:this.timeB,
  248. endTime:this.timeN
  249. }
  250. this.addYingyeshijian(lastT);
  251. this.yingyeTime.push(lastT);
  252. this.timeB='';
  253. this.timeN='';
  254. console.log(JSON.stringify(this.yingyeTime));
  255. }
  256. else{
  257. }
  258. },
  259. TimeChangeB: function(e) {
  260. console.log(e)
  261. var v = e.detail.value;
  262. var timeB = this.array[0][v[0]] +':'+this.array[1][v[1]];
  263. this.timeB=timeB;
  264. },
  265. TimeChangeN: function(e) {
  266. console.log(e.detail.value)
  267. var v = e.detail.value;
  268. var timeN =this.array[0][v[0]] +':'+this.array[1][v[1]];
  269. this.timeN=timeN;
  270. },
  271. gettempLocate(){
  272. var that =this;
  273. try {//读取
  274. var data = uni.getStorageSync("tempLocation");
  275. console.log(data);
  276. if(''==data || undefined==data || null==data){
  277. return;
  278. }
  279. else{
  280. this.latitude=data.latitude;
  281. this.longitude=data.longitude;
  282. if(data.name&&data.name.length>2){
  283. this.address=data.name;
  284. }
  285. else{
  286. this.address=data.address;
  287. }
  288. this.addrinputact=false;
  289. uni.setStorageSync('tempLocation',"");
  290. return;
  291. }
  292. } catch(e){//错误
  293. return;
  294. }
  295. },
  296. intfofwrange(selectindex){
  297. for(var i=0;i<this.fuwuList.length;i++){
  298. for(var j=0;j<selectindex.length;j++){
  299. if(this.fuwuList[i].value == selectindex[j] ){
  300. this.fuwuList[i].state = 1;
  301. }
  302. }
  303. }
  304. this.fwrange= this.fuwuList;
  305. },
  306. selectchange(e){
  307. console.log(e);
  308. this.fltype=e;
  309. },
  310. selectfwtye(index){
  311. console.log(index)
  312. if(this.fwrange[index].state==0){
  313. this.fwrange[index].state=1;
  314. }
  315. else{
  316. this.fwrange[index].state=0
  317. }
  318. var select = [];
  319. for(var i=0;i<this.fwrange.length;i++){
  320. if(this.fwrange[i].state == 1){
  321. select.push(this.fwrange[i].value)
  322. }
  323. }
  324. this.selectindex = select;
  325. },
  326. selctAddr(){
  327. // uni.navigateTo({
  328. // //url:'/pages/UserCenter/map/mapN',
  329. // url:'/pages/UserCenter/map/map?state=0'
  330. // })
  331. uni.navigateTo({
  332. url:'/pages/UserCenter/map/Chazhaodizhi'
  333. })
  334. },
  335. tijiao(){
  336. if(this.auditStatus!=1){
  337. uni.showToast({
  338. title:this.noteStatus,
  339. icon:"none"
  340. })
  341. return;
  342. }
  343. else{
  344. this.addmendian();
  345. }
  346. },
  347. logoimge(){
  348. console.log('logoimge');
  349. this.imgeState=-1;
  350. this.scale=1;
  351. this.$refs.yhdslCropper.chooseImage();
  352. },
  353. mdselectImage(){
  354. console.log('selectImage');
  355. this.imgeState=-1;
  356. this.scale=1.8;
  357. this.$refs.yhdslCropper.chooseImage();
  358. },
  359. zhengjianImage(index){
  360. this.imgeState=index;
  361. this.selectImage();
  362. },
  363. selectImage(){
  364. var that = this;
  365. var ulUrl = ApibaseUrl.getUploadUrl();
  366. uni.chooseImage({
  367. count: 1, // 图片数量
  368. sizeType: ['compressed'], //可以指定是原图还是压缩图,默认二者都有
  369. sourceType: ['album'], //从相册选择或者拍照
  370. success: (res) => {
  371. const tempFilePaths = res.tempFilePaths;
  372. uni.showLoading({
  373. mask:true
  374. })
  375. uni.uploadFile({
  376. url:ulUrl, //上传图片api
  377. filePath: tempFilePaths[0],
  378. name: 'file',
  379. header:{
  380. //"Authorization": userinfo.token
  381. },
  382. success: (res) => {
  383. uni.hideLoading();
  384. let group = JSON.parse(res.data);
  385. this.annexList[this.imgeState]=group.data;
  386. this.Image0=this.annexList[0];
  387. this.Image1=this.annexList[1];
  388. this.Image2=this.annexList[2];
  389. this.Image3=this.annexList[3];
  390. },
  391. fail() {
  392. uni.hideLoading();
  393. }
  394. });
  395. }
  396. });
  397. },
  398. uploadImg(e) {
  399. console.log(this.scale)
  400. uni.showLoading({
  401. mask:true
  402. });
  403. var that = this;
  404. var ulUrl = ApibaseUrl.getUploadUrl();
  405. uni.uploadFile({
  406. url:ulUrl, //上传图片api
  407. filePath: e,
  408. name: 'file',
  409. header:{
  410. //"Authorization": userinfo.token
  411. },
  412. success: (res) => {
  413. uni.hideLoading();
  414. console.log(res)
  415. let group = JSON.parse(res.data);
  416. if(that.scale==1){
  417. that.lgImage = group.data;
  418. }
  419. else{
  420. if(that.imgeState<0){
  421. that.spImage = group.data;
  422. }
  423. else{
  424. this.annexList[this.imgeState]=group.data;
  425. this.Image0=this.annexList[0];
  426. this.Image1=this.annexList[1];
  427. this.Image2=this.annexList[2];
  428. this.Image3=this.annexList[3];
  429. }
  430. }
  431. // console.log(that.scale,that.lgImage)
  432. uni.showToast({
  433. title:that.$t('mend.shangccg'),
  434. icon:"success"
  435. })
  436. },
  437. fail() {
  438. uni.hideLoading();
  439. }
  440. });
  441. },
  442. imagesel(src){
  443. console.log(src);
  444. uni.navigateTo({
  445. url:'/pages/UserCenter/mendian/BigimageView?mysrc='+src
  446. })
  447. },
  448. getmendianDetail(id){
  449. console.log('getmendianDetail:id',id);
  450. api('getmendianDetail',{
  451. id:id
  452. },
  453. r=>{
  454. this.mendianMs=r.data.data;
  455. console.log('----',this.mendianMs);
  456. this.posName=this.mendianMs.posName;
  457. this.telephone=this.mendianMs.telephone;
  458. this.posPrice=this.mendianMs.posPrice;
  459. this.latitude=this.mendianMs.latitude;
  460. this.longitude=this.mendianMs.longitude;
  461. if(this.latitude==''||this.latitude==0||this.latitude==undefined){
  462. this.addrinputact=true;
  463. }
  464. if(this.longitude==''||this.longitude==0||this.longitude==undefined){
  465. this.addrinputact=true;
  466. }
  467. if(this.addrinputact==true){
  468. uni.showToast({
  469. title:this.$t('mend.qxtianjiafl'),
  470. icon:"none",
  471. duration: 3000
  472. })
  473. }
  474. this.area=this.mendianMs.area;
  475. this.address=this.mendianMs.address;
  476. this.fltype=this.mendianMs.sort;
  477. this.spImage=this.mendianMs.image;
  478. this.lgImage=this.mendianMs.logo;
  479. this.xukezheng=this.mendianMs.hygienePermit;
  480. // if(this.mendianMs.windingUp){
  481. // this.timeN=this.mendianMs.windingUp;
  482. // }
  483. this.type=this.mendianMs.type;
  484. this.selectindex = JSON.parse(this.mendianMs.serverType);
  485. if(this.mendianMs.hygieneLicence){
  486. this.annexList=this.mendianMs.hygieneLicence.split(",");
  487. if(this.annexList.length!=4){
  488. this.annexList=['','','',''];
  489. }
  490. this.Image0=this.annexList[0];
  491. this.Image1=this.annexList[1];
  492. this.Image2=this.annexList[2];
  493. this.Image3=this.annexList[3];
  494. }
  495. this.intfofwrange(this.selectindex);
  496. this.getYingyeshijian(id);
  497. },failc=>{
  498. //console.log('getadvertis----',failc)
  499. });
  500. },
  501. getmendianfenlei(){
  502. var language = uni.getStorageSync('language');
  503. api('getmendianfenlei',{
  504. pageSize:40
  505. },
  506. r=>{
  507. this.fenleiLst=r.data.rows;
  508. console.log('getmendianfenlei---',this.fenleiLst)
  509. var Trange=[];
  510. for(var i=0;i<this.fenleiLst.length;i++){
  511. var name='';
  512. if(language=='zh-Hans'){
  513. name=this.fenleiLst[i].name;
  514. }
  515. else if(language=='zh-Hant'){
  516. name=this.fenleiLst[i].nameTw;
  517. }
  518. else{
  519. name=this.fenleiLst[i].nameVi;
  520. }
  521. Trange.push({value:this.fenleiLst[i].id,text:name});
  522. }
  523. this.range=Trange;
  524. if(this.id>=0){
  525. this.value=this.mendianMs.type;
  526. }
  527. },failc=>{
  528. //console.log('getadvertis----',failc)
  529. });
  530. },
  531. getfwlxlist(){
  532. var language = uni.getStorageSync('language');
  533. api('fwlxlist',{
  534. pageSize:40
  535. },
  536. r=>{
  537. var objList=r.data.rows;
  538. var Trange=[];
  539. for(var i=0;i<objList.length;i++){
  540. var name='';
  541. if(language=='yuenan'){
  542. name=objList[i].nameVi;
  543. }
  544. else if(language=='zh-Hans'){
  545. name=objList[i].nameCn;
  546. }
  547. else if(language=='zh-Hant'){
  548. name=objList[i].nameTw;
  549. }
  550. Trange.push({value:objList[i].id,text:name,state:0});
  551. }
  552. this.fuwuList=Trange;
  553. if(this.id>=0){
  554. this.edeatState=1;
  555. this.addrinputact=false;
  556. this.getmendianDetail(this.id)
  557. }
  558. },failc=>{
  559. //console.log('getadvertis----',failc)
  560. });
  561. },
  562. addmendian(){
  563. var data;
  564. if(this.id>0){
  565. data={
  566. "id":this.id,
  567. "posName": this.posName,
  568. "telephone":this.telephone,
  569. "image":this.spImage,
  570. "logo":this.lgImage,
  571. "posPrice": this.posPrice,
  572. "area":this.area,
  573. "address": this.address,
  574. "longitude": this.longitude,
  575. "latitude": this.latitude,
  576. "briefIntroduction": "",
  577. "type":this.type,
  578. "hygienePermit":this.xukezheng,
  579. "openBusiness":'',
  580. "windingUp":this.timeN,
  581. "sort":this.fltype,
  582. "serverType":JSON.stringify(this.selectindex),
  583. "userId": this.userInfo.userId,
  584. "hygieneLicence":this.annexList+''
  585. }
  586. }
  587. else{
  588. data={
  589. "posName": this.posName,
  590. "telephone":this.telephone,
  591. "image":this.spImage,
  592. "logo":this.lgImage,
  593. "posPrice": this.posPrice,
  594. "area":this.area,
  595. "address": this.address,
  596. "longitude": this.longitude,
  597. "latitude": this.latitude,
  598. "briefIntroduction": "",
  599. "type":this.type,
  600. "hygienePermit":this.xukezheng,
  601. "openBusiness":'',
  602. "windingUp":this.timeN,
  603. "sort":this.fltype,
  604. "serverType":JSON.stringify(this.selectindex),
  605. "userId": this.userInfo.userId,
  606. "hygieneLicence":this.annexList+''
  607. }
  608. }
  609. var checkdataR = this.checkdata(data);
  610. if(!checkdataR){
  611. return;
  612. }
  613. console.log('addmendian',data);
  614. var that = this;
  615. api('addmendian',data,
  616. r=>{
  617. console.log(r)
  618. if(r.data.code!=200){
  619. uni.showToast({
  620. title:that.$t('api.baochunsb'),
  621. icon:"none"
  622. })
  623. return;
  624. }
  625. if(that.id){
  626. uni.navigateBack({
  627. delta:1,//返回层数,2则上上页
  628. })
  629. }
  630. else{
  631. if(r.data.data){
  632. that.id=r.data.data.id;
  633. for(var i=0;i<that.yingyeTime.length;i++){
  634. that.addYingyeshijian(that.yingyeTime[i])
  635. }
  636. uni.navigateBack({
  637. delta:1,//返回层数,2则上上页
  638. })
  639. }
  640. }
  641. },failc=>{
  642. //console.log('getadvertis----',failc)
  643. });
  644. },
  645. checkdata(data){
  646. if(data.posName.length<1){
  647. uni.showToast({
  648. title:this.$t('mend.qingshurdm'),
  649. icon:"none"
  650. })
  651. return false;
  652. }
  653. if(data.telephone.length<1){
  654. uni.showToast({
  655. title:this.$t('mend.qingshurkfdh'),
  656. icon:"none"
  657. })
  658. return false;
  659. }
  660. if(data.hygienePermit.length<1){
  661. uni.showToast({
  662. title:this.$t('mend.jingyingxkzh'),
  663. icon:"none"
  664. })
  665. return false;
  666. }
  667. if(this.yingyeTime.length<=0){
  668. uni.showToast({
  669. title:this.$t('mend.yingyeshijan'),
  670. icon:"none"
  671. })
  672. return false;
  673. }
  674. if(data.sort.length<1){
  675. uni.showToast({
  676. title:this.$t('mend.qingxuanmendianlx'),
  677. icon:"none"
  678. })
  679. return false;
  680. }
  681. if(data.serverType.length<1){
  682. uni.showToast({
  683. title:this.$t('mend.qingxuanfuwulx'),
  684. icon:"none"
  685. })
  686. return false;
  687. }
  688. if(data.latitude==0||data.longitude==0){
  689. uni.showToast({
  690. title:this.$t('mend.qingxzdz'),
  691. icon:"none"
  692. })
  693. return false;
  694. }
  695. if(data.address.length<1){
  696. uni.showToast({
  697. title:this.$t('mend.qingxzdz'),
  698. icon:"none"
  699. })
  700. return false;
  701. }
  702. if(data.posPrice.length<1){
  703. uni.showToast({
  704. title:this.$t('mend.qingsrwszd'),
  705. icon:"none"
  706. })
  707. return false;
  708. }
  709. if(data.image.length<1){
  710. uni.showToast({
  711. title:this.$t('mend.qingtianx'),
  712. icon:"none"
  713. })
  714. return false;
  715. }
  716. return true;
  717. },
  718. navbarsel(index){
  719. if(index!=5){
  720. return;
  721. }
  722. var that = this;
  723. uni.showModal({
  724. cancelText: that.$t('order.quxiao'), // 取消按钮的文字
  725. confirmText: that.$t('comp.queren'), // 确认按钮的文字
  726. title: that.$t('api.message'),
  727. content: that.$t('index.sanchudianp'),
  728. success: function (res) {
  729. if (res.confirm) { //这里是点击了确定以后
  730. that.delemendian();
  731. } else { //这里是点击了取消以后
  732. console.log('用户点击取消')
  733. }
  734. }
  735. })
  736. },
  737. delemendian(){
  738. api('delemendian',{
  739. id:this.id
  740. },
  741. r=>{
  742. console.log(r)
  743. if(r.data.code==200){
  744. uni.showToast({
  745. title:this.$t('index.sanchuchengg'),
  746. icon:"none",
  747. duration: 2500
  748. })
  749. setTimeout(() => {
  750. uni.navigateBack({
  751. delta: 2,
  752. });
  753. }, 2500);
  754. }
  755. else{
  756. uni.showToast({
  757. title:r.data.msg,
  758. icon:"none"
  759. })
  760. }
  761. },failc=>{
  762. uni.showToast({
  763. title:failc,
  764. icon:"none"
  765. })
  766. });
  767. },
  768. //营业时间====================
  769. getYingyeshijian(mid){//查询
  770. api('getHours',{
  771. mdId:mid,
  772. },res=>{
  773. console.log('getHours',res)
  774. if(res.data.code==200){
  775. this.yingyeTime=res.data.data;
  776. }
  777. },failc=>{
  778. //console.log('getadvertis----',failc)
  779. })
  780. },
  781. addYingyeshijian(times){//添加
  782. console.log(this.id)
  783. if(!this.id){
  784. return;
  785. }
  786. api('addHours',{
  787. mdId:this.id,
  788. startTime:times.startTime, //开始时间
  789. endTime:times.endTime //结束时间
  790. },res=>{
  791. console.log('addHours',res)
  792. },failc=>{
  793. //console.log('getadvertis----',failc)
  794. })
  795. },
  796. delYingyeshijian(id){//删除
  797. api('delHours',{
  798. id:id,
  799. },res=>{
  800. console.log('delHours',res)
  801. this.getYingyeshijian(this.id);
  802. },failc=>{
  803. //console.log('getadvertis----',failc)
  804. })
  805. }
  806. }
  807. }
  808. </script>
  809. <style>
  810. .contentV{
  811. display: flex;
  812. width: 100%;
  813. justify-content: center;
  814. display: inline-block;
  815. }
  816. .yzmctV{
  817. display: flex;
  818. flex-direction: row;
  819. align-items: center;
  820. justify-content: center;
  821. margin-top: 40rpx;
  822. }
  823. .noinputV{
  824. font-size: 30rpx;
  825. margin-left: 20rpx;
  826. width: 60%;
  827. height: 60rpx;
  828. line-height: 60rpx;
  829. border-radius: 20rpx;
  830. border: 2rpx solid darkgray;
  831. }
  832. .addrinputV{
  833. font-size: 26rpx;
  834. margin-left: 20rpx;
  835. width: 54%;
  836. height: 60rpx;
  837. line-height: 60rpx;
  838. border-radius: 20rpx;
  839. border: 2rpx solid darkgray;
  840. }
  841. .addrtext{
  842. margin-left: 20rpx;
  843. font-size: 26rpx;
  844. width: 60%;
  845. text-decoration:underline;
  846. }
  847. .yzmbt{
  848. font-size: 28rpx;
  849. width: 150rpx;
  850. }
  851. .xialakuang{
  852. margin-left: 20rpx;
  853. width: 60%;
  854. height: 60rpx;
  855. line-height: 60rpx;
  856. }
  857. .imagV{
  858. width: 80%;
  859. height: 20vh;
  860. background-color: antiquewhite;
  861. }
  862. .querenBt{
  863. margin-top: 30rpx;
  864. width: 80%;
  865. height: 60rpx;
  866. line-height: 60rpx;
  867. padding: 10rpx;
  868. border-radius: 20rpx;
  869. border: solid #40AE36;
  870. border-width: 0px 0px 6rpx 0px;
  871. text-align: center;
  872. justify-content: center;
  873. background-color: #40AE36;
  874. color: white;
  875. box-shadow: 0rpx 0rpx 10rpx 0rpx #40AE36;
  876. }
  877. .skuViewCt{
  878. display: flex;
  879. flex-direction: column;
  880. justify-content:center;
  881. margin-top: 10rpx;
  882. }
  883. .fwyzmbt{
  884. margin-left: 9%;
  885. font-size: 28rpx;
  886. }
  887. .contensbgg{
  888. display: flex;
  889. flex-direction: column;
  890. justify-content:flex-start;
  891. width: 80%;
  892. margin-left: 12%;
  893. }
  894. .youhuixinxi{
  895. margin: 10rpx;
  896. padding: 4rpx;
  897. font-size: 26rpx;
  898. line-height: 54rpx;
  899. height: 54rpx;
  900. border: 2rpx solid lightgray;
  901. border-radius: 8rpx;
  902. }
  903. .xz{
  904. border: 2rpx solid brown;
  905. color: crimson;
  906. }
  907. .textinput{
  908. margin-top: 10rpx;
  909. margin-bottom: 10rpx;
  910. padding-top: 10rpx;
  911. padding-bottom: 10rpx;
  912. width: 550rpx;
  913. border-radius: 6rpx;
  914. border: 1rpx solid darkgray;
  915. }
  916. .item_list{
  917. display: flex;
  918. flex-wrap: wrap;
  919. justify-content: flex-start;
  920. }
  921. .item_content{
  922. width:180rpx;
  923. height:180rpx;
  924. margin: 10rpx;
  925. box-sizing: border-box;
  926. }
  927. .upimagV{
  928. width: 210rpx;
  929. height:210rpx;
  930. }
  931. .timetext{
  932. font-size: 30rpx;
  933. text-align: center;
  934. line-height: 60rpx;
  935. border: solid lavender;
  936. border-width: 0px 0px 1rpx 0px;
  937. }
  938. </style>