index.vue 20 KB

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