uni-scroll-cate.vue 5.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267
  1. <template>
  2. <view class="content">
  3. <view class="popup-content">
  4. <view class="">
  5. <view class="box-pack-between ft32 flex-center popup-content-title">
  6. <text @click="close">关闭</text>
  7. <text style="color: #003A9B;" @click="confirm">确认</text>
  8. </view>
  9. <view class="ft22 tips cate border-b">
  10. <view class="">
  11. Tip:请根据小程序自身的功能,正确选择服务类目。
  12. </view>
  13. 餐饮行业选择服务类型是:餐饮 > 餐饮服务场所/餐饮服务管理企业,商业服务 > 公关/推广/市场调查
  14. </view>
  15. </view>
  16. <view class="flex">
  17. <scroll-view scroll-y class="popup-content-scroll">
  18. <view @click="bindProv" :data-title="item.name" :data-code="item.id" :class="item.id==Prov_code?'act':''"
  19. class="popup-content-scroll-li flex-center" v-for="(item,index) of Prov_arr" :key='index'>
  20. {{item.name}}
  21. </view>
  22. </scroll-view>
  23. <scroll-view scroll-y class="popup-content-scroll">
  24. <block v-if="City_arr.length>0">
  25. <view @click="bindCity" :data-innername="item.inner_name" :data-title="item.name"
  26. :class="item.id==City_code?'act':''" :data-code="item.id"
  27. class="popup-content-scroll-li flex-center " v-for="(item,index) of City_arr" :key='index'>
  28. {{item.name}}
  29. </view>
  30. </block>
  31. <view v-else class="City popup-content-scroll-li flex-center">
  32. 请选择
  33. </view>
  34. </scroll-view>
  35. <scroll-view scroll-y class="popup-content-scroll">
  36. <!-- <block v-if="Dist_arr.length>0">
  37. <view @click="bindDist" :data-title="item.city_name" :class="item.cityid==Dist_code?'act':''" :data-code="item.cityid"
  38. class="popup-content-scroll-li flex-center" v-for="(item,index) of Dist_arr" :key='index'>
  39. {{item.city_name}}
  40. </view>
  41. </block> -->
  42. <block v-if="innername">
  43. <view class="City popup-content-scroll-li flex-center ft26">
  44. {{innername}}
  45. </view>
  46. <view class="home-img" @click="uploadFile" data-type='1'>
  47. <image :src="URL+xcx_logo" class="home-img-icon"></image>
  48. </view>
  49. </block>
  50. </scroll-view>
  51. </view>
  52. </view>
  53. </view>
  54. </template>
  55. <script>
  56. export default {
  57. name: 'uniScroll',
  58. props: {
  59. Prov_arr: {
  60. type: Array,
  61. default () {
  62. return []
  63. }
  64. },
  65. type: {
  66. type: Number,
  67. default: 1,
  68. },
  69. },
  70. inject: ['popup'],
  71. data() {
  72. return {
  73. City_arr: [],
  74. Dist_arr: [],
  75. Prov_code: "",
  76. City_code: "",
  77. Dist_code: "",
  78. Prov_title1: "",
  79. City_title1: "",
  80. Dist_title1: "",
  81. Prov_title: "",
  82. City_title: "",
  83. Dist_title: "",
  84. innername:"",
  85. xcx_logo:"",
  86. URL: getApp().globalData.URL,
  87. }
  88. },
  89. onLoad() {
  90. },
  91. methods: {
  92. uploadFile(e) {
  93. uni.chooseImage({
  94. success: (res) => {
  95. res.tempFilePaths.forEach((v, i) => {
  96. console.log(v)
  97. this.Upload({
  98. url: "setting/upload",
  99. data: {
  100. url: v,
  101. admin_id: uni.getStorageSync("admin_id"),
  102. }
  103. }).then(res => {
  104. console.log(res, "res")
  105. this.xcx_logo = res.src;
  106. }).catch({});
  107. })
  108. }
  109. });
  110. },
  111. // 商户地址省
  112. bindProv(e) {
  113. this.Prov_code = e.currentTarget.dataset.code;
  114. this.Prov_title1 = e.currentTarget.dataset.title;
  115. this.Dist_arr = [];
  116. this.Dist_code = "";
  117. this.City_code = "";
  118. this.City();
  119. },
  120. // 商户地址市
  121. bindCity(e) {
  122. console.log(e)
  123. let {code,title,innername }=e.currentTarget.dataset;
  124. this.City_code = code;
  125. this.City_title1 = title;
  126. this.innername=innername;
  127. this.Dist_code = "";
  128. // this.wechat_secondcode();
  129. },
  130. // 商户地址区
  131. bindDist(e) {
  132. this.Dist_title1 = e.currentTarget.dataset.title;
  133. this.Dist_code = e.currentTarget.dataset.code;
  134. },
  135. close(e) {
  136. this.popup.close();
  137. // this.$refs.popup.close();
  138. },
  139. confirm(e) {
  140. let info;
  141. if (!this.City_code||!this.Prov_code) {
  142. uni.showToast({
  143. title: "请选择",
  144. icon: "none"
  145. })
  146. return
  147. }
  148. info = {
  149. code1: this.Prov_code,
  150. code2: this.City_code,
  151. // Dist_code: this.Dist_code,
  152. Prov_title: this.Prov_title1,
  153. City_title: this.City_title1,
  154. special_license_pic :this.xcx_logo,
  155. zzzs_name :this.innername,
  156. // Dist_title: this.Dist_title1,
  157. }
  158. this.$emit('select', info)
  159. this.popup.close();
  160. },
  161. City(e) {
  162. this.request({
  163. url: "setting/wechat_secondcategory",
  164. data: {
  165. id: this.Prov_code,
  166. },
  167. }).then(res => {
  168. console.log(res, "res")
  169. if (res.code =="200") {
  170. this.City_arr = res.data;
  171. }
  172. }).catch((res) => {
  173. // this.City_arr = [];
  174. });
  175. },
  176. wechat_secondcode(){
  177. this.request({
  178. url: "setting/wechat_secondcode",
  179. data: {
  180. id: this.City_code,
  181. },
  182. }).then(res => {
  183. console.log(res, "res")
  184. if (res.code === '200') {
  185. }
  186. }).catch((res) => {
  187. });
  188. },
  189. Dist(e) {
  190. this.Dist_arr = res.data;
  191. return
  192. this.request({
  193. url: "setting/getcity",
  194. data: {
  195. cityid: this.City_code,
  196. },
  197. }).then(res => {
  198. console.log(res, "res")
  199. if (res.code === '200') {
  200. this.Dist_arr = res.data;
  201. }
  202. }).catch((res) => {
  203. this.Dist_arr = [];
  204. });
  205. },
  206. }
  207. }
  208. </script>
  209. <style>
  210. page .act {
  211. color: #007AFF;
  212. }
  213. .popup-content {
  214. width: 100%;
  215. background: #fff;
  216. padding: 0rpx 40rpx;
  217. }
  218. .popup-content-title {
  219. border-bottom: 1rpx solid #F1F1F1;
  220. padding: 10rpx 0rpx;
  221. }
  222. .popup-content-scroll {
  223. height: 590rpx;
  224. width: 33%;
  225. text-align: center;
  226. }
  227. .popup-content-scroll-li {
  228. padding: 8rpx 0;
  229. }
  230. .home-img-icon {
  231. border: 1rpx solid #ccc;
  232. width: 200rpx;
  233. height: 200rpx;
  234. }
  235. </style>