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