message.vue 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583
  1. <template>
  2. <view class="message">
  3. <view class="top" style="background: linear-gradient(rgb(254,245,246), #FBF7F7); color: black;">
  4. <!-- #ifdef MP || APP-PLUS -->
  5. <view class="sys-head">
  6. <view class="sys-bar" :style="{ height: sysHeight }"></view>
  7. <!-- #ifdef MP -->
  8. <view class="sys-title" :style="member_style == 3 ? 'color:#333' : ''">消息</view>
  9. <!-- #endif -->
  10. <view class="bg" :style="member_style == 3 ? 'background:#f5f5f5' : ''"></view>
  11. </view>
  12. <!-- #endif -->
  13. </view>
  14. <view class="header-group">
  15. <view class="tabs">
  16. <u-tabs class="defalt-utabs" :is-scroll="false" :list="navigationList" @change="changeNav" lineColor="#B22338"
  17. :inactiveStyle="{ color: '#999999' }" :activeStyle="{ color: '#B22338', fontWeight: 'bold' }"
  18. keyName="title"></u-tabs>
  19. </view>
  20. </view>
  21. <view v-if="activeTab === 'normal-msg'">
  22. <view class="myclient_list">
  23. <view class="myclient_list_name">
  24. 订单已提货
  25. </view>
  26. <view class="myclient_list_content">
  27. <view class="phone">
  28. <image referrerpolicy="no-referrer" src="http://www.gzzzyd.com/groupon/home_slices/出厂编号-线@2x.png" />
  29. <text>
  30. 订单编号:02151510202151510104649898926
  31. </text>
  32. </view>
  33. <view class="time">
  34. <image referrerpolicy="no-referrer" src="http://www.gzzzyd.com/groupon/home_slices/时间@2x.png" />
  35. <text>
  36. 绑定时间:2023/04/26&nbsp;21:45:00
  37. </text>
  38. </view>
  39. </view>
  40. </view>
  41. <view class="myclient_list">
  42. <view class="myclient_list_name">
  43. 订单付款成功,付款方式[微信]
  44. </view>
  45. <view class="myclient_list_content">
  46. <view class="phone">
  47. <image referrerpolicy="no-referrer" src="http://www.gzzzyd.com/groupon/home_slices/出厂编号-线@2x.png" />
  48. <text>
  49. 订单编号:02151510202151510104649898926
  50. </text>
  51. </view>
  52. <view class="time">
  53. <image referrerpolicy="no-referrer" src="http://www.gzzzyd.com/groupon/home_slices/时间@2x.png" />
  54. <text>
  55. 绑定时间:2023/04/26&nbsp;21:45:00
  56. </text>
  57. </view>
  58. </view>
  59. </view>
  60. <view class="myclient_list">
  61. <view class="myclient_list_name">
  62. 订单已提货
  63. </view>
  64. <view class="myclient_list_content">
  65. <view class="phone">
  66. <image referrerpolicy="no-referrer" src="http://www.gzzzyd.com/groupon/home_slices/出厂编号-线@2x.png" />
  67. <text>
  68. 订单编号:02151510202151510104649898926
  69. </text>
  70. </view>
  71. <view class="time">
  72. <image referrerpolicy="no-referrer" src="http://www.gzzzyd.com/groupon/home_slices/时间@2x.png" />
  73. <text>
  74. 绑定时间:2023/04/26&nbsp;21:45:00
  75. </text>
  76. </view>
  77. </view>
  78. </view>
  79. </view>
  80. <view v-if="activeTab === 'sys-msg'">
  81. <view class="myclient_list2">
  82. <view class="myclient_list_name">
  83. 我是系统公告标题
  84. </view>
  85. <view class="myclient_list_content">
  86. <view class="content">
  87. <text>
  88. 瀛洲学士风流远,中叶唐惭贞观唐。灵武拾遗晚羁旅,开元供奉老佯狂。
  89. </text>
  90. </view>
  91. <view class="time">
  92. <image referrerpolicy="no-referrer" src="http://www.gzzzyd.com/groupon/home_slices/时间@2x.png" />
  93. <text>
  94. 绑定时间:2023/04/26&nbsp;21:45:00
  95. </text>
  96. </view>
  97. </view>
  98. </view>
  99. <view class="myclient_list2">
  100. <view class="myclient_list_name">
  101. 我是系统公告标题
  102. </view>
  103. <view class="myclient_list_content">
  104. <view class="content">
  105. <text>
  106. 瀛洲学士风流远,中叶唐惭贞观唐。灵武拾遗晚羁旅,开元供奉老佯狂。
  107. 瀛洲学士风流远,中叶唐惭贞观唐。灵武拾遗晚羁旅,开元供奉老佯狂。
  108. </text>
  109. </view>
  110. <view class="time">
  111. <image referrerpolicy="no-referrer" src="http://www.gzzzyd.com/groupon/home_slices/时间@2x.png" />
  112. <text>
  113. 绑定时间:2023/04/26&nbsp;21:45:00
  114. </text>
  115. </view>
  116. </view>
  117. </view>
  118. <view class="myclient_list2">
  119. <view class="myclient_list_name">
  120. 我是系统公告标题
  121. </view>
  122. <view class="myclient_list_content">
  123. <view class="content">
  124. <text>
  125. 瀛洲学士风流远,中叶唐惭贞观唐。灵武拾遗晚羁旅,开元供奉老佯狂。
  126. 瀛洲学士风流远,中叶唐惭贞观唐。灵武拾遗晚羁旅,开元供奉老佯狂。
  127. 瀛洲学士风流远,中叶唐惭贞观唐。灵武拾遗晚羁旅,开元供奉老佯狂。
  128. </text>
  129. </view>
  130. <view class="time">
  131. <image referrerpolicy="no-referrer" src="http://www.gzzzyd.com/groupon/home_slices/时间@2x.png" />
  132. <text>
  133. 绑定时间:2023/04/26&nbsp;21:45:00
  134. </text>
  135. </view>
  136. </view>
  137. </view>
  138. </view>
  139. </view>
  140. </template>
  141. <script>
  142. let sysHeight = uni.getSystemInfoSync().statusBarHeight + 'px';
  143. import {
  144. grabFlag,
  145. leaderboard,
  146. doGrab,
  147. todayStatistics
  148. } from '@/api/home.js';
  149. import {
  150. getProductHot,
  151. collectAll,
  152. getProductDetail
  153. } from '@/api/store.js';
  154. import {
  155. toLogin
  156. } from '@/libs/login.js';
  157. import {
  158. mapGetters
  159. } from "vuex";
  160. import recommend from '@/components/recommend';
  161. import productWindow from '@/components/productWindow';
  162. // #ifdef MP
  163. import authorize from '@/components/Authorize';
  164. // #endif
  165. import pageFooter from '@/components/pageFooter/index.vue'
  166. import colors from "@/mixins/color";
  167. import {
  168. HTTP_REQUEST_URL
  169. } from '@/config/app';
  170. const hot_res = require('@/mock/json/hot_res.json')
  171. import {
  172. getNavigation
  173. } from '@/api/public.js'
  174. import {
  175. colorChange
  176. } from '../../api/api';
  177. export default {
  178. components: {
  179. pageFooter,
  180. recommend,
  181. productWindow,
  182. // #ifdef MP
  183. authorize
  184. // #endif
  185. },
  186. mixins: [colors],
  187. data () {
  188. return {
  189. isactiveTab: 'todayRank',
  190. grabFlagisOpen: false,
  191. grabAmountFlag: false,
  192. show: false,
  193. userInfo: {},
  194. activeRedPer: {
  195. type: 0
  196. },
  197. navigationList: [{
  198. title: '个人消息',
  199. id: 'normal-msg'
  200. }, {
  201. title: '系统公告',
  202. id: 'sys-msg'
  203. }],
  204. imgHost: HTTP_REQUEST_URL,
  205. is_diy: uni.getStorageSync('is_diy'),
  206. canShow: false,
  207. cartCount: 0,
  208. goodsHidden: true,
  209. footerswitch: true,
  210. hostProduct: [],
  211. cartList: {
  212. valid: [],
  213. invalid: []
  214. },
  215. selectCountPrice: 0.00,
  216. isShowAuth: false, //是否隐藏授权
  217. hotScroll: false,
  218. hotPage: 1,
  219. hotLimit: 10,
  220. loading: false,
  221. loadend: false,
  222. loadTitle: this.$t(`我也是有底线的`), //提示语
  223. page: 1,
  224. limit: 20,
  225. loadingInvalid: false,
  226. loadTitleInvalid: this.$t(`加载更多`), //提示语
  227. pageInvalid: 1,
  228. limitInvalid: 20,
  229. attr: {
  230. cartAttr: false,
  231. productAttr: [],
  232. productSelect: {}
  233. },
  234. rankList: [],
  235. redPaper: [],
  236. productValue: [], //系统属性
  237. storeInfo: {},
  238. attrValue: '', //已选属性
  239. attrTxt: this.$t(`请选择`), //属性页面提示
  240. cartId: 0,
  241. product_id: 0,
  242. sysHeight: sysHeight,
  243. newData: {},
  244. activeRouter: '',
  245. activeTab: 'normal-msg',
  246. is_diy_set: false
  247. };
  248. },
  249. computed: mapGetters(['isLogin']),
  250. onPullDownRefresh () {
  251. this.grabFlag()
  252. console.log('下拉刷新');
  253. },
  254. onLoad (options) {
  255. let that = this;
  256. if (that.isLogin == false) {
  257. toLogin();
  258. }
  259. let routes = getCurrentPages(); // 获取当前打开过的页面路由数组
  260. let curRoute = routes[routes.length - 1].route //获取当前页面路由
  261. this.activeRouter = '/' + curRoute
  262. },
  263. onShow () {
  264. },
  265. created () {
  266. this.userInfo = JSON.parse(this.$Cache.get("USER_INFO"));
  267. console.log(this.userInfo, this.userInfo.avatar);
  268. this.grabFlag('created')
  269. this.leaderboard()
  270. this.todayStatistics()
  271. },
  272. methods: {
  273. changeNav (index) {
  274. console.log(index);
  275. this.activeTab = index.id
  276. },
  277. goReceived () {
  278. uni.navigateTo({
  279. url: '/pages/order_addcart/wallet_received/index'
  280. })
  281. },
  282. goMissed () {
  283. uni.navigateTo({
  284. url: '/pages/order_addcart/wallet_missed/index'
  285. })
  286. },
  287. // 授权关闭
  288. authColse: function (e) {
  289. this.isShowAuth = e;
  290. },
  291. leaderboard () {
  292. let that = this
  293. uni.showLoading({
  294. title: this.$t(`加载中`),
  295. mask: true
  296. });
  297. let postData = {
  298. flag: this.isactiveTab === 'todayRank' ? 1 : 0
  299. }
  300. leaderboard(postData).then(res => {
  301. if (res.data.length > 0) {
  302. that.$set(that, "rankList", res.data)
  303. } else {
  304. that.$set(that, "rankList", [])
  305. }
  306. uni.hideLoading();
  307. })
  308. },
  309. doGrab () {
  310. doGrab({
  311. type: this.activeRedPer.type
  312. }).then(res => {
  313. // if (res.code === 200) {
  314. // this.grabFlag('dograbAmountFlag')
  315. // }
  316. this.currentRedpaper = res.data
  317. this.grabAmountFlag = true
  318. this.grabFlag('dograbAmountFlag')
  319. })
  320. },
  321. grabFlag (params) {
  322. grabFlag().then(res => {
  323. this.redPaper = res.data
  324. if (!params) {
  325. this.grabAmountFlag = false
  326. }
  327. if (params === 'created') {
  328. this.activeRedPer = res.data[0]
  329. let flag = this.redPaper.filter((e) => {
  330. return e.flag === 1;
  331. }).length
  332. console.log(flag, this.activeRedPer);
  333. if (flag === 0) {
  334. this.show = false
  335. uni.stopPullDownRefresh();
  336. return
  337. }
  338. }
  339. this.show = true
  340. uni.stopPullDownRefresh();
  341. })
  342. },
  343. todayStatistics () {
  344. uni.showLoading({
  345. title: this.$t(`加载中`),
  346. mask: true
  347. });
  348. let postData = {
  349. flag: this.isactiveTab === 'todayRank' ? 1 : 0
  350. }
  351. todayStatistics().then(res => {
  352. this.moneyObj = res.data
  353. uni.hideLoading();
  354. })
  355. },
  356. /**
  357. * 购物车手动填写
  358. *
  359. */
  360. iptCartNum: function (e) {
  361. this.$set(this.attr.productSelect, 'cart_num', e);
  362. },
  363. inArray: function (search, array) {
  364. for (let i in array) {
  365. if (array[i] == search) {
  366. return true;
  367. }
  368. }
  369. return false;
  370. },
  371. switchSelect: function () {
  372. let that = this;
  373. let validList = that.cartList.valid;
  374. let selectValue = that.selectValue;
  375. let selectCountPrice = 0.00;
  376. if (selectValue.length < 1) {
  377. that.selectCountPrice = selectCountPrice;
  378. } else {
  379. for (let index in validList) {
  380. if (that.inArray(validList[index].id, selectValue)) {
  381. selectCountPrice = that.$util.$h.Add(selectCountPrice, that.$util.$h.Mul(validList[index]
  382. .cart_num, validList[
  383. index].truePrice))
  384. }
  385. }
  386. that.selectCountPrice = selectCountPrice;
  387. }
  388. },
  389. getInvalidList: function () {
  390. let that = this;
  391. if (this.loadendInvalid) return false;
  392. if (this.loadingInvalid) return false;
  393. let data = {
  394. page: that.pageInvalid,
  395. limit: that.limitInvalid,
  396. status: 0
  397. }
  398. let resData = {
  399. "valid": [],
  400. "invalid": [],
  401. "deduction": {
  402. "seckill_id": 0,
  403. "bargain_id": 0,
  404. "combination_id": 0,
  405. "discount_id": 0
  406. }
  407. }
  408. // getCartList(data).then(res => {
  409. let cartList = resData,
  410. invalid = cartList.invalid,
  411. loadendInvalid = invalid.length < that.limitInvalid;
  412. let invalidList = that.$util.SplitArray(invalid, that.cartList.invalid);
  413. that.$set(that.cartList, 'invalid', invalidList);
  414. that.loadendInvalid = loadendInvalid;
  415. that.loadTitleInvalid = loadendInvalid ? that.$t(`我也是有底线的`) : that.$t(`加载更多`);
  416. that.pageInvalid = that.pageInvalid + 1;
  417. that.loadingInvalid = false;
  418. // }).catch(res => {
  419. // that.loadingInvalid = false;
  420. // that.loadTitleInvalid = that.$t(`加载更多`);
  421. // })
  422. },
  423. getHostProduct: function () {
  424. let that = this;
  425. if (that.hotScroll) return
  426. that.hotPage++
  427. that.hotScroll = hot_res.length < that.hotLimit
  428. that.hostProduct = that.hostProduct.concat(hot_res)
  429. },
  430. },
  431. onReachBottom () {
  432. let that = this;
  433. if (that.loadend) {
  434. that.getInvalidList();
  435. }
  436. if (that.cartList.valid.length == 0 && that.cartList.invalid.length == 0) {
  437. that.getHostProduct();
  438. }
  439. }
  440. }
  441. </script>
  442. <style scoped lang="scss">
  443. .message {
  444. display: flex;
  445. flex-direction: column;
  446. height: 100%;
  447. .sys-head {
  448. position: relative;
  449. width: 100%;
  450. // background: linear-gradient(90deg, $bg-star1 0%, $bg-end1 100%);
  451. .bg {
  452. position: absolute;
  453. left: 0;
  454. top: 0;
  455. width: 100%;
  456. height: 100%;
  457. background: var(--view-theme);
  458. background-size: 100% auto;
  459. background-position: left bottom;
  460. }
  461. .sys-title {
  462. z-index: 10;
  463. position: relative;
  464. height: 43px;
  465. text-align: left;
  466. line-height: 43px;
  467. font-size: 36rpx;
  468. color: rgba(17, 17, 17, 1);
  469. font-weight: bolder;
  470. padding-left: 36rpx;
  471. }
  472. }
  473. }
  474. .myclient_list {
  475. margin-top: 30rpx;
  476. width: 750rpx;
  477. min-height: 220rpx;
  478. padding: 30rpx;
  479. background: #FFFFFF;
  480. .myclient_list_name {
  481. margin-bottom: 15rpx;
  482. height: 44rpx;
  483. font-size: 28rpx;
  484. font-weight: 500;
  485. color: #111111;
  486. line-height: 44rpx;
  487. }
  488. .myclient_list_content {
  489. image {
  490. width: 24rpx;
  491. height: 24rpx;
  492. margin-right: 20rpx;
  493. }
  494. .phone {
  495. margin-bottom: 15rpx;
  496. height: 44rpx;
  497. font-size: 24rpx;
  498. font-weight: 400;
  499. color: #999999;
  500. line-height: 44rpx;
  501. }
  502. .time {
  503. height: 44rpx;
  504. font-size: 24rpx;
  505. font-weight: 400;
  506. color: #999999;
  507. line-height: 44rpx;
  508. }
  509. }
  510. }
  511. .myclient_list2 {
  512. margin-top: 30rpx;
  513. width: 750rpx;
  514. min-height: 220rpx;
  515. padding: 30rpx;
  516. background: #FFFFFF;
  517. .myclient_list_name {
  518. margin-bottom: 15rpx;
  519. font-size: 28rpx;
  520. font-weight: 500;
  521. color: #111111;
  522. line-height: 44rpx;
  523. }
  524. .myclient_list_content {
  525. image {
  526. width: 24rpx;
  527. height: 24rpx;
  528. margin-right: 20rpx;
  529. }
  530. .content {
  531. margin-bottom: 15rpx;
  532. font-size: 28rpx;
  533. font-weight: 400;
  534. color: #666666;
  535. }
  536. .time {
  537. height: 44rpx;
  538. font-size: 24rpx;
  539. font-weight: 400;
  540. color: #999999;
  541. line-height: 44rpx;
  542. }
  543. }
  544. }
  545. </style>