index.vue 21 KB

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