storeInfoDetail.vue 22 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624
  1. <template>
  2. <view class="container">
  3. <view style="height:25rpx;"></view>
  4. <form @submit="onSubmit">
  5. <view class="header flex flex-y-center arr-r">
  6. <view class="" @click="ChooseImage">
  7. <image class="logo-img" :src="info.thumb?URL+''+info.thumb:'../../static/images/avatar_def.png'">
  8. </image>
  9. <!-- <image src="../static/images/avatar_def.png" mode="aspectFill" class="logo-img"></image> -->
  10. </view>
  11. <view class="name">
  12. <input type="text" name="title" :value="info.title" placeholder="请输入联系电话" />
  13. </view>
  14. </view>
  15. <view class="page-block">
  16. <view class="page-title-block">
  17. <view class="title">门店信息</view>
  18. </view>
  19. <view class="content">
  20. <view class="cell flex flex-y-center">
  21. <view class="title-block">
  22. <text>联系电话</text>
  23. </view>
  24. <view class="desc">
  25. <input type="text" name="tel" :value="info.tel" placeholder="请输入联系电话" />
  26. </view>
  27. </view>
  28. <view class="cell flex flex-y-center box-pack-between" @click="open" data-type="1">
  29. <view class="title-block">
  30. <text>省市</text>
  31. </view>
  32. <view class="desc flex-grow-0" style="flex-grow: 0;">
  33. {{address.Prov_title}}{{address.City_title}}{{address.Dist_title}}
  34. <text class="iconfont icongengduo"></text>
  35. </view>
  36. </view>
  37. <view class="cell flex flex-y-center" data-type="1">
  38. <view class="title-block">
  39. <text>门店地址</text>
  40. </view>
  41. <view class="desc">
  42. <input type="text" name="address" :value="addr_input" placeholder="请输入门店地址"
  43. @input="onInputAddr" />
  44. </view>
  45. <view class="positon-btn flex-center" @click="chooseAddr">
  46. <image src="../../static/images/map.png" mode="aspectFit" class="icon-map"></image>定位
  47. </view>
  48. </view>
  49. <view class="cell flex flex-y-center">
  50. <view class="title-block">
  51. <text>门店公告</text>
  52. </view>
  53. <view class="desc">
  54. <input type="text" name="announcement" :value="info.announcement" placeholder="请输入门店公告" />
  55. </view>
  56. </view>
  57. <view class="cell flex flex-y-center">
  58. <view class="title-block">
  59. <text>支付方式</text>
  60. </view>
  61. <view class=" flex-center">
  62. <view class="checklist-box " @click="choicepay(index)" v-for="(item,index) of pay_list"
  63. :key='index' :class="is_pay==index?'actt':''">
  64. <view class="radio__inner" :class="is_pay==index?'act_border':''">
  65. <view :class="is_pay==index?'is-default-checked':''"
  66. class="radio__inner-icon radio__inner-icon ">
  67. </view>
  68. </view>
  69. <text class="checklist-text">{{item}}</text>
  70. </view>
  71. </view>
  72. </view>
  73. <view class="cell flex flex-y-center">
  74. <view class="title-block">
  75. <text>经营类目</text>
  76. </view>
  77. <view class="desc">
  78. <view class="input-box">{{info.shop_category}} <text style="color: red;">(类目不可更改)</text>
  79. </view>
  80. </view>
  81. </view>
  82. <view class="cell flex flex-y-center">
  83. <view class="title-block">
  84. <text>是否开启会员</text>
  85. </view>
  86. <view class="desc flex-center ">
  87. <view class="checklist-box " @click="choicemenber(index)"
  88. v-for="(item,index) of menber_list" :key='index' :class="is_menber==index?'actt':''">
  89. <view class="radio__inner" :class="is_menber==index?'act_border':''">
  90. <view :class="is_menber==index?'is-default-checked':''"
  91. class="radio__inner-icon radio__inner-icon ">
  92. </view>
  93. </view>
  94. <text class="checklist-text">{{item}}</text>
  95. </view>
  96. </view>
  97. </view>
  98. <view class="cell flex flex-y-center">
  99. <view class="title-block">
  100. <text>是否开启堂食</text>
  101. </view>
  102. <view class="desc flex-center">
  103. <view class="checklist-box " @click="choiceTang(index)" v-for="(item,index) of tangshi_list"
  104. :key='index' :class="is_hall==index?'actt':''">
  105. <view class="radio__inner" :class="is_hall==index?'act_border':''">
  106. <view :class="is_hall==index?'is-default-checked':''"
  107. class="radio__inner-icon radio__inner-icon ">
  108. </view>
  109. </view>
  110. <text class="checklist-text">{{item}}</text>
  111. </view>
  112. </view>
  113. </view>
  114. <view class="cell flex flex-y-center">
  115. <view class="title-block">
  116. <text>是否开启外卖</text>
  117. </view>
  118. <view class="desc flex-center">
  119. <view class="checklist-box " @click="choicewai(index)" v-for="(item,index) of wai_list"
  120. :key='index' :class="is_wai==index?'actt':''">
  121. <view class="radio__inner" :class="is_wai==index?'act_border':''">
  122. <view :class="is_wai==index?'is-default-checked':''"
  123. class="radio__inner-icon radio__inner-icon ">
  124. </view>
  125. </view>
  126. <text class="checklist-text">{{item}}</text>
  127. </view>
  128. </view>
  129. </view>
  130. <view class="cell flex flex-y-center">
  131. <view class="title-block">
  132. <text>是否开启到店自提</text>
  133. </view>
  134. <view class="desc flex-center">
  135. <view class="checklist-box " @click="choicezt(index)" v-for="(item,index) of zt_list"
  136. :key='index' :class="is_zt==index?'actt':''">
  137. <view class="radio__inner" :class="is_zt==index?'act_border':''">
  138. <view :class="is_zt==index?'is-default-checked':''"
  139. class="radio__inner-icon radio__inner-icon ">
  140. </view>
  141. </view>
  142. <text class="checklist-text">{{item}}</text>
  143. </view>
  144. </view>
  145. </view>
  146. <view class="flex home-qrcode">
  147. <view class="title-block">
  148. 码管理
  149. </view>
  150. <view class="">
  151. <image :src="URL+info.skm" @click="previewImage"></image>
  152. <text>收款码</text>
  153. </view>
  154. <view class="">
  155. <image :src="URL+info.line_qrcode" @click="previewImage"></image>
  156. <text>排队取号</text>
  157. </view>
  158. </view>
  159. </view>
  160. </view>
  161. <view style="height:30rpx;"></view>
  162. <view class="footer-bar">
  163. <view class="content flex flex-center" style="background: none;position: relative;">
  164. <button class="btn" hover-class="none" form-type="submit">
  165. 立即提交
  166. </button>
  167. </view>
  168. </view>
  169. </form>
  170. <zx-uni-popup ref="uniScroll" type="bottom">
  171. <uni-scroll :Prov_arr="Prov_arr" @select="select"></uni-scroll>
  172. </zx-uni-popup>
  173. </view>
  174. </template>
  175. <script>
  176. import zxUniPopup from '@/components/zx-uni-popup/uni-popup.vue'
  177. import uniScroll from '@/components/uni-scroll/uni-scroll.vue'
  178. export default {
  179. components: {
  180. zxUniPopup,
  181. uniScroll,
  182. },
  183. data() {
  184. return {
  185. URL: getApp().globalData.URL,
  186. info: {},
  187. pay_list: [
  188. '餐前付款',
  189. '餐后付款'
  190. ],
  191. is_pay: 0,
  192. menber_list: [
  193. '否', '是'
  194. ],
  195. is_menber: 0,
  196. tangshi_list: [
  197. '否', '是'
  198. ],
  199. is_hall: 0,
  200. wai_list: [
  201. '否', '是'
  202. ],
  203. is_wai: 0,
  204. zt_list: [
  205. '否', '是'
  206. ],
  207. is_zt: 0,
  208. Prov_arr: [],
  209. address: {
  210. Prov_title: "",
  211. City_title: "",
  212. Dist_title: ""
  213. },
  214. imgid: "",
  215. store_id: "",
  216. addr_input: '', //用户输入地址
  217. lat: '',
  218. lng: ''
  219. }
  220. },
  221. onLoad() {
  222. this.storeinfo();
  223. this.Prov();
  224. this.store_id = uni.getStorageSync("store_id");
  225. },
  226. methods: {
  227. onInputAddr(e) {
  228. this.addr_input = e.detail.value
  229. },
  230. chooseAddr() {
  231. let params = {
  232. province: '',
  233. city: '',
  234. county: '',
  235. address: '',
  236. }
  237. let flag = true
  238. if (this.address.Prov_code) {
  239. params.province = this.address.Prov_code
  240. params.city = this.address.City_code
  241. params.county = this.address.Dist_code
  242. flag = true
  243. }
  244. if (this.addr_input) {
  245. params.address = this.addr_input
  246. flag = true
  247. }
  248. if (flag) {
  249. this.request({
  250. url: 'Smdcshop/getLocation',
  251. data: params
  252. }).then(res => {
  253. if (res && res.code == 200) {
  254. this.chooseLocation(res.data.lat, res.data.lng)
  255. } else {
  256. this.chooseLocation()
  257. }
  258. }).catch(e => {
  259. this.chooseLocation()
  260. })
  261. } else {
  262. this.chooseLocation()
  263. }
  264. },
  265. chooseLocation(lat = '', lng = '') {
  266. uni.chooseLocation({
  267. latitude: lat,
  268. longitude: lng,
  269. success: res => {
  270. this.lat = res.latitude
  271. this.lng = res.longitude
  272. if (this.addr_input === '') {
  273. this.addr_input = res.address
  274. }
  275. },
  276. complete: r => {
  277. }
  278. });
  279. },
  280. previewImage() {
  281. let url = this.URL + this.info.line_qrcode;
  282. uni.previewImage({
  283. current: 1,
  284. urls: [url],
  285. longPressActions: {
  286. itemList: ['保存图片'],
  287. success: function(data) {
  288. console.log('选中了第' + (data.tapIndex + 1) + '个按钮,第' + (data.index + 1) + '张图片');
  289. },
  290. fail: function(err) {
  291. console.log(err.errMsg);
  292. }
  293. }
  294. });
  295. },
  296. open(e) {
  297. this.$refs.uniScroll.open();
  298. },
  299. select(e) {
  300. console.log(e)
  301. this.address = e;
  302. },
  303. Prov(e) {
  304. this.request({
  305. url: "Smdcshop/citys",
  306. data: {},
  307. }).then(res => {
  308. console.log(res, "res")
  309. if (res.code === '200') {
  310. this.Prov_arr = res.data;
  311. }
  312. });
  313. },
  314. ChooseImage(e) {
  315. let type = e.currentTarget.dataset.type;
  316. uni.chooseImage({
  317. count: 1, //默认9
  318. sizeType: ['original', 'compressed'], //可以指定是原图还是压缩图,默认二者都有
  319. sourceType: ['album'], //从相册选择
  320. success: (res) => {
  321. console.log(res)
  322. // var tempFilesSize = res.tempFiles[0].size;//获取图片的大小,单位B
  323. res.tempFilePaths.forEach((v, i) => {
  324. // console.log(v)
  325. this.Upload({
  326. url: "Smdcshop/upload",
  327. data: {
  328. url: v,
  329. type: "",
  330. token: "",
  331. admin_id: uni.getStorageSync("admin_id")
  332. }
  333. }).then(res => {
  334. console.log(res, "res")
  335. this.imgid = res.id;
  336. this.info.thumb = res.src;
  337. }).catch(err => {
  338. uni.showToast({
  339. title: err.message,
  340. icon: 'none'
  341. })
  342. });
  343. })
  344. },
  345. });
  346. },
  347. storeinfo() {
  348. this.request({
  349. url: 'Smdcshop/storeinfo',
  350. data: {
  351. store_id: uni.getStorageSync("store_id")
  352. }
  353. }).then(res => {
  354. console.log(res)
  355. if (res.code == 200) {
  356. this.info = res.data
  357. this.address = {
  358. Prov_code: res.data.province_code,
  359. Prov_title: res.data.province_name,
  360. City_code: res.data.city_code,
  361. City_title: res.data.city_name,
  362. Dist_code: res.data.district_code,
  363. Dist_title: res.data.district_name
  364. }
  365. this.addr_input = res.data.address || ''
  366. this.lat = res.data.lat
  367. this.lng = res.data.lng
  368. this.is_pay = Number(res.data.pay_type) - 1;
  369. this.is_menber = res.data.is_vip;
  370. this.is_hall = res.data.is_hall;
  371. this.is_wai = res.data.is_waimai;
  372. this.is_zt = res.data.is_ziti;
  373. }
  374. })
  375. },
  376. choicepay(index) {
  377. this.is_pay = index;
  378. },
  379. choicemenber(index) {
  380. this.is_menber = index;
  381. },
  382. choiceTang(index) {
  383. this.is_hall = index;
  384. },
  385. choicewai(index) {
  386. this.is_wai = index;
  387. },
  388. choicezt(index) {
  389. this.is_zt = index;
  390. },
  391. onSubmit(e) {
  392. let params = {
  393. store_id: this.store_id,
  394. province_code: this.address.Prov_code,
  395. city_code: this.address.City_code,
  396. district_code: this.address.Dist_code,
  397. pay_type: Number(this.is_pay) + 1,
  398. is_vip: this.is_menber,
  399. is_waimai: this.is_wai,
  400. is_hall: this.is_hall,
  401. is_ziti: this.is_zt,
  402. num: 1,
  403. id: this.info.id,
  404. thumb: this.imgid,
  405. lat: this.lat,
  406. lng: this.lng
  407. },
  408. url;
  409. url = 'Smdcshop/store_update'
  410. var data = Object.assign(params, e.detail.value);
  411. if (params.name == "") {
  412. uni.showToast({
  413. title: "请输入名称",
  414. icon: 'none'
  415. })
  416. return false
  417. }
  418. this.request({
  419. url,
  420. data: params
  421. }).then(res => {
  422. if (res.code == 200) {
  423. uni.showToast({
  424. title: res.message,
  425. icon: 'none'
  426. })
  427. setTimeout(() => {
  428. uni.navigateBack()
  429. }, 2000)
  430. }
  431. }).catch((res) => {
  432. uni.showToast({
  433. title: res.message,
  434. icon: 'none'
  435. })
  436. });
  437. },
  438. }
  439. }
  440. </script>
  441. <style>
  442. @import url("../static/css/common.css");
  443. .home-qrcode {
  444. text-align: center;
  445. font-size: 28rpx;
  446. padding: 20rpx 0;
  447. }
  448. .home-qrcode .title-block {
  449. font-size: 30rpx;
  450. color: #333;
  451. font-weight: 600;
  452. padding-right: 20rpx;
  453. }
  454. .home-qrcode image {
  455. width: 250rpx;
  456. height: 250rpx;
  457. display: block;
  458. }
  459. page {
  460. background-color: #F4F5F7;
  461. }
  462. page .act_border {
  463. border: 1rpx solid #007AFF;
  464. }
  465. .header {
  466. height: 148rpx;
  467. padding: 0 25rpx;
  468. background-color: #fff;
  469. }
  470. .header .logo-img {
  471. display: block;
  472. width: 100rpx;
  473. height: 100rpx;
  474. border-radius: 8rpx;
  475. margin-right: 24rpx;
  476. }
  477. .checklist-box {
  478. display: -webkit-box;
  479. display: -webkit-flex;
  480. display: flex;
  481. -webkit-box-orient: horizontal;
  482. -webkit-box-direction: normal;
  483. -webkit-flex-direction: row;
  484. flex-direction: row;
  485. -webkit-box-align: center;
  486. -webkit-align-items: center;
  487. align-items: center;
  488. margin: 5px 0;
  489. margin-right: 22px;
  490. }
  491. .radio__inner {
  492. -webkit-flex-shrink: 0;
  493. flex-shrink: 0;
  494. display: -webkit-box;
  495. display: -webkit-flex;
  496. display: flex;
  497. -webkit-box-pack: center;
  498. -webkit-justify-content: center;
  499. justify-content: center;
  500. -webkit-box-align: center;
  501. -webkit-align-items: center;
  502. align-items: center;
  503. position: relative;
  504. border: 1px solid #DCDFE6;
  505. border-radius: 2px;
  506. box-sizing: border-box;
  507. width: 16px;
  508. height: 16px;
  509. border-radius: 16px;
  510. background-color: #fff;
  511. z-index: 1;
  512. -webkit-transition: border-color .3s;
  513. transition: border-color .3s;
  514. }
  515. .radio__inner-icon {
  516. width: 8px;
  517. height: 8px;
  518. border-radius: 10px;
  519. opacity: 0;
  520. -webkit-transition: -webkit-transform .3s;
  521. transition: -webkit-transform .3s;
  522. transition: transform .3s;
  523. transition: transform .3s, -webkit-transform .3s;
  524. }
  525. .is-default-checked {
  526. opacity: 1;
  527. background-color: #007aff;
  528. -webkit-transform: rotate(45deg) scaleY(1);
  529. transform: rotate(45deg) scaleY(1);
  530. }
  531. .checklist-text {
  532. font-size: 28rpx;
  533. margin-left: 5px;
  534. -webkit-transition: color 0.2s;
  535. transition: color 0.2s;
  536. color: #000;
  537. }
  538. .positon-btn {
  539. font-size: 26rpx;
  540. color: #007aff;
  541. }
  542. .positon-btn .icon-map {
  543. display: block;
  544. width: 30rpx;
  545. height: 30rpx;
  546. }
  547. </style>