businessInfor.vue 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634
  1. <template>
  2. <view>
  3. <!-- <cu-custom bgColor="bg-fff" :isBack="true">
  4. <block slot="content"> 经营信息</block>
  5. </cu-custom> -->
  6. <view class="top"></view>
  7. <view class="head">
  8. <view class="handle">
  9. <view class="head_left">
  10. <span class="cuIcon-back" @click="back"></span>
  11. </view>
  12. <span class="center">经营信息</span>
  13. <view class="head_right">
  14. </view>
  15. </view>
  16. </view>
  17. <status v-if="form && form.videoStatus !== null" :status="form.videoStatus" :updateTime="form.videoUpdateTime"
  18. :remark="form.videoRemark"></status>
  19. <view class="tab-top" :style="form && form.videoStatus == null ? 'margin-top: 14upx;' : 'margin-top: 144upx;'">
  20. <view class="borderRadiu">
  21. <view class=" cu-form-group margin-top1 justify-between">
  22. <view class="content ">
  23. <text class="text-bold">营业时间</text>
  24. <i class="text-bg "></i>
  25. </view>
  26. </view>
  27. <view class="customize">
  28. <view class="business-hours" v-for="(val,index) in businessData" :key="val.id" @click="hoursChange(index)">
  29. <view class="flex justify-between">
  30. <text>{{ val.period }}</text>
  31. <view @click.stop="delClick(val)" class="del-style">删除</view>
  32. </view>
  33. <view class="business-date" v-if="val.timeType==1">
  34. <text>24小时营业</text>
  35. </view>
  36. <view class="business-date" v-else>
  37. <text>{{ val.middleTime }}</text>
  38. <text>{{ val.beginTime }}</text>
  39. <text>{{ val.endTime }}</text>
  40. </view>
  41. </view>
  42. <image v-if="businessData.length!==2" style="width: 100%;height:137upx" src="/static/store/yingyeshijian.png"
  43. mode="" @click="hoursChange()"> </image>
  44. </view>
  45. </view>
  46. <view class="borderRadiu">
  47. <view class=" cu-form-group margin-top1 justify-between">
  48. <view class="content ">
  49. <text class="text-bold">经营信息</text>
  50. <i class="text-bg "></i>
  51. </view>
  52. </view>
  53. <view class="data-item">
  54. <span>店铺面积</span>
  55. <input v-model="form.storeExtent" type="Number"
  56. style="width: 100px;height: 49rpx;background-color: #f7f8fc;margin: 0px 8rpx 0px 20rpx;"></input>㎡
  57. </view>
  58. <view class="data-item">
  59. <span>开业时间</span>
  60. <view class="" style="flex: 1;display: flex;justify-content: space-between;padding-left: 20rpx;"
  61. @click="show = true">
  62. <span v-if="date">{{date}}</span>
  63. <span v-else style="color: #999999;">去设置</span>
  64. <u-icon name="arrow-right"></u-icon>
  65. </view>
  66. </view>
  67. <view class="customize">
  68. <view class="title">地理位置</view>
  69. <view class=" booder-top" style="padding-bottom: 16upx" :style="{ 'display': mapIsHidden }"
  70. @click="selectAddress">
  71. <!-- <map :key="mapKey" style="width: 100%; height: 218upx;z-index:99" :latitude="latitude" scale="14"
  72. zIndex="100" :longitude="longitude" :markers="marker" @tap="handleMarkerTap"></map> -->
  73. <tdmap style="" :initialPosition="savedLocation" :allowSelection="false" :showCoordinates="false" :key="mapKey"></tdmap>
  74. </view>
  75. <view class="business-prompt">
  76. 若位置有误直接影响客户到店,请在地图中仔细核对,可拖拽地图确保位置正确
  77. </view>
  78. </view>
  79. </view>
  80. </view>
  81. <view class="padding flex sub-bottom">
  82. <button class="cu-btn round line-gray shadow" @click="$Router.push({ name: 'settings' })">取消</button>
  83. <button style="margin-left: 12upx;width:77%" class="cu-btn bg-blue round " @click.native="sumbit">提交审核</button>
  84. </view>
  85. <u-picker v-model="show" mode="time" @confirm="selectTime" style="z-index: 999 !important;"></u-picker>
  86. </view>
  87. </template>
  88. <script>
  89. import configService from "../../common/service/config.service";
  90. import {
  91. USER_INFO
  92. } from "@/common/util/constants";
  93. import status from "./components/status.vue";
  94. import tdmap from "./tdtuMap.vue"
  95. export default {
  96. components: {
  97. status,
  98. tdmap
  99. },
  100. data() {
  101. return {
  102. video: "",
  103. photoList: [],
  104. form: {},
  105. src: "",
  106. businessData: [],
  107. show: false,
  108. date: "",
  109. latitude: 37.860372,
  110. longitude: 112.588154,
  111. marker: [{
  112. latitude: "",
  113. longitude: "",
  114. iconPath: "/static/boiaoji.png",
  115. width: 30,
  116. height: 30,
  117. label: {
  118. content: "",
  119. color: "#000000", // 文字颜色
  120. fontSize: 14, // 文字大小
  121. bgColor: "#FFFFFF",
  122. borderColor: "#CCCCCC",
  123. },
  124. }, ], // 初始为空数组
  125. mapIsHidden: true,
  126. mapKey: 1,
  127. savedLocation: {}
  128. };
  129. },
  130. onLoad(data) {
  131. if (data.params) {
  132. let obj = JSON.parse(decodeURIComponent(data.params));
  133. this.video = obj.video ? obj.video : ''
  134. obj.photo = obj.photo ? obj.photo.split(',').filter(id => id !== '') : []
  135. this.form = obj
  136. this.date = this.form.openingTime
  137. // this.savedLocation.lnglat = {
  138. // lng: obj.longitude || 0,
  139. // lat: obj.latitude || 0,
  140. // };
  141. // this.savedLocation.address = obj.address || '位置';
  142. // this.latitude = obj.lat;
  143. // this.longitude = obj.lng;
  144. }
  145. },
  146. onShow() {
  147. this.$http
  148. .get(
  149. "/merchant/localMerchantTime/list?merchantId=" +
  150. uni.getStorageSync(USER_INFO).merchantId
  151. )
  152. .then((res) => {
  153. if (res.data.success) {
  154. this.businessData = res.data.result;
  155. } else {
  156. this.$tip.error(res.data.message);
  157. }
  158. });
  159. let da = uni.getStorageSync("address");
  160. console.log(da)
  161. // let addname = uni.getStorageSync("currentAddress");
  162. // const lat = parseFloat(da.lng) || 37.860372;
  163. // const lng = parseFloat(da.lat) || 112.588154;
  164. // const labelContent = da?.address || "未设置地址";
  165. this.savedLocation.lng = da.lng
  166. this.savedLocation.lat = da.lat
  167. this.savedLocation.address = da.address || '位置';
  168. this.latitude = da.lat;
  169. this.longitude = da.lng;
  170. this.mapKey += 1;
  171. // this.marker[0].longitude = da.longitude
  172. // this.marker[0].latitude = da.latitude
  173. // this.marker[0].label.content = addname.name
  174. // this.marker = [{
  175. // latitude: lat, // 默认值避免 undefined
  176. // longitude: lng, // 默认值避免 undefined
  177. // iconPath: "/static/boiaoji.png",
  178. // width: 30,
  179. // height: 30,
  180. // label: {
  181. // content: labelContent, // 避免 addname 为 undefined
  182. // color: "#000000",
  183. // fontSize: 14,
  184. // bgColor: "#FFFFFF",
  185. // borderColor: "#CCCCCC",
  186. // },
  187. // }, ];
  188. // this.getCurrentLocation();
  189. },
  190. methods: {
  191. back() {
  192. uni.navigateTo({
  193. url: '/pages/store/settings'
  194. })
  195. },
  196. selectAddress() {
  197. uni.navigateTo({
  198. url: '/pages/store/selectTdMap?url=' + '/pages/store/businessInfor'
  199. })
  200. },
  201. // getCurrentLocation() {
  202. // uni.getStorage({
  203. // key: "currentAddress",
  204. // success: (res) => {
  205. // if (res.data && res.data.location) {
  206. // let temp = res.data.location.split(",");
  207. // this.latitude = temp[1];
  208. // this.longitude = temp[0];
  209. // // this.marker = [{
  210. // // id: 0,
  211. // // latitude: temp[1],
  212. // // longitude: temp[0],
  213. // // title: res.data.name || '当前位置',
  214. // // iconPath: '../../static/boiaoji.png',
  215. // // width: 30,
  216. // // height: 30,
  217. // // callout: { // 添加标注说明
  218. // // content: res.data.name || '当前位置',
  219. // // color: '#000',
  220. // // fontSize: 12,
  221. // // borderRadius: 10,
  222. // // bgColor: '#fff',
  223. // // padding: 5,
  224. // // display: 'ALWAYS'
  225. // // }
  226. // // }];
  227. // this.$forceUpdate();
  228. // }
  229. // },
  230. // fail: () => {
  231. // // 如果没有存储的位置,可以设置默认位置
  232. // // this.setDefaultLocation();
  233. // },
  234. // });
  235. // },
  236. handleMarkerTap() {
  237. const queryString = uni.getStorageSync("address") ?
  238. encodeURIComponent(JSON.stringify(uni.getStorageSync("address"))) :
  239. "";
  240. uni.navigateTo({
  241. url: `/pages/login/map?position=${queryString}`,
  242. // url:'/pages/login/map'
  243. });
  244. },
  245. selectTime(e) {
  246. console.log(e);
  247. this.date = e.year + "-" + e.month + "-" + e.day;
  248. },
  249. hoursChange(index) {
  250. const queryString = encodeURIComponent(
  251. JSON.stringify({
  252. index,
  253. arr: this.businessData,
  254. })
  255. );
  256. uni.navigateTo({
  257. url: `/pages/store/addHours?params=${queryString}`,
  258. });
  259. },
  260. delectVideo() {
  261. uni.showModal({
  262. title: "提示",
  263. content: "是否要删除此视频",
  264. success: (res) => {
  265. if (res.confirm) {
  266. this.video = "";
  267. }
  268. },
  269. });
  270. },
  271. DelImg(e) {
  272. uni.showModal({
  273. title: "提示",
  274. content: "确定要删除?",
  275. cancelText: "取消",
  276. confirmText: "确定",
  277. success: (res) => {
  278. if (res.confirm) {
  279. // this.photoList.splice(e.currentTarget.dataset.index, 1)
  280. this.form.photo.splice(e.currentTarget.dataset.index, 1);
  281. }
  282. },
  283. });
  284. },
  285. ChooseImage() {
  286. uni.chooseImage({
  287. // count: 4, //默认9
  288. sizeType: ["original", "compressed"], //可以指定是原图还是压缩图,默认二者都有
  289. sourceType: ["album"], //从相册选择
  290. success: (res) => {
  291. if (res) {
  292. // this[type + 'Img'] = chooseImageRes.tempFilePaths[0];
  293. uni.uploadFile({
  294. url: configService.apiUrl + "/sys/common/upload",
  295. filePath: res.tempFilePaths[0],
  296. name: "file",
  297. formData: {
  298. biz: "temp",
  299. },
  300. success: (files) => {
  301. let data = JSON.parse(files.data);
  302. if (data.success) {
  303. if (this.form.photo.length != 0) {
  304. // this.photoList = this.photoList.concat(res.tempFilePaths)
  305. this.form.photo.push(
  306. configService.apiUrl + "/" + data.message
  307. );
  308. } else {
  309. // this.photoList =res.tempFilePaths
  310. this.form.photo = [
  311. configService.apiUrl + "/" + data.message,
  312. ];
  313. }
  314. }
  315. },
  316. });
  317. }
  318. },
  319. });
  320. },
  321. ViewImage(e) {
  322. uni.previewImage({
  323. urls: this.form.photo,
  324. current: e.currentTarget.dataset.url,
  325. });
  326. },
  327. chooseVideo() {
  328. // 上传视频
  329. console.log("上传视频");
  330. uni.chooseVideo({
  331. sourceType: ["camera", "album"],
  332. success: (res) => {
  333. this.video = res.tempFilePath;
  334. },
  335. });
  336. },
  337. sumbit() {
  338. if (!this.savedLocation.lng || !this.savedLocation.lat) {
  339. uni.showToast({
  340. title: "请先获取位置信息",
  341. icon: "none"
  342. });
  343. return;
  344. }
  345. let data = {
  346. id: uni.getStorageSync(USER_INFO).merchantId,
  347. storeExtent: this.form.storeExtent,
  348. longitude: this.savedLocation.lng,
  349. latitude: this.savedLocation.lat,
  350. openingTime: this.date,
  351. };
  352. console.log(this.savedLocation.lng)
  353. // if (this.form.videoStatus == null) {
  354. // this.$http.post('/merchant/LocalMerchantOperate/add', data).then(res => {
  355. // if (res.data.success) {
  356. // this.$tip.success(res.data.result || '成功')
  357. // uni.navigateBack({
  358. // delta: 1 // 返回的页面数,默认为1
  359. // })
  360. // } else {
  361. // this.$tip.error(res.data.message);
  362. // }
  363. // })
  364. // }else {
  365. this.$http
  366. .post("/merchant/localMerchantInfo/shopEdit", {
  367. ...data,
  368. })
  369. .then((res) => {
  370. if (res.data.success) {
  371. this.$tip.success(res.data.result || "成功");
  372. uni.navigateTo({
  373. url: '/pages/store/settings'
  374. })
  375. } else {
  376. this.$tip.error(res.data.message);
  377. }
  378. });
  379. // }
  380. },
  381. delClick(val) {
  382. this.$http
  383. .delete("/merchant/localMerchantTime/delete?id=" + val.id)
  384. .then((res) => {
  385. if (res.data.success) {
  386. this.$tip.success(res.data.result || "成功");
  387. this.$http
  388. .get(
  389. "/merchant/localMerchantTime/list?merchantId=" +
  390. uni.getStorageSync(USER_INFO).merchantId
  391. )
  392. .then((res) => {
  393. if (res.data.success) {
  394. this.businessData = res.data.result;
  395. } else {
  396. this.$tip.error(res.data.message);
  397. }
  398. });
  399. } else {
  400. this.$tip.error(res.data.message);
  401. }
  402. });
  403. },
  404. },
  405. };
  406. </script>
  407. <style scoped lang="scss">
  408. page {
  409. background: #f8f8fa;
  410. }
  411. .top {
  412. width: 100%;
  413. height: var(--status-bar-height);
  414. background: linear-gradient(87deg, #FFFFFF 0%, #A3CDFF 100%), linear-gradient(360deg, #FFFFFF 0%, rgba(255, 255, 255, 0) 100%);
  415. }
  416. .head {
  417. width: 100%;
  418. background: #ffffff;
  419. .handle {
  420. height: 112rpx;
  421. display: flex;
  422. justify-content: space-between;
  423. align-items: center;
  424. padding: 0px 24rpx;
  425. position: relative;
  426. .head_left {
  427. font-size: 40rpx;
  428. }
  429. .center {
  430. position: absolute;
  431. left: 50%;
  432. top: 50%;
  433. transform: translate(-50%, -50%);
  434. font-size: 30rpx;
  435. font-weight: 600;
  436. }
  437. .head_right {
  438. display: flex;
  439. justify-content: space-between;
  440. align-items: center;
  441. span {
  442. width: 40rpx;
  443. height: 40rpx;
  444. display: flex;
  445. font-size: 28rpx;
  446. justify-content: center;
  447. align-items: center;
  448. }
  449. }
  450. }
  451. }
  452. .tab-top {
  453. padding: 0 26upx;
  454. padding-bottom: 130upx;
  455. }
  456. .progress-status {
  457. position: fixed;
  458. width: 100%;
  459. z-index: 9999;
  460. background: #ffffff;
  461. .status {
  462. font-size: 38upx;
  463. color: #f6863e;
  464. font-weight: 500;
  465. margin-bottom: 10upx;
  466. text {
  467. margin-left: 5upx;
  468. }
  469. image {
  470. vertical-align: text-top;
  471. width: 42upx;
  472. height: 42upx;
  473. }
  474. }
  475. }
  476. .borderRadiu {
  477. border-radius: 8px;
  478. background-color: #ffffff;
  479. .customize {
  480. padding: 0 18upx 18upx;
  481. .title {
  482. padding: 18upx 0;
  483. font-size: 28upx;
  484. // padding: 10px;
  485. }
  486. }
  487. .business-img {
  488. height: 210upx;
  489. width: 310upx;
  490. background-size: cover;
  491. image {
  492. width: 100%;
  493. height: 100%;
  494. }
  495. }
  496. .business-prompt {
  497. padding-top: 16upx;
  498. font-size: 20upx;
  499. color: #999999;
  500. }
  501. }
  502. .booder-top {
  503. border-bottom: 1px solid rgb(238, 238, 238);
  504. padding-bottom: 7px;
  505. .uploader_video {
  506. width: 310upx;
  507. height: 210upx;
  508. }
  509. .video-container {
  510. max-width: 100%;
  511. /* 最大宽度为父容器宽度 */
  512. max-height: 100%;
  513. ::v-deep.uni-video-bar {
  514. height: 62upx;
  515. padding: 0;
  516. }
  517. }
  518. // ::v-deep video{
  519. // position: relative;
  520. // z-index: 1;
  521. // width: 310upx ;
  522. // height: 210upx;
  523. // .uni-video-bar .uni-video-bar-full{
  524. // }
  525. // }
  526. }
  527. .sub-bottom {
  528. position: fixed;
  529. width: 100%;
  530. bottom: 0;
  531. background: #ffffff;
  532. border-top: 1px solid #eeeeee;
  533. }
  534. .uni-uploader__img {
  535. width: 200upx;
  536. height: 200upx;
  537. }
  538. .uni-uploader__file,
  539. .uploader_video {
  540. position: relative;
  541. z-index: 1;
  542. width: 200upx;
  543. height: 200upx;
  544. }
  545. .icon-cuo {
  546. position: absolute;
  547. right: 0;
  548. top: 5upx;
  549. color: #ffffff;
  550. z-index: 999;
  551. border-top-right-radius: 20upx;
  552. border-bottom-left-radius: 20upx;
  553. }
  554. .business-hours {
  555. padding: 27upx 22upx;
  556. background: #f7f8fc;
  557. font-size: 28upx;
  558. border-radius: 8px 8px 8px 8px;
  559. margin-bottom: 18upx;
  560. }
  561. .del-style {
  562. // padding: 0 30upx;
  563. width: 116upx;
  564. background: #ffffff;
  565. border-radius: 4px 4px 4px 4px;
  566. border: 1px solid #eeeeee;
  567. color: #333333;
  568. font-size: 26upx;
  569. line-height: 50upx;
  570. text-align: center;
  571. // -radius: 4px 4px 4px 4px;
  572. }
  573. .business-date {
  574. text {
  575. margin-right: 22upx;
  576. }
  577. }
  578. .data-item {
  579. display: flex;
  580. align-items: center;
  581. border-bottom: 1px solid #eeeeee;
  582. padding-left: 16rpx;
  583. height: 80rpx;
  584. align-items: center;
  585. .custom-input {
  586. width: 160rpx;
  587. }
  588. }
  589. </style>