storeInformation.vue 7.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303
  1. <template>
  2. <view class="container">
  3. <view class="top-box">
  4. 为了方便我们与您尽快联系达成合作,请如实填写以下资料,谢谢您的支持与配合
  5. </view>
  6. <u-form :model="storeInfo" ref="uForm" labelPosition="left" :rules="rules" labelWidth="80">
  7. <view class="content-box">
  8. <view class="content-item">
  9. <u-form-item prop="name" required label="姓名" right>
  10. <view class="item-r">
  11. <u--input
  12. placeholder="请输入负责人名称"
  13. border="surround"
  14. v-model="storeInfo.name"
  15. ></u--input>
  16. </view>
  17. </u-form-item>
  18. </view>
  19. <view class="content-item">
  20. <u-form-item prop="mobileNumber" required label="手机号码" right>
  21. <view class="item-r">
  22. <u--input
  23. placeholder="请输入手机号码"
  24. border="surround"
  25. v-model="storeInfo.mobileNumber"
  26. ></u--input>
  27. </view>
  28. </u-form-item>
  29. </view>
  30. </view>
  31. <view class="content-box">
  32. <view class="content-item">
  33. <u-form-item prop="storeName" required label="店铺名称" right>
  34. <view class="item-r">
  35. <u--input
  36. placeholder="请输入店铺名称"
  37. border="surround"
  38. v-model="storeInfo.storeName"
  39. ></u--input>
  40. </view>
  41. </u-form-item>
  42. </view>
  43. <view class="content-item">
  44. <u-form-item prop="area" required label="所在地区" right>
  45. <view class="item-r">
  46. <u--input
  47. placeholder="请选择所在地区"
  48. border="surround"
  49. v-model="storeInfo.area"
  50. @focus="handlerChange"
  51. ></u--input>
  52. </view>
  53. </u-form-item>
  54. </view>
  55. <view class="content-item">
  56. <u-form-item prop="storeAddress" required label="详细地址" right>
  57. <view class="item-r">
  58. <u--input
  59. placeholder="请输入门店详细地址"
  60. border="surround"
  61. v-model="storeInfo.storeAddress"
  62. ></u--input>
  63. </view>
  64. </u-form-item>
  65. </view>
  66. </view>
  67. <view class="content-box">
  68. <u-form-item prop="shopFacade">
  69. <imgs-upload :filelist.sync="filelist"></imgs-upload>
  70. <p class="upload-text">店铺门面图(需要包含完整牌匾)</p>
  71. </u-form-item>
  72. </view>
  73. <view class="content-box">
  74. <u-form-item prop="realFacade">
  75. <imgs-upload :filelist.sync="filelist"></imgs-upload>
  76. <p class="upload-text">店内真实环境图</p>
  77. </u-form-item>
  78. </view>
  79. </u-form>
  80. <button class="btn" @click="handlerSkipNext">下一步</button>
  81. <!-- 地区 -->
  82. <u-picker
  83. :show="show"
  84. ref="uPicker"
  85. :columns="cityList"
  86. @confirm="confirm"
  87. @change="changeHandler"
  88. @cancel="show = false"
  89. ></u-picker>
  90. </view>
  91. </template>
  92. <script>
  93. import ImgsUpload from '@/pages/merchant/mine/openStore/components/ImgsUpload.vue';
  94. // 导入城市js文件
  95. import cityData from '@/utils/city';
  96. export default {
  97. components: {
  98. ImgsUpload,
  99. },
  100. data() {
  101. return {
  102. fileList: [],
  103. storeInfo: {
  104. area: '',
  105. storeAddress: '',
  106. name: '',
  107. mobileNumber: '',
  108. storeName: '',
  109. shopFacade: '',
  110. realFacade: '',
  111. },
  112. rules: {
  113. name: {
  114. type: 'string',
  115. required: true,
  116. message: '请输入负责人名称',
  117. trigger: ['blur', 'change'],
  118. },
  119. storeName: {
  120. type: 'string',
  121. required: true,
  122. message: '请输入店铺名',
  123. trigger: ['blur', 'change'],
  124. },
  125. storeAddress: {
  126. type: 'string',
  127. required: true,
  128. message: '请输入详细地址',
  129. trigger: ['blur', 'change'],
  130. },
  131. mobileNumber: [
  132. {
  133. required: true,
  134. message: '请输入手机号码',
  135. trigger: ['blur', 'change'],
  136. },
  137. {
  138. validator: (rule, value, callback) => {
  139. return uni.$u.test.mobile(value);
  140. },
  141. message: '手机号码不正确',
  142. trigger: ['change', 'blur'],
  143. },
  144. ],
  145. area: [
  146. {
  147. required: true,
  148. message: '请选择所在地区',
  149. trigger: ['change', 'blur'],
  150. },
  151. ],
  152. },
  153. show: false, //显示选择器
  154. // 打开选择器显示默认城市
  155. cityList: [],
  156. cityLevel1: [],
  157. cityLevel2: [],
  158. cityLevel3: [],
  159. };
  160. },
  161. onShow() {
  162. this.initCityData();
  163. },
  164. methods: {
  165. initCityData() {
  166. // 遍历城市js
  167. cityData.forEach((item1, index1) => {
  168. let temp2 = [];
  169. this.cityLevel1.push(item1.provinceName);
  170. let temp4 = [];
  171. let temp3 = [];
  172. // 遍历市
  173. item1.cities.forEach((item2, index2) => {
  174. temp2.push(item2.cityName);
  175. // 遍历区
  176. item2.counties.forEach((item3, index3) => {
  177. temp3.push(item3.countyName);
  178. });
  179. temp4[index2] = temp3;
  180. temp3 = [];
  181. });
  182. this.cityLevel3[index1] = temp4;
  183. this.cityLevel2[index1] = temp2;
  184. });
  185. // 选择器默认城市
  186. this.cityList.push(this.cityLevel1, this.cityLevel2[0], this.cityLevel3[0][0]);
  187. },
  188. // 选中时执行
  189. changeHandler(e) {
  190. const {
  191. columnIndex,
  192. index,
  193. indexs,
  194. value,
  195. values,
  196. // 微信小程序无法将picker实例传出来,只能通过ref操作
  197. picker = this.$refs.uPicker,
  198. } = e;
  199. if (columnIndex === 0) {
  200. // 选择第一列数据时 设置第二列关联数据
  201. picker.setColumnValues(1, this.cityLevel2[index]);
  202. // 设置第三列关联数据
  203. picker.setColumnValues(2, this.cityLevel3[index][columnIndex]);
  204. } else if (columnIndex === 1) {
  205. // 选择第二列数据时 设置第三列关联数据
  206. picker.setColumnValues(2, this.cityLevel3[indexs[0]][index]);
  207. }
  208. },
  209. // 单击确认按钮时执行
  210. confirm(e) {
  211. this.storeInfo.area = e.value.join('');
  212. // 隐藏城市选择器
  213. this.show = false;
  214. },
  215. handlerChange() {
  216. this.show = true;
  217. },
  218. handlerSkipNext() {
  219. this.$store.commit('SET_STOREINFO', this.storeInfo);
  220. setTimeout(() => {
  221. uni.navigateTo({
  222. url: '/pages/merchant/mine/openStore/corporateInformation',
  223. });
  224. }, 1500);
  225. console.log(this.storeInfo, '@this.storeInfo');
  226. },
  227. },
  228. };
  229. </script>
  230. <style lang="scss" scoped>
  231. .container {
  232. background-color: #f7f7f7 !important;
  233. padding-bottom: 40rpx;
  234. .top-box {
  235. color: #666666;
  236. font-size: 26rpx;
  237. text-align: center;
  238. padding: 20rpx 40rpx;
  239. background-color: #fff;
  240. }
  241. .content-box {
  242. padding: 20rpx 40rpx;
  243. background-color: #fff;
  244. margin: 10rpx 0;
  245. .content-item {
  246. .item-r {
  247. background-color: #f7f7f7;
  248. border-radius: 20rpx;
  249. display: flex;
  250. .data_select {
  251. width: 90%;
  252. }
  253. ::v-deep .u-form-item {
  254. width: 100%;
  255. }
  256. ::v-deep .u-form-item__body {
  257. padding: 0;
  258. }
  259. }
  260. }
  261. .upload-text {
  262. text-align: center;
  263. color: #666666;
  264. font-size: 28rpx;
  265. margin-top: 20rpx;
  266. }
  267. }
  268. .btn {
  269. background-color: #5992bb !important;
  270. color: #fff;
  271. font-size: 32rpx;
  272. border-radius: 40rpx;
  273. margin-top: 100rpx;
  274. margin-bottom: 100rpx;
  275. width: 95%;
  276. }
  277. }
  278. ::v-deep .uni-select {
  279. border: none !important;
  280. }
  281. ::v-deep .uni-select__input-placeholder {
  282. font-size: 28rpx !important;
  283. color: #cbced4 !important;
  284. }
  285. </style>