enter.vue 6.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283
  1. <template>
  2. <Theme>
  3. <view class="wrap">
  4. <Navbar title="商家入驻" fixed border> </Navbar>
  5. <view class="form">
  6. <view class="form_item">
  7. <view class="item_label _required">
  8. <trans _t="店铺名称" />
  9. </view>
  10. <view class="item_value">
  11. <Input
  12. :placeholder="t('请输入店铺名称')"
  13. border="surround"
  14. v-model="form.name"
  15. :maxlength="50"
  16. />
  17. </view>
  18. </view>
  19. <view class="form_item">
  20. <view class="item_label _required">
  21. <trans _t="店铺logo" />
  22. </view>
  23. <view class="item_value">
  24. <imageUpload v-model="imageList" :maxCount="1" multiple />
  25. </view>
  26. </view>
  27. <view class="form_item">
  28. <view class="item_label">
  29. <trans _t="店铺地址" />
  30. </view>
  31. <view class="item_value">
  32. <up-textarea
  33. v-model="form.address"
  34. :placeholder="t('请输入店铺地址')"
  35. count
  36. autoHeight
  37. border="surround"
  38. maxlength="500"
  39. ></up-textarea>
  40. </view>
  41. </view>
  42. <view class="form_item">
  43. <view class="item_label">
  44. <trans _t="联系方式" />
  45. </view>
  46. <view class="item_value">
  47. <Input
  48. :placeholder="t('请输入联系方式')"
  49. border="surround"
  50. type="Number"
  51. v-model="form.tel"
  52. />
  53. </view>
  54. </view>
  55. <!-- <view class="form_item">
  56. <view class="item_label">
  57. <trans _t="经度" />
  58. </view>
  59. <view class="item_value">
  60. <Input
  61. :placeholder="t('请输入经度')"
  62. border="surround"
  63. v-model="form.longitude"
  64. />
  65. </view>
  66. </view>
  67. <view class="form_item">
  68. <view class="item_label">
  69. <trans _t="纬度" />
  70. </view>
  71. <view class="item_value">
  72. <Input
  73. :placeholder="t('请输入纬度')"
  74. border="surround"
  75. type="Number"
  76. v-model="form.latitude"
  77. />
  78. </view>
  79. </view> -->
  80. </view>
  81. <view class="footer">
  82. <view class="submit_btn" @click="submit">
  83. <trans _t="提交" />
  84. </view>
  85. </view>
  86. </view>
  87. </Theme>
  88. </template>
  89. <script setup>
  90. import Navbar from "@/components/navbar";
  91. import { reactive, ref, watch, nextTick } from "vue";
  92. import { t } from "@/locale";
  93. import Input from "@/components/input";
  94. import imageUpload from "@/components/imageUpload.vue";
  95. import { SELLER_APPLY_SELLER } from "@/api";
  96. import { Toast, Modal } from "@/utils";
  97. import { onLoad } from "@dcloudio/uni-app";
  98. const imageList = ref([]);
  99. const form = reactive({
  100. name: "",
  101. logo: "",
  102. address: "",
  103. tel: "",
  104. longitude: "",
  105. latitude: "",
  106. });
  107. const submit = () => {
  108. if (!form.name) return Toast(t("店铺名称"));
  109. // if (!imageList.value.length) return Toast(t("请上传商品图片"));
  110. if (imageList.value.length) {
  111. form.logo = imageList.value.map((item) => item.url).join(",");
  112. }
  113. verificationAdd();
  114. };
  115. const verificationAdd = async () => {
  116. try {
  117. const res = await SELLER_APPLY_SELLER({ ...form });
  118. Toast(res.msg, 1000).then(() => {
  119. setTimeout(() => {
  120. // uni.navigateTo({
  121. // url: `/pages/assistant/system?id=${res.data.id}`,
  122. // });
  123. }, 1000);
  124. });
  125. } catch (error) {
  126. Toast(error.msg);
  127. close();
  128. }
  129. };
  130. onLoad((options) => {
  131. form.cateid = options.cateid;
  132. });
  133. </script>
  134. <style lang="less" scoped>
  135. @import url("@/style.less");
  136. .wrap {
  137. background: var(--bg);
  138. min-height: 100vh;
  139. padding: 24rpx;
  140. padding-bottom: calc(24rpx + constant(safe-area-inset-bottom));
  141. padding-bottom: calc(24rpx + env(safe-area-inset-bottom));
  142. .nav_right {
  143. color: var(--text);
  144. .size(28rpx);
  145. }
  146. .form {
  147. &_item {
  148. margin-top: 24rpx;
  149. &:first-child {
  150. margin-top: 0;
  151. }
  152. .item_label {
  153. font-weight: 700;
  154. color: var(--text);
  155. .size(28rpx);
  156. line-height: 60rpx;
  157. white-space: nowrap;
  158. padding-right: 24rpx;
  159. height: 64rpx;
  160. width: fit-content;
  161. position: relative;
  162. // &::before {
  163. // content: "*";
  164. // color: #f56c6c;
  165. // margin-right: 8rpx;
  166. // }
  167. }
  168. ._required {
  169. &::before {
  170. content: "*";
  171. color: #f56c6c;
  172. margin-right: 8rpx;
  173. }
  174. }
  175. .item_value {
  176. column-gap: 24rpx;
  177. flex: 1;
  178. display: flex;
  179. align-items: center;
  180. gap: 24rpx;
  181. .value_box {
  182. flex: 1;
  183. display: flex;
  184. flex-direction: column;
  185. gap: 12rpx;
  186. .title {
  187. color: var(--text);
  188. .size(24rpx);
  189. font-weight: 500;
  190. }
  191. .unit {
  192. .size(22rpx);
  193. color: var(--text-01);
  194. }
  195. }
  196. .price_separator {
  197. width: 60rpx;
  198. height: 2rpx;
  199. margin: 0 12rpx;
  200. align-self: flex-end;
  201. margin-bottom: 28rpx;
  202. background-color: var(--text-01);
  203. }
  204. /deep/ .u-input {
  205. height: 80rpx;
  206. border-radius: 20rpx;
  207. padding: 0 20rpx !important;
  208. background-color: var(--inputBg);
  209. .u-input__content {
  210. display: flex;
  211. }
  212. }
  213. /deep/ .u-textarea {
  214. border-radius: 20rpx;
  215. padding: 0 20rpx !important;
  216. background-color: var(--inputBg);
  217. }
  218. /deep/ .u-number-box {
  219. border: 1px solid #dcdfe6;
  220. border-radius: 16rpx;
  221. .u-number-box__minus,
  222. .u-number-box__plus {
  223. width: 56rpx !important;
  224. height: 56rpx !important;
  225. background-color: transparent !important;
  226. .u-icon__icon {
  227. .size(26rpx) !important;
  228. color: var(--text) !important;
  229. }
  230. &--hover {
  231. .u-icon__icon {
  232. color: var(--primary) !important;
  233. }
  234. }
  235. }
  236. .u-number-box__input {
  237. margin: 0;
  238. border-left: 1px solid #dcdfe6;
  239. border-right: 1px solid #dcdfe6;
  240. height: 56rpx !important;
  241. width: 100rpx !important;
  242. background-color: transparent !important;
  243. }
  244. }
  245. }
  246. }
  247. }
  248. .submit_btn {
  249. height: 100rpx;
  250. padding: 16rpx 30rpx;
  251. background-color: var(--black);
  252. color: var(--light);
  253. .flex_center();
  254. border-radius: 20rpx;
  255. .size(24rpx);
  256. margin-top: 40rpx;
  257. }
  258. }
  259. </style>