酒店桌布为微信小程序
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

312 lines
6.8 KiB

8 months ago
  1. <template>
  2. <view class="applyLaundryStore">
  3. <navbar title="申请水洗店" leftClick @leftClick="$utils.navigateBack" />
  4. <view class="frame">
  5. <view class="title">
  6. <span style="width: 10rpx;height: 40rpx;background-color: #f78142;border-radius: 10rpx;overflow: hidden;"></span>
  7. <span>店铺信息</span>
  8. </view>
  9. <view class="shopName">
  10. <view>店铺名称</view>
  11. <view>
  12. <input placeholder="请输入店铺名称" clearable></input>
  13. </view>
  14. </view>
  15. <view class="shopName">
  16. <view>您的姓名</view>
  17. <view>
  18. <input placeholder="请输入您的姓名" clearable></input>
  19. </view>
  20. </view>
  21. <view class="shopName">
  22. <view>联系方式</view>
  23. <view>
  24. <input placeholder="请输入联系方式" clearable></input>
  25. </view>
  26. </view>
  27. <view class="currentRegion">
  28. <view>所在地区</view>
  29. <view @click="open">
  30. 湖南省
  31. </view>
  32. </view>
  33. <view class="shopName">
  34. <view>详细地址</view>
  35. <view>
  36. <input placeholder="请输入详细地址" clearable></input>
  37. </view>
  38. </view>
  39. </view>
  40. <!-- 省市区三级联动 -->
  41. <uv-picker ref="provinceCityDistrictLinkageRef" :columns="addressList" :loading="loading" keyName="name"
  42. @change="change" @confirm="confirm">
  43. </uv-picker>
  44. <!-- 底部按钮 -->
  45. <bottomBtn @confirm='submitApplication()' :color='bottomBtnStyle.color'
  46. :backgroundColor='bottomBtnStyle.backgroundColor' :fontSize='bottomBtnStyle.fontSize'
  47. :text='bottomBtnStyle.text' :width="bottomBtnStyle.width" :height="bottomBtnStyle.height"
  48. :borderRadius='bottomBtnStyle.borderRadius' :bottom='bottomBtnStyle.bottom'>
  49. </bottomBtn>
  50. </view>
  51. </template>
  52. <script>
  53. import bottomBtn from "../../components/bottom/bottomBtn.vue"
  54. export default {
  55. components: {
  56. bottomBtn,
  57. },
  58. data() {
  59. return {
  60. loading: true,
  61. provinces: [], //省
  62. citys: [], //市
  63. areas: [], //区
  64. pickerValue: [0, 0, 0],
  65. defaultValue: [3442, 1, 2],
  66. bottomBtnStyle: {
  67. color: '#FFF',
  68. backgroundColor: '#fd5100',
  69. fontSize: '34rpx',
  70. text: '提交',
  71. width: '400rpx',
  72. height: '80rpx',
  73. borderRadius: '100rpx',
  74. bottom: '40rpx'
  75. },
  76. }
  77. },
  78. computed: {
  79. addressList() {
  80. return [this.provinces, this.citys, this.areas];
  81. }
  82. },
  83. mounted() {
  84. this.getprovinceCityDistrictLinkageData();
  85. },
  86. methods: {
  87. // 提交按钮
  88. submitApplication() {
  89. },
  90. getprovinceCityDistrictLinkageData() {
  91. uni.request({
  92. method: 'GET',
  93. url: '/static/uvui/example/regions.json',
  94. success: res => {
  95. const {
  96. statusCode,
  97. data
  98. } = res
  99. if (statusCode === 200) {
  100. console.log('获取的数据:', res);
  101. this.provinces = data.sort((left, right) => (Number(left.code) > Number(right
  102. .code) ? 1 : -1));
  103. console.log(this.provinces)
  104. this.handlePickValueDefault()
  105. setTimeout(() => {
  106. this.loading = false
  107. }, 200)
  108. }
  109. }
  110. })
  111. },
  112. handlePickValueDefault() {
  113. // 设置省
  114. this.pickerValue[0] = this.provinces.findIndex(item => Number(item.id) === this.defaultValue[0]);
  115. // 设置市
  116. this.citys = this.provinces[this.pickerValue[0]]?.children || [];
  117. this.pickerValue[1] = this.citys.findIndex(item => Number(item.id) === this.defaultValue[1]);
  118. // 设置区
  119. this.areas = this.citys[this.pickerValue[1]]?.children || [];
  120. this.pickerValue[2] = this.areas.findIndex(item => Number(item.id) === this.defaultValue[2]);
  121. // 重置下位置
  122. this.$refs.provinceCityDistrictLinkageRef.setIndexs([this.pickerValue[0], this.pickerValue[1], this
  123. .pickerValue[2]
  124. ], true);
  125. },
  126. change(e) {
  127. if (this.loading) return;
  128. const {
  129. columnIndex,
  130. index,
  131. indexs
  132. } = e
  133. // 改变了省
  134. if (columnIndex === 0) {
  135. this.citys = this.provinces[index]?.children || []
  136. this.areas = this.citys[0]?.children || []
  137. this.$refs.provinceCityDistrictLinkageRef.setIndexs([index, 0, 0], true)
  138. } else if (columnIndex === 1) {
  139. this.areas = this.citys[index]?.children || []
  140. this.$refs.provinceCityDistrictLinkageRef.setIndexs(indexs, true)
  141. }
  142. },
  143. open() {
  144. this.$refs.provinceCityDistrictLinkageRef.open();
  145. this.handlePickValueDefault()
  146. },
  147. confirm(e) {
  148. console.log('确认选择的地区:', e);
  149. uni.showToast({
  150. icon: 'none',
  151. title: `${e.value[0].name}/${e.value[1].name}/${e.value[2].name}`
  152. })
  153. }
  154. }
  155. }
  156. </script>
  157. <style lang="scss" scoped>
  158. * {
  159. box-sizing: border-box;
  160. }
  161. .applyLaundryStore {
  162. padding: 0 20rpx 0 20rpx;
  163. background-color: #f5f5f5;
  164. .frame {
  165. display: flex;
  166. flex-direction: column;
  167. gap: 20rpx;
  168. background-color: #FFF;
  169. margin-top: 20rpx;
  170. padding: 20rpx;
  171. .title {
  172. display: flex;
  173. // padding-top: 40rpx;
  174. font-size: 34rpx;
  175. font-weight: 700;
  176. padding: 0 0 0 20rpx;
  177. >span:nth-of-type(1) {
  178. margin: 4rpx 0 0 8rpx;
  179. background-color: #FFF;
  180. }
  181. >span:nth-of-type(2) {
  182. margin: 0 0 0 8rpx;
  183. background-color: #FFF;
  184. }
  185. }
  186. .shopName {
  187. display: flex;
  188. align-items: center;
  189. background-color: #FFF;
  190. height: 80rpx;
  191. // margin: 10rpx 0 0 0;
  192. padding: 10rpx 0 0 20rpx;
  193. >view:nth-of-type(1) {
  194. width: 30%;
  195. // font-weight: 700;
  196. }
  197. >view:nth-of-type(2) {
  198. width: 70%;
  199. // padding: 0 20rpx 0 0;
  200. border-radius: 10rpx;
  201. overflow: hidden;
  202. input{
  203. background-color: #f5f5f5;
  204. color: #a4a4a4;
  205. font-size: 28rpx;
  206. padding: 8rpx 8rpx 8rpx 15rpx;
  207. }
  208. }
  209. }
  210. .name {
  211. display: flex;
  212. align-items: center;
  213. background-color: #FFF;
  214. height: 80rpx;
  215. // margin: 10rpx 0 0 0;
  216. padding: 10rpx 0 0 20rpx;
  217. >view:nth-of-type(1) {
  218. width: 30%;
  219. font-weight: 700;
  220. }
  221. >view:nth-of-type(2) {
  222. width: 70%;
  223. padding: 0 20rpx 0 0;
  224. }
  225. }
  226. .phone {
  227. display: flex;
  228. align-items: center;
  229. background-color: #FFF;
  230. height: 80rpx;
  231. // margin: 10rpx 0 0 0;
  232. padding: 10rpx 0 0 20rpx;
  233. >view:nth-of-type(1) {
  234. width: 30%;
  235. font-weight: 700;
  236. }
  237. >view:nth-of-type(2) {
  238. width: 70%;
  239. padding: 0 20rpx 0 0;
  240. }
  241. }
  242. .currentRegion {
  243. display: flex;
  244. align-items: center;
  245. background-color: #FFF;
  246. height: 80rpx;
  247. // margin: 10rpx 0 0 0;
  248. padding: 10rpx 0 0 20rpx;
  249. >view:nth-of-type(1) {
  250. width: 30%;
  251. // font-weight: 700;
  252. }
  253. >view:nth-of-type(2) {
  254. width: 70%;
  255. padding: 0 20rpx 0 0;
  256. }
  257. }
  258. .detailedAddress {
  259. display: flex;
  260. align-items: center;
  261. background-color: #FFF;
  262. height: 80rpx;
  263. // margin: 10rpx 0 0 0;
  264. padding: 10rpx 0 0 20rpx;
  265. >view:nth-of-type(1) {
  266. width: 30%;
  267. font-weight: 700;
  268. }
  269. >view:nth-of-type(2) {
  270. width: 70%;
  271. padding: 0 20rpx 0 0;
  272. }
  273. }
  274. }
  275. }
  276. </style>