商城类、订单类uniapp模板,多角色
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.

513 lines
12 KiB

7 months ago
1 month ago
7 months ago
1 month ago
7 months ago
6 months ago
7 months ago
6 months ago
7 months ago
1 month ago
7 months ago
6 months ago
7 months ago
1 month ago
7 months ago
6 months ago
1 month ago
6 months ago
1 month ago
7 months ago
1 month ago
7 months ago
6 months ago
7 months ago
1 month ago
7 months ago
1 month ago
7 months ago
1 month ago
7 months ago
1 month ago
7 months ago
1 month ago
7 months ago
1 month ago
6 months ago
1 month ago
6 months ago
1 month ago
6 months ago
1 month ago
6 months ago
1 month ago
7 months ago
6 months ago
7 months ago
6 months ago
7 months ago
6 months ago
7 months ago
6 months ago
7 months ago
6 months ago
7 months ago
1 month ago
7 months ago
1 month ago
7 months ago
1 month ago
6 months ago
1 month ago
6 months ago
1 month ago
6 months ago
1 month ago
6 months ago
7 months ago
1 month ago
7 months ago
1 month ago
7 months ago
1 month ago
7 months ago
1 month ago
7 months ago
1 month ago
7 months ago
1 month ago
7 months ago
1 month ago
7 months ago
6 months ago
1 month ago
6 months ago
1 month ago
6 months ago
7 months ago
6 months ago
1 month ago
6 months ago
7 months ago
6 months ago
1 month ago
6 months ago
1 month ago
6 months ago
1 month ago
6 months ago
7 months ago
  1. <template>
  2. <view class="refundsOrExchange">
  3. <navbar :title="titleList[titleIndex]" leftClick
  4. @leftClick="$utils.redirectTo('/pages/index/index')" />
  5. <view class="frame">
  6. <!-- 注册 -->
  7. <view class='forgetPassword' v-if='titleIndex == 0'>
  8. <!-- 标题 -->
  9. <view class="title">{{titleList[titleIndex]}}</view>
  10. <!-- 表单 -->
  11. <view class="form1">
  12. <view class="userName">
  13. <uv-input v-model="form1.username" placeholder="请输入手机号" border="surround" shape='circle'
  14. clearable :customStyle="{ backgroundColor: '#f6f6f6'}"></uv-input>
  15. </view>
  16. <view class="code">
  17. <view class="left">
  18. <uv-input v-model="form1.captcha" placeholder="请输入验证码" border="surround" shape='circle'
  19. clearable :customStyle="{ backgroundColor: '#f6f6f6'}"></uv-input>
  20. </view>
  21. <view class="right">
  22. <view>
  23. <uv-toast ref="toast"></uv-toast>
  24. <uv-code :seconds="seconds" @end="end" @start="start" ref="code"
  25. @change="codeChange"></uv-code>
  26. <uv-button @tap="getCode" iconSize='10rpx' color='#1f1c39'
  27. shape='circle'>{{tips}}</uv-button>
  28. </view>
  29. </view>
  30. </view>
  31. <view class="password1">
  32. <uv-input v-model="form1.password" placeholder="设置您的新密码(6到50个字符)" password clearable
  33. border="surround" shape='circle' :customStyle="{ backgroundColor: '#f6f6f6'}"></uv-input>
  34. </view>
  35. <view class="password2">
  36. <uv-input v-model="form1.newPassword" placeholder="重新确认密码" password clearable border="surround"
  37. shape='circle' :customStyle="{ backgroundColor: '#f6f6f6'}"></uv-input>
  38. </view>
  39. </view>
  40. <view>
  41. <uv-checkbox-group v-model="checkboxValue" shape="circle">
  42. <view class="content">
  43. <view style="display: flex;">
  44. <uv-checkbox size="30rpx" :name="1"></uv-checkbox>
  45. 请你阅读并同意我们的<span style="color: #fd5100"
  46. @click="$refs.popup.open('getPrivacyPolicy')">隐私条款</span><span
  47. style="color: #fd5100"
  48. @click="$refs.popup.open('getUserAgreement')">服务协议</span>
  49. </view>
  50. </view>
  51. </uv-checkbox-group>
  52. </view>
  53. </view>
  54. <!-- 登录 -->
  55. <view class="loginRegister" v-if='titleIndex==1'>
  56. <!-- 标题 -->
  57. <view class="title">{{titleList[titleIndex]}}</view>
  58. <!-- 头像 -->
  59. <view class="userIamge">
  60. <view>
  61. <img src="/static/image/center/11.svg" alt="" style="width: 100%;height: 100%;">
  62. </view>
  63. </view>
  64. <!-- 用户名&密码&隐私条款 -->
  65. <view class="form">
  66. <view>
  67. <uv-input v-model="form.username" placeholder="请输入账号" border="surround" shape='circle' clearable
  68. :customStyle="{ backgroundColor: '#f6f6f6'}"></uv-input>
  69. </view>
  70. <view>
  71. <uv-input v-model="form.password" password placeholder="请输入密码" border="surround" shape='circle'
  72. clearable :customStyle="{ backgroundColor: '#f6f6f6'}"></uv-input>
  73. </view>
  74. <view>
  75. <uv-checkbox-group v-model="checkboxValue" shape="circle">
  76. <view class="content">
  77. <view style="display: flex;">
  78. <uv-checkbox size="30rpx" :name="1"></uv-checkbox>
  79. 请你阅读并同意我们的<span style="color: #fd5100"
  80. @click="$refs.popup.open('yszc')">隐私条款</span><span
  81. style="color: #fd5100"
  82. @click="$refs.popup.open('fwxy')">服务协议</span>
  83. </view>
  84. </view>
  85. </uv-checkbox-group>
  86. </view>
  87. </view>
  88. </view>
  89. <!-- 忘记密码 -->
  90. <view class='forgetPassword' v-if='titleIndex == 2'>
  91. <!-- 标题 -->
  92. <view class="title">{{titleList[titleIndex]}}</view>
  93. <!-- 表单 -->
  94. <view class="form1">
  95. <view class="userName">
  96. <uv-input v-model="form1.username" placeholder="请输入手机号" border="surround" shape='circle'
  97. clearable :customStyle="{ backgroundColor: '#f6f6f6'}"></uv-input>
  98. </view>
  99. <view class="code">
  100. <view class="left">
  101. <uv-input v-model="form1.captcha" placeholder="请输入验证码" border="surround" shape='circle'
  102. clearable :customStyle="{ backgroundColor: '#f6f6f6'}"></uv-input>
  103. </view>
  104. <view class="right">
  105. <view>
  106. <uv-toast ref="toast"></uv-toast>
  107. <uv-code :seconds="seconds" @end="end" @start="start" ref="code"
  108. @change="codeChange"></uv-code>
  109. <uv-button @tap="getCode" iconSize='10rpx' color='#1f1c39'
  110. shape='circle'>{{tips}}</uv-button>
  111. </view>
  112. </view>
  113. </view>
  114. <view class="password1">
  115. <uv-input v-model="form1.password" placeholder="设置您的新密码(6到50个字符)" password clearable
  116. border="surround" shape='circle' :customStyle="{ backgroundColor: '#f6f6f6'}"></uv-input>
  117. </view>
  118. <view class="password2">
  119. <uv-input v-model="form1.newPassword" placeholder="重新确认密码" password clearable border="surround"
  120. shape='circle' :customStyle="{ backgroundColor: '#f6f6f6'}"></uv-input>
  121. </view>
  122. </view>
  123. </view>
  124. <!-- 按钮 -->
  125. <view class="btn" @click="submit">
  126. <button class='a'>{{titleList[titleIndex]}}</button>
  127. </view>
  128. <!-- tab -->
  129. <view class="bottomTab">
  130. <span :class="titleIndex==0 ? 'tabbarItemActive' : 'tabbarItemNoActive'"
  131. @click='changePage(0)'>注册账号</span>
  132. <span style="color: #9c9fa4">|</span>
  133. <span :class="titleIndex==1 ? 'tabbarItemActive' : 'tabbarItemNoActive'"
  134. @click='changePage(1)'>账号登录</span>
  135. <span style="color: #9c9fa4">|</span>
  136. <span :class="titleIndex==2 ? 'tabbarItemActive' : 'tabbarItemNoActive'"
  137. @click='changePage(2)'>忘记密码</span>
  138. </view>
  139. </view>
  140. <configPopup ref="popup"></configPopup>
  141. </view>
  142. </template>
  143. <script>
  144. import configPopup from '@/components/config/configPopup.vue';
  145. export default {
  146. components: {
  147. configPopup
  148. },
  149. onLoad(option) {
  150. this.titleIndex = option.index || 1
  151. },
  152. data() {
  153. return {
  154. titleIndex: 0,
  155. titleList: ['注册', '登录', '重置密码'],
  156. checkboxValue: [],
  157. form: {
  158. username: '',//19330214982
  159. password: '',//1234567
  160. loginModel: 0,
  161. captcha: '',
  162. },
  163. form1: {
  164. username: '',
  165. captcha: '',
  166. password: '',
  167. newPassword: '',
  168. },
  169. tips: '获取验证码',
  170. seconds: 60,
  171. }
  172. },
  173. methods: {
  174. submit() {
  175. if (!this.checkboxValue.length && this.titleIndex != 2) {
  176. return uni.showToast({
  177. title: '请先同意隐私协议',
  178. icon: 'none'
  179. })
  180. }
  181. if (this.titleIndex == 0) {
  182. // 注册
  183. this.register()
  184. } else if (this.titleIndex == 1) {
  185. // 登录
  186. this.login()
  187. } else {
  188. // 忘记密码
  189. this.updatePassword()
  190. }
  191. },
  192. // 登录
  193. login(){
  194. if (this.$utils.verificationAll(this.form, {
  195. username: '请输入账号',
  196. password: '请输入密码',
  197. })) {
  198. return
  199. }
  200. if (!this.$utils.verificationPhone(this.form.username)) {
  201. return uni.showToast({
  202. title: '请输入合法的手机号',
  203. icon: 'none'
  204. })
  205. }
  206. // 登录
  207. this.$store.commit('login', this.form)
  208. },
  209. // 注册
  210. register(){
  211. if (this.$utils.verificationAll(this.form1, {
  212. username: '请输入账号',
  213. captcha : '请输入验证码',
  214. password: '请输入密码',
  215. newPassword: '请确认密码',
  216. })) {
  217. return
  218. }
  219. if (!this.$utils.verificationPhone(this.form1.username)) {
  220. return uni.showToast({
  221. title: '请输入合法的手机号',
  222. icon: 'none'
  223. })
  224. }
  225. if (this.form1.password != this.form1.newPassword) {
  226. return uni.showToast({
  227. title: '密码与确认密码不一致',
  228. icon: 'none'
  229. })
  230. }
  231. this.$api('registerUser', this.form1, res => {
  232. this.form1 = {}
  233. if (res.code == 200) {
  234. this.titleIndex = 1
  235. uni.showToast({
  236. title: '注册成功,请登录!',
  237. icon: 'none'
  238. })
  239. }
  240. })
  241. },
  242. updatePassword(){
  243. if (this.$utils.verificationAll(this.form1, {
  244. username: '请输入账号',
  245. captcha : '请输入验证码',
  246. password: '请输入新密码',
  247. newPassword: '请确认密码',
  248. })) {
  249. return
  250. }
  251. if (!this.$utils.verificationPhone(this.form1.username)) {
  252. return uni.showToast({
  253. title: '请输入合法的手机号',
  254. icon: 'none'
  255. })
  256. }
  257. if (this.form1.password != this.form1.newPassword) {
  258. return uni.showToast({
  259. title: '密码与确认密码不一致',
  260. icon: 'none'
  261. })
  262. }
  263. this.$api('newPassword', this.form1, res => {
  264. this.form1 = {}
  265. if (res.code == 200) {
  266. this.titleIndex = 1
  267. uni.showToast({
  268. title: '修改成功,请登录!',
  269. icon: 'none'
  270. })
  271. }
  272. })
  273. },
  274. // 切换页面
  275. changePage(index) {
  276. this.titleIndex = index
  277. },
  278. confirm() {
  279. },
  280. codeChange(text) {
  281. this.tips = text;
  282. },
  283. getCode() {
  284. if (this.$refs.code.canGetCode) {
  285. if (!this.$utils.verificationPhone(this.form1.username)) {
  286. return uni.showToast({
  287. title: '请输入合法的手机号',
  288. icon: 'none'
  289. })
  290. }
  291. uni.showLoading({
  292. title: '正在获取验证码'
  293. })
  294. this.$api('sendSms', {
  295. username: this.form1.username,
  296. }, res => {
  297. if (res.code == 200) {
  298. uni.hideLoading();
  299. // 这里此提示会被this.start()方法中的提示覆盖
  300. uni.$uv.toast('验证码已发送');
  301. // 通知验证码组件内部开始倒计时
  302. this.$refs.code.start();
  303. }
  304. })
  305. } else {
  306. uni.$uv.toast('请勿重复发送');
  307. }
  308. },
  309. end() {
  310. // uni.$uv.toast('倒计时结束');
  311. },
  312. start() {
  313. // uni.$uv.toast('倒计时开始');
  314. }
  315. }
  316. }
  317. </script>
  318. <style lang="scss" scoped>
  319. * {
  320. box-sizing: border-box;
  321. }
  322. .content{
  323. font-size: 22rpx;
  324. margin: 0 auto;
  325. }
  326. .refundsOrExchange {
  327. background-color: #FFF;
  328. height: 100vh;
  329. .frame {
  330. background-color: #FFF;
  331. .loginRegister {
  332. display: flex;
  333. flex-direction: column;
  334. gap: 40rpx;
  335. padding-bottom: 50rpx;
  336. .title {
  337. display: flex;
  338. justify-content: center;
  339. align-items: flex-end;
  340. height: 10vh;
  341. color: #000;
  342. font-size: 40rpx;
  343. font-weight: 700;
  344. }
  345. .userIamge {
  346. display: flex;
  347. justify-content: center;
  348. height: 10vh;
  349. >view:nth-of-type(1) {
  350. width: 25%;
  351. height: 100%;
  352. border-radius: 50%;
  353. overflow: hidden;
  354. }
  355. }
  356. .form {
  357. height: 12vh;
  358. >view:nth-of-type(1) {
  359. padding: 20rpx 100rpx;
  360. }
  361. >view:nth-of-type(2) {
  362. padding: 0 100rpx;
  363. }
  364. >view:nth-of-type(3) {
  365. display: flex;
  366. padding: 30rpx 100rpx 0 100rpx;
  367. font-size: 22rpx;
  368. }
  369. }
  370. }
  371. .btn {
  372. // height: 5vh;
  373. display: flex;
  374. justify-content: center;
  375. margin: 90rpx 0 0 0;
  376. .a {
  377. display: flex;
  378. justify-content: center;
  379. align-items: center;
  380. width: 70%;
  381. height: 80rpx;
  382. color: #FFF;
  383. background-color: $uni-color;
  384. box-shadow: 0 0 4rpx 4rpx rgba($uni-color, 0.2);
  385. border-radius: 100rpx;
  386. font-size: 30rpx;
  387. }
  388. }
  389. .bottomTab {
  390. display: flex;
  391. justify-content: space-between;
  392. height: 10vh;
  393. padding: 0 80rpx;
  394. margin-top: 30rpx;
  395. .tabbarItemActive {
  396. color: $uni-color;
  397. }
  398. .tabbarItemNoActive {
  399. color: #9c9fa4;
  400. }
  401. }
  402. .forgetPassword {
  403. padding: 100rpx 40rpx 0 40rpx;
  404. .title {
  405. display: flex;
  406. justify-content: center;
  407. align-items: flex-end;
  408. height: 10vh;
  409. color: #000;
  410. font-size: 40rpx;
  411. font-weight: 700;
  412. }
  413. .form1 {
  414. display: flex;
  415. flex-direction: column;
  416. gap: 30rpx;
  417. margin-top: 20rpx;
  418. padding: 20rpx 80rpx;
  419. .userName {
  420. // padding: 20rpx 100 rpx;
  421. }
  422. .code {
  423. display: flex;
  424. width: 100%;
  425. .left {
  426. width: 55%;
  427. }
  428. .right {
  429. width: 45%;
  430. height: 100%;
  431. >view:nth-of-type(1) {
  432. display: flex;
  433. justify-content: center;
  434. align-items: center;
  435. width: 100%;
  436. }
  437. }
  438. }
  439. .password1 {}
  440. .password2 {}
  441. }
  442. }
  443. }
  444. }
  445. </style>