index.vue 19 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582
  1. <template>
  2. <view class="container">
  3. <view class="step-bar">
  4. <view>
  5. <view class="h-num">
  6. <view class="head-ball"
  7. :style="currentStep == 0 ? 'background-color: #fbe362;':'background-color: #91d224;color:#FFFFFF' ">
  8. <text>1</text>
  9. </view>
  10. </view>
  11. <view class="">账号查询</view>
  12. </view>
  13. <view>
  14. <u-icon name="more-dot-fill" color="#cccccc" size="28"></u-icon>
  15. </view>
  16. <view>
  17. <view class="h-num">
  18. <view class="head-ball"
  19. :style="currentStep == 1 ? 'background-color: #fbe362;':(currentStep == 0? 'background-color: #FFFFFF' :'background-color: #91d224;color:#FFFFFF' ) ">
  20. <text>2</text>
  21. </view>
  22. </view>
  23. <view class="">信息确认</view>
  24. </view>
  25. <view>
  26. <u-icon name="more-dot-fill" color="#cccccc" size="28"></u-icon>
  27. </view>
  28. <view>
  29. <view class="h-num">
  30. <view class="head-ball" :style="currentStep == 2 ? 'background-color: #fbe362;':'background-color: #FFFFFF' ">
  31. <text>3</text>
  32. </view>
  33. </view>
  34. <view class="">账号迁移</view>
  35. </view>
  36. </view>
  37. <view class="form">
  38. <view v-if="currentStep === 0" class="h-content-wrap">
  39. <u--form labelPosition="top" :model="userInfo" :rules="rules" ref="form1">
  40. <u-form-item labelWidth="auto" labelAlign="right" label="老系统手机号" prop="phone">
  41. <u--input v-model="userInfo.phone" disabledColor="#ffffff" placeholder="填写老系统电话" border="bottom"
  42. maxlength="11"></u--input>
  43. </u-form-item>
  44. <u-form-item label="老系统会员姓名" prop="memberName" labelPosition="top" labelWidth="auto" labelAlign="right">
  45. <u--input v-model="userInfo.memberName" disabledColor="#ffffff" placeholder="填写姓名" border="bottom"
  46. maxlength="16"></u--input>
  47. </u-form-item>
  48. <u-form-item label="当前手机号" prop="phonenumber" labelWidth="auto" labelAlign="right">
  49. <u--input v-model="userInfo.phonenumber" disabledColor="#ffffff" placeholder="填写当前手机号"
  50. border="bottom" maxlength="11"></u--input>
  51. </u-form-item>
  52. <u-form-item labelWidth="auto" labelAlign="right" label="验证码" prop="smsCode" width="120">
  53. <u--input v-model="userInfo.smsCode" disabledColor="#ffffff" placeholder="请输入验证码" border="bottom"
  54. maxlength="6"></u--input>
  55. <template #right>
  56. <view class="identifying-code">
  57. <u-code ref="uCode2" @change="codeChange2" keep-running start-text="获取验证码"></u-code>
  58. <text @tap="getCode2" :text="tips2" class="u-page__code-text">{{ tips2 }}</text>
  59. </view>
  60. </template>
  61. </u-form-item>
  62. </u--form>
  63. </view>
  64. <view v-if="currentStep === 1">
  65. <view class="h-content">
  66. <view class="h-basic-info">
  67. <view class="h-value">
  68. <view class="h-name">会员编号</view>
  69. <view class="h-text">{{ userMemberInfo.memberNo }}</view>
  70. </view>
  71. <view class="h-value">
  72. <view class="h-name">会员卡号</view>
  73. <view class="h-text">{{ userMemberInfo.memberCard }}</view>
  74. </view>
  75. <view class="h-value">
  76. <view class="h-name">会员姓名</view>
  77. <view class="h-text">{{ userMemberInfo.memberName }}</view>
  78. </view>
  79. <view class="h-value">
  80. <view class="h-name">手机号码</view>
  81. <view class="h-text">{{ userMemberInfo.phone }}</view>
  82. </view>
  83. <view class="h-value">
  84. <view class="h-name">积分</view>
  85. <view class="h-text">{{ userMemberInfo.integral }}</view>
  86. </view>
  87. <view class="h-value">
  88. <view class="h-name">账户余额</view>
  89. <view class="h-text">¥{{ userMemberInfo.nowBalance }}</view>
  90. </view>
  91. </view>
  92. <view class="h-record">
  93. <!-- 导航-->
  94. <view class="service-order-tab-bar">
  95. <view class="service-order-tab-item" :class="{ active: currentServiceTab === 'orderTab1' }"
  96. @click="changeServiceTab('orderTab1')">
  97. <text :class="{ underline: currentServiceTab === 'orderTab1' }">充值记录</text>
  98. </view>
  99. <view class="service-order-tab-item" :class="{ active: currentServiceTab === 'orderTab2' }"
  100. @click="changeServiceTab('orderTab2')">
  101. <text :class="{ underline: currentServiceTab === 'orderTab2' }">消费记录</text>
  102. </view>
  103. </view>
  104. <view class="custom-line"></view>
  105. <!-- order -->
  106. <view v-if="currentServiceTab == 'orderTab1' " class="store-order-wrap">
  107. <view v-for="(item, index) in memberInfoRecords" class="store-order">
  108. <view class="h-content">
  109. <view class="h-row">
  110. <view class="h-value">
  111. <text>储值记录</text>
  112. </view>
  113. <view class="h-value">
  114. <text>+ ¥{{ item.rechargeAmount }}</text>
  115. </view>
  116. </view>
  117. <view class="h-row">
  118. <view class="h-value">
  119. <text class="h-text">{{ item.rechargeTime }}</text>
  120. </view>
  121. <view class="h-value h-name">
  122. <text class="h-text">账户余额:¥{{ item.nowBalance }}</text>
  123. </view>
  124. </view>
  125. </view>
  126. <view class="custom-line"></view>
  127. </view>
  128. </view>
  129. <view v-if="currentServiceTab == 'orderTab2'" class="store-order-wrap">
  130. <view v-for="(item, index) in memberInfoRecords" class="store-order">
  131. <view class="h-content">
  132. <view class="h-row">
  133. <view class="h-value">
  134. <text>消费记录</text>
  135. </view>
  136. <view class="h-value">
  137. <text>- ¥{{ item.consumeAmount }}</text>
  138. </view>
  139. </view>
  140. <view class="h-row">
  141. <view class="h-value">
  142. <text class="h-text">{{ item.consumeTime }}</text>
  143. </view>
  144. <!-- <view class="h-value h-name">-->
  145. <!-- <text class="h-text">账户余额:¥{{ item.nowBalance }}</text>-->
  146. <!-- </view>-->
  147. </view>
  148. </view>
  149. <view class="custom-line"></view>
  150. </view>
  151. </view>
  152. </view>
  153. </view>
  154. </view>
  155. </view>
  156. <view v-if="currentStep === 2" class="">
  157. <view class="h-content-step-end">
  158. <view class="h-success">
  159. <u-icon name="checkmark" color="#5dac17" size="70"></u-icon>
  160. </view>
  161. <view class="h-name">
  162. <text>账户迁移成功</text>
  163. </view>
  164. <view @click="nextStep(3)" class="h-btn">
  165. <text>确认</text>
  166. </view>
  167. </view>
  168. </view>
  169. <view v-if="currentStep == 0" class="button-group">
  170. <!-- <button @click="prevStep" :disabled="currentStep === 0">上一步</button> -->
  171. <button class="h-btn" @click="open()" :disabled="currentStep === steps.length - 1">查询</button>
  172. </view>
  173. <view v-if="currentStep == 1" class="button-group">
  174. <button class="h-btn" style="background-color: #EEEEEE;width: 240rpx" @click="prevStep" :disabled="currentStep === 0">上一步</button>
  175. <view class="h-btn" @click="nextStep(2)" :disabled="currentStep === steps.length - 1">
  176. <text>确认并迁移</text>
  177. </view>
  178. </view>
  179. <!-- 普通弹窗 -->
  180. <view>
  181. <uni-popup ref="popup" :isMaskClick="false">
  182. <view class="popup-content">
  183. <text class="text" style="text-align: center">选择会员编号</text>
  184. <view v-for="item in numberList" >
  185. <view class="popupItem" :class="item.isSelect" @click="SelectItem(item.number)":style="item.nmbStatus == 1?'background-color: #93D21A;color:#FFFFFF': null">
  186. <view>
  187. <text>{{ item.number }}</text>
  188. </view>
  189. <view style="width:100rpx" >
  190. <text v-if="item.nmbStatus == 1 " style="text-align: right">已找回</text>
  191. </view>
  192. </view>
  193. </view>
  194. <view class="button-popup">
  195. <button class="h-btn" style="background-color: #EEEEEE;" @click="this.$refs.popup.close()" >取消</button>
  196. <view class="h-btn" style="background-color: #FFE05C;" @click="nextStep(0)" :disabled="currentStep === steps.length - 1">
  197. <text>确定</text>
  198. </view>
  199. </view>
  200. </view>
  201. </uni-popup>
  202. </view>
  203. </view>
  204. </template>
  205. <script>
  206. import signature from '../components/sign/sign';
  207. export default {
  208. components: {
  209. signature
  210. },
  211. data() {
  212. return {
  213. isSelect:false,
  214. isShow: true,
  215. showCanvas: false,
  216. numberList:[
  217. {number:'FJWOIU43294423',nmbStatus:0},
  218. {number:'ASDFGH43294423',nmbStatus:1},
  219. {number:'QWERTY43294423',nmbStatus:0}],
  220. currentStep: 0,
  221. steps: ['账户查询', '信息确认', '账户迁移'], // 步骤条的文字内容
  222. step1Value: '',
  223. step2Value: '',
  224. step3Value: '',
  225. userInfo: {
  226. auth: true,
  227. phone: '18231041846',
  228. memberName: '赵梓熠-测试',
  229. phonenumber: '18231041846',
  230. smsCode: '',
  231. memberNo: "",
  232. type: 7,
  233. requstForm: true
  234. },
  235. // 服务条款对象信息
  236. termOfService: {
  237. aboutContent: "<p>会员协议会员协议会员协议会员协议会员协议会员协议</p>",
  238. aboutType: "1",
  239. createBy: "admin",
  240. createTime: "2023-07-30 08:53:17",
  241. id: "1685574269874098178",
  242. status: "0",
  243. updateBy: "admin",
  244. updateTime: "2023-07-30 21:04:51"
  245. },
  246. userMemberInfo: {
  247. memberNo: "string",
  248. pingYinCode: "string",
  249. memberName: "string",
  250. integral: 0,
  251. sex: 0,
  252. birthday: "string",
  253. phone: "string",
  254. memberPassword: "string",
  255. height: "string",
  256. weight: "string",
  257. memberCard: "string",
  258. address: "string",
  259. nowBalance: 0,
  260. totalConsumeAmount: 0,
  261. debt: 0,
  262. remarks: "string",
  263. joinTime: "string",
  264. memberStatus: 0,
  265. referencesNo: "string",
  266. consumeCycle: "string",
  267. otherInfo: "string",
  268. photoUrl: "string"
  269. },
  270. memberInfoRecords: [{
  271. orderNo: "string",
  272. memberNo: "string",
  273. memberName: "string",
  274. phone: "string",
  275. consumeAmount: 0,
  276. realPayAmount: 0,
  277. profit: 0,
  278. integral: 0,
  279. remainDebt: 0,
  280. consumeTime: "string",
  281. remarks: "string",
  282. consumeStore: "string",
  283. consumeType: "string",
  284. discountAmount: 0,
  285. bedName: "string",
  286. payInfo: "string",
  287. memberStore: "string",
  288. payType: "string"
  289. }],
  290. show: false,
  291. currentTab: 'tab1', // 当前选中的 Tab
  292. currentServiceTab: 'orderTab1', // 当前选中的 Tab
  293. defaultColor: '#CCCCCC',
  294. currentColor: '#FF0000',
  295. completedColor: '#00FF00',
  296. content: '一、本人所提供的个人信息 证明材料、证件',
  297. signType: '',
  298. signImg1: '',
  299. tips2: '',
  300. rules: {
  301. phone: [
  302. {
  303. required: true,
  304. min: 10,
  305. max: 12,
  306. message: '请输入11位电话号码',
  307. trigger: ['blur', 'change'],
  308. },
  309. {
  310. // 此为同步验证,可以直接返回true或者false,如果是异步验证,稍微不同,见下方说明
  311. validator: (rule, value, callback) => {
  312. // 调用uView自带的js验证规则,详见:https://www.uviewui.com/js/test.html
  313. return !this.$isDataEmpty(value);
  314. },
  315. message: "请认真填写电话号码",
  316. trigger: ['blur', 'change'],
  317. }
  318. ],
  319. memberName: [
  320. {
  321. required: true,
  322. message: '请输入名字',
  323. trigger: ['blur', 'change'],
  324. },
  325. ],
  326. phonenumber: [
  327. {
  328. required: true,
  329. min: 10,
  330. max: 12,
  331. message: '请输入11位电话号码',
  332. trigger: ['blur', 'change'],
  333. },
  334. {
  335. // 此为同步验证,可以直接返回true或者false,如果是异步验证,稍微不同,见下方说明
  336. validator: (rule, value, callback) => {
  337. // 调用uView自带的js验证规则,详见:https://www.uviewui.com/js/test.html
  338. return !this.$isDataEmpty(value);
  339. },
  340. message: "请认真填写电话号码",
  341. trigger: ['blur', 'change'],
  342. }
  343. ],
  344. smsCode: {
  345. required: true,
  346. min: 4,
  347. max: 6,
  348. message: '请认真填写验证码',
  349. trigger: ['blur', 'change'],
  350. },
  351. },
  352. };
  353. },
  354. computed: {
  355. itemObject(num) {
  356. return (num) => ({
  357. backgroundColor: item.background,
  358. gridColumnStart: item.columnStart,
  359. gridColumnEnd: item.columnEnd,
  360. gridRowStart: item.rowStart,
  361. gridRowEnd: item.rowEnd
  362. })
  363. }
  364. },
  365. onLoad() {
  366. // 获取服务条款数据
  367. // this.getTermOfServiceByType();
  368. },
  369. onUnload() {
  370. if (this.timer) {
  371. clearTimeout(this.timer);
  372. this.timer = null;
  373. }
  374. },
  375. onReady() {
  376. this.$refs.form1.setRules(this.rules)
  377. },
  378. methods: {
  379. SelectItem(data){
  380. console.log(data,'selectItem')
  381. },
  382. // 关闭签名框
  383. closeCanvas() {
  384. this.showCanvas = false;
  385. },
  386. // 选择签名类型
  387. personSing(type) {
  388. this.showCanvas = true;
  389. this.signType = type;
  390. },
  391. // 保存签名信息
  392. saveCanvasImg(path) {
  393. console.log(path)
  394. let that = this;
  395. uni.uploadFile({
  396. url: this.$host + '/resource/oss/upload', //仅为示例,非真实的接口地址
  397. filePath: path,
  398. name: 'file',
  399. header: {
  400. 'Authorization': 'Bearer ' + that.$store.state.loginState.accessToken,
  401. },
  402. success: (uploadFileRes) => {
  403. let res = JSON.parse(uploadFileRes.data)
  404. console.log(res)
  405. that.showCanvas = false;
  406. }
  407. });
  408. },
  409. codeChange2(text) {
  410. this.tips2 = text;
  411. },
  412. getCode2() {
  413. if (this.$refs.uCode2.canGetCode) {
  414. this.getSmsCode();
  415. } else {
  416. uni.$u.toast('倒计时结束后再发送');
  417. }
  418. },
  419. // 获取手机验证码
  420. getSmsCode() {
  421. // 模拟向后端请求验证码
  422. uni.showLoading({
  423. title: '正在获取验证码'
  424. })
  425. this.$api.getSmsCode({phonenumber: this.userInfo.phone, auth: true}).then((res) => {
  426. uni.hideLoading();
  427. // 这里此提示会被this.start()方法中的提示覆盖
  428. uni.$u.toast('验证码已发送');
  429. // 通知验证码组件内部开始倒计时
  430. this.$refs.uCode2.start();
  431. }).catch(() => {
  432. uni.showToast({
  433. title: "操作失败"
  434. })
  435. });
  436. },
  437. getStepClass(index) {
  438. if (index < this.currentStep) {
  439. return 'step';
  440. } else if (index === this.currentStep) {
  441. return ['step', 'active'];
  442. } else {
  443. return ['step', 'default'];
  444. }
  445. },
  446. // 查询老会员系统数据
  447. getOldMember() {
  448. this.$api.getOldMember(this.userInfo).then((res) => {
  449. if (!!res) {
  450. this.userMemberInfo = res.data.data;
  451. this.userInfo.memberNo = res.data.data.memberNo;
  452. } else {
  453. uni.$u.toast('未查询到数据');
  454. }
  455. // 查询充值记录
  456. this.getOrderRechargeOldList();
  457. this.timer = setTimeout(() => {
  458. if (this.currentStep < this.steps.length - 1) {
  459. this.currentStep++;
  460. }
  461. }, 0)
  462. }).catch((res) => {
  463. uni.showToast({
  464. title: "操作失败"
  465. })
  466. });
  467. },
  468. // 查询会员消费记录
  469. getOrderConsumeLogOld() {
  470. this.$api.getOrderConsumeLogOld(this.userInfo).then((res) => {
  471. this.memberInfoRecords = res.data.data;
  472. }).catch(() => {
  473. uni.showToast({
  474. title: "操作失败"
  475. })
  476. });
  477. },
  478. // 查询叶会员充值记录
  479. getOrderRechargeOldList() {
  480. this.$api.getOrderRechargeOldList(this.userInfo).then((res) => {
  481. this.memberInfoRecords = res.data.data;
  482. }).catch(() => {
  483. uni.showToast({
  484. title: "操作失败"
  485. })
  486. });
  487. },
  488. // 提交保存
  489. submitOldData() {
  490. console.log(this.userInfo.memberNo)
  491. this.userInfo.memberNo = '18902'
  492. this.$api.submitOldData(this.userInfo).then((res) => {
  493. console.log(res)
  494. if (this.currentStep < this.steps.length - 1) {
  495. this.currentStep++;
  496. }
  497. }).catch(() => {
  498. uni.showToast({
  499. title: "操作失败"
  500. })
  501. });
  502. },
  503. open(){
  504. this.$refs.popup.open()
  505. },
  506. nextStep(idx) {
  507. if (idx == 0) { // 查询数据
  508. this.$refs.popup.close()
  509. console.log(this.$refs.form1.validate(), '2222222222')
  510. this.$refs.form1.validate().then(res => {
  511. this.getOldMember();
  512. }).catch(errors => {
  513. uni.$u.toast('校验失败,请认真填写')
  514. })
  515. }
  516. if (idx == 1) { // 显示查询数据
  517. if (this.currentStep < this.steps.length - 1) {
  518. this.currentStep++;
  519. }
  520. }
  521. if (idx == 2) { // 用户签名确认
  522. this.submitOldData();
  523. }
  524. if (idx == 3) { // 迁移成功,重新设置用户数据
  525. uni.switchTab({
  526. url: '/pages/index/index',
  527. })
  528. }
  529. },
  530. prevStep() {
  531. if (this.currentStep > 0) {
  532. this.currentStep--;
  533. }
  534. },
  535. changeTab(tab) {
  536. this.currentTab = tab;
  537. },
  538. // 服务订单
  539. changeServiceTab(tab) {
  540. if (tab == 'orderTab1') {
  541. this.getOrderRechargeOldList();
  542. } else if (tab == 'orderTab2') {
  543. this.getOrderConsumeLogOld();
  544. }
  545. this.currentServiceTab = tab;
  546. },
  547. // 获取服务条款信息
  548. getTermOfServiceByType() {
  549. // 获取数据
  550. this.$api.getTermOfServiceByType({data: this.userInfo}).then((res) => {
  551. if (res.aboutContent) {
  552. this.termOfService.aboutContent = res.aboutContent
  553. } else {
  554. this.termOfService.aboutContent = "暂无信息!!!"
  555. }
  556. }).catch(() => {
  557. uni.showToast({
  558. title: "操作失败"
  559. })
  560. });
  561. },
  562. }
  563. };
  564. </script>
  565. <style scoped lang="scss">
  566. @import './index.rpx.scss';
  567. </style>