settings.vue 9.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392
  1. <template>
  2. <view>
  3. <cu-custom bgColor="bg-fff" :isBack="true">
  4. <block slot="content">店铺设置</block>
  5. </cu-custom>
  6. <view class="bg-fff" v-for="ele in ulList" :key="ele.name">
  7. <view class=" cu-form-group" :style="ele.name == '基本信息' ? 'margin-top:0' : ''">
  8. <view class="content ">
  9. <text class="text-bold">{{ ele.name }}</text>
  10. <i class="text-bg "></i>
  11. </view>
  12. </view>
  13. <view v-for="val in ele.liList" :key="val.label">
  14. <view class="cu-form-group justify-between">
  15. <view class="title" v-if="val.status" style="display: flex;align-items: center;">
  16. <text>{{ val.label }} </text>
  17. <text v-if="val.status=='headPhotoStatus'" style="font-size: 20rpx;color: #7e7e7e;margin: 0 10rpx;">门头照</text>
  18. <text v-if="indexOption[val.status] == 0" class="bg-orange">待审核</text>
  19. <text v-if="indexOption[val.status] == 1" class="bg-grey">审核通过</text>
  20. <text v-if="indexOption[val.status] == 2" class="bg-pink">审核驳回</text>
  21. </view>
  22. <view>
  23. <text style="color: #C7C6CA ;" @click="jump(val)"
  24. v-if="val.status == 'advertising' || val.status == 'headPhoto'">去上传</text>
  25. <text style="color: #C7C6CA ;" @click="jump(val)" v-else>去配置</text>
  26. <text class='cuIcon-right' style="color: #C7C6CA ;"></text>
  27. </view>
  28. </view>
  29. <view v-if="val.label == '服务设施'" style="padding-left: 42upx;">
  30. <text v-for="(tag, index) in selectTags" :key="index" class="tag-type tag-type-po">
  31. {{ tag }}
  32. </text>
  33. </view>
  34. <view v-if="val.label == '其他'" style="padding-left: 42upx;" @click="jumpOther">
  35. </view>
  36. </view>
  37. </view>
  38. <view class="other-tag">
  39. <view class="title" v-for="(item,index) in otherTags" :key="index">
  40. <span>{{item.className}}</span>
  41. <view class="scene" v-for="(row,index) in item.localMerchantOtherVoList" :key="index">
  42. <span>{{row.attribute}}</span>
  43. <view class="item" >
  44. <span v-for="(sun,index) in row.attributeValue.split(',')" :key="index">{{sun}}</span>
  45. </view>
  46. </view>
  47. </view>
  48. </view>
  49. <uni-popup ref="popup" type="bottom">
  50. <view class="popup-box">
  51. <view class="popup-title">
  52. <text>选择配套设施</text>
  53. <image src="/static/store/detele.png" mode="aspectFit" @click=" $refs.popup.close()"></image>
  54. </view>
  55. <view style="padding-bottom:20upx;border-bottom: 1px solid #EEEEEE;">
  56. <text v-for="(tag, index) in tags" :key="index" class="tag-type"
  57. :class="{ 'selected-background': isSelected(tag) }" :style="tag == '空调' ? 'margin-right:0' : ''"
  58. @click="toggleSelection(tag)">
  59. {{ tag }}
  60. </text>
  61. </view>
  62. <view class=" flex sub-bottom justify-between">
  63. <button class="cu-btn round line-gray shadow" @click=" $refs.popup.close()">取消</button>
  64. <button style="width:77%" class="cu-btn bg-blue round shadow" @click="submit">确定</button>
  65. </view>
  66. </view>
  67. </uni-popup>
  68. </view>
  69. </template>
  70. <script>
  71. import {
  72. USER_INFO
  73. } from "@/common/util/constants"
  74. export default {
  75. data() {
  76. return {
  77. selectTags: [],
  78. tags: ['停车位', '休息室', 'WIFI', '空调', '茶点', '洗手间'], // 你的标签数组
  79. selectedIndices: [], // 用于存储被选中的标签索引
  80. ulList: [{
  81. name: '基本信息',
  82. liList: [{
  83. label: '店铺信息',
  84. status: 'status'
  85. }, {
  86. label: '品牌信息',
  87. status: 'logoStatus'
  88. }, {
  89. label: '经营信息',
  90. status: ' '
  91. },
  92. {
  93. label: '广告素材',
  94. // status: 'advertising'
  95. status: 'videoStatus'
  96. },
  97. {
  98. label: '商户照片',
  99. status: 'headPhotoStatus'
  100. },
  101. ],
  102. },
  103. {
  104. name: '其他信息',
  105. liList: [{
  106. label: '经营资质',
  107. status: 'specialStatus'
  108. }, {
  109. label: '服务设施',
  110. status: ' '
  111. }, {
  112. label: '其他',
  113. status: ' '
  114. },],
  115. }
  116. ],
  117. merchantId: '',
  118. indexOption: {},
  119. otherTags:[]
  120. }
  121. },
  122. async onShow() {
  123. this.merchantId = uni.getStorageSync(USER_INFO).merchantId;
  124. let res = await this.$http.get("/merchant/localMerchantInfo/queryAppInfoById?id=" + this.merchantId)
  125. if (res.data.success) {
  126. this.selectTags = res.data.result.content ? res.data.result.content.split(',').filter(id => id !== '') : []
  127. this.indexOption = res.data.result
  128. uni.setStorageSync('address', {longitude:res.data.result.longitude,latitude:res.data.result.latitude});
  129. uni.setStorageSync('currentAddress', {name:res.data.result.address});
  130. } else {
  131. this.$tip.toast(res.data.message);
  132. }
  133. this.getOther()
  134. },
  135. methods: {
  136. getOther(){
  137. this.$http.get('/localOther/localMerchantOther/queryById?id='+this.merchantId).then(res => {
  138. console.log(res)
  139. this.otherTags = res.data.result
  140. })
  141. },
  142. submit() {
  143. let code = !!this.indexOption.content ? '/merchant/localMerchantService/edit' :
  144. '/merchant/localMerchantService/add'
  145. this.$http.post(code, {
  146. merchantId: this.merchantId,
  147. content: this.selectedIndices.join(',')
  148. }).then(res => {
  149. if (res.data.success) {
  150. this.$tip.success(res.data.result || '成功')
  151. uni.redirectTo({
  152. url: '/pages/store/settings'
  153. });
  154. } else {
  155. this.$tip.error(res.data.message);
  156. }
  157. })
  158. },
  159. // 检查一个标签是否被选中
  160. isSelected(tag) {
  161. return this.selectedIndices.includes(tag);
  162. },
  163. // 切换标签的选中状态
  164. toggleSelection(tag) {
  165. const indexIndex = this.selectedIndices.indexOf(tag);
  166. if (indexIndex > -1) {
  167. // 如果标签已经被选中,则移除它
  168. this.selectedIndices.splice(indexIndex, 1);
  169. } else {
  170. // 如果标签没有被选中,则添加它
  171. this.selectedIndices.push(tag);
  172. }
  173. },
  174. jump(item) {
  175. const queryString = encodeURIComponent(JSON.stringify(this.indexOption))
  176. if (item.label == '店铺信息') {
  177. uni.navigateTo({
  178. url: `/pages/login/settled?params=${queryString}`
  179. });
  180. }
  181. if (item.label == '品牌信息') {
  182. uni.navigateTo({
  183. url: `/pages/store/brandMessage?params=${queryString}`
  184. });
  185. }
  186. if (item.label == '经营信息') {
  187. uni.navigateTo({
  188. url: `/pages/store/businessInfor?params=${queryString}`
  189. });
  190. }
  191. if (item.label == '经营资质') {
  192. uni.navigateTo({
  193. url: `/pages/store/businessQua?params=${queryString}`
  194. });
  195. }
  196. if (item.label == '服务设施') {
  197. this.$refs.popup.open()
  198. this.selectedIndices = [...this.selectTags]
  199. }
  200. if (item.label == '广告素材') {
  201. uni.navigateTo({
  202. url: `/pages/store/advertising?params=${queryString}`
  203. });
  204. }
  205. if (item.label == '商户照片') {
  206. uni.navigateTo({
  207. url: `/pages/store/headPhoto?params=${queryString}`
  208. });
  209. }
  210. if (item.label == '其他') {
  211. uni.navigateTo({
  212. url: `/pages/store/otherSet?params=${queryString}`
  213. });
  214. }
  215. }
  216. }
  217. }
  218. </script>
  219. <style scoped lang="scss">
  220. page {
  221. background: #F8F8FA;
  222. }
  223. .cu-form-group {
  224. margin: 18upx 42upx;
  225. }
  226. /* .cu-form-group+.cu-form-group{
  227. border:none;
  228. border-top: 1upx solid #eee;
  229. } */
  230. .cu-form-group:not(.bg-fff :has(+ .cu-form-group)) {
  231. border: none
  232. }
  233. .bg-orange {
  234. background: #FBF9E4;
  235. color: #F6863E;
  236. font-size: 24upx;
  237. padding: 6upx 10upx;
  238. margin-left: 12upx;
  239. }
  240. .bg-grey {
  241. background: #F3F3F3;
  242. color: #7E7E7E;
  243. font-size: 24upx;
  244. padding: 6upx 10upx;
  245. margin-left: 12upx;
  246. }
  247. .bg-pink {
  248. background: #FBE5E4;
  249. color: #F34F4F;
  250. font-size: 24upx;
  251. padding: 6upx 10upx;
  252. margin-left: 12upx;
  253. }
  254. .popup-box {
  255. background: #FFFFFF;
  256. padding: 0 27upx;
  257. border-radius: 20px 20px 0px 0px;
  258. .popup-title {
  259. padding: 22upx 0;
  260. position: relative;
  261. text-align: center;
  262. font-weight: 500;
  263. font-size: 34upx;
  264. color: #333333;
  265. border-bottom: 1px solid #EEEEEE;
  266. image {
  267. position: absolute;
  268. right: 0;
  269. width: 42upx;
  270. height: 42upx;
  271. }
  272. }
  273. }
  274. .tag-type {
  275. display: inline-block;
  276. font-size: 26upx;
  277. width: 150upx;
  278. height: 54upx;
  279. color: #333333;
  280. margin: 18upx 33upx 0 0;
  281. border-radius: 4px 4px 4px 4px;
  282. border: 1px solid #C2C2C2;
  283. text-align: center;
  284. line-height: 54upx;
  285. }
  286. .tag-type-po {
  287. background: rgba(68, 154, 255, 0.1);
  288. border: 1px solid #449AFF;
  289. color: #2983EC;
  290. margin: 0 24upx 18upx 0;
  291. }
  292. .selected-background {
  293. color: #2983EC;
  294. position: relative;
  295. background: rgba(68, 154, 255, 0.1);
  296. border: 1px solid #449AFF;
  297. }
  298. .selected-background ::after {
  299. content: '';
  300. position: absolute;
  301. top: -1px;
  302. right: -1px;
  303. width: 22upx;
  304. height: 22upx;
  305. background-image: url('/static/store/xuanzhong.png');
  306. background-size: cover;
  307. background-repeat: no-repeat;
  308. border-radius: 0 5px 0 0;
  309. }
  310. .sub-bottom {
  311. width: 100%;
  312. background: #FFFFFF;
  313. padding: 27upx 0;
  314. }
  315. .title {
  316. text {
  317. height: 34rpx;
  318. display: flex;
  319. align-items: center;
  320. justify-content: center;
  321. }
  322. }
  323. .other-tag{
  324. width: 95%;
  325. margin: 0 auto;
  326. padding: 24rpx 32rpx;
  327. background-color: #fff;
  328. .title{
  329. span{
  330. display: inline-block;
  331. font-weight: 500;
  332. font-size: 26rpx;
  333. margin-bottom: 20rpx;
  334. }
  335. }
  336. .scene{
  337. span{
  338. display: inline-block;
  339. font-size: 24rpx;
  340. color: #666666;
  341. margin-bottom: 0rpx;
  342. }
  343. }
  344. .item{
  345. width: 100%;
  346. display: flex;
  347. align-items: center;
  348. span{
  349. display: inline-block;
  350. width: 120rpx;
  351. height: 49rpx;
  352. background: rgba(68,154,255,0.1);
  353. border-radius: 4rpx ;
  354. font-size: 22rpx;
  355. color: #2983EC;
  356. margin: 10rpx;
  357. display: flex;
  358. align-items: center;
  359. justify-content: center;
  360. }
  361. }
  362. }
  363. </style>