| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651 |
- <template>
- <view class="container">
- <view class="content-box">
- <view class="user-section">
- <view class="avatar" @click="navTo('/pages/set/userinfo')">
- <image class="image" :src="user.avatar|| urlFile+`/static/error/missing-face.png`"
- mode="scaleToFill"></image>
- </view>
- <view class="flex-center phone">
- <template v-if="user.phone">
- {{((''+user.phone).split('').splice(3,4,'****')).join('')}}
- </template>
- </view>
- <view class="tj-sction">
- <view class="tj-item" @click="navTo('/pages/user_home/award/award')">
- <text class="num">{{ user.brokerage_price || '0.00' }}</text>
- <text>我的佣金</text>
- </view>
- <view class="tj-item" @click="navTo('/pages/user_home/money/wallet')">
- <text class="num">{{user.now_money || '0.00' }}</text>
- <text>我的卡券</text>
- </view>
- </view>
- </view>
- <view class="cover-container">
- <view class="item-box">
- <view class="box-title flex">
- <view class="title"><text>我的订单</text></view>
- <view class="link flex" @click="navTo('/pages/order/order?state=0')" hover-class="common-hover">
- <text class="margin-r-10">全部</text>
- <image class="img" src="../../static/icon/next1.png" mode="widthFix"></image>
- </view>
- </view>
- <view class="order-section">
- <view class="order-item" @click="navTo('/pages/order/order?state=0')" hover-class="common-hover"
- :hover-stay-time="50">
- <view class=" icon position-relative">
- <image class="icon-img" src="../../static/icon/userorder1.png" mode="aspectFit">
- </image>
- <view class="corner" v-if="user.unpaid_count > 0">
- <text>{{ user.unpaid_count }}</text>
- </view>
- </view>
- <text>待付款</text>
- </view>
- <view class="order-item" @click="navTo('/pages/order/order?state=1')" hover-class="common-hover"
- :hover-stay-time="50">
- <view class="icon position-relative">
- <image class="icon-img" src="../../static/icon/userorder2.png" mode="aspectFit">
- </image>
- <view class="corner" v-if="user.received_count > 0">
- <text>{{ user.received_count }}</text>
- </view>
- </view>
- <text>待核销</text>
- </view>
- <view class="order-item" @click="navTo('/pages/order/order?state=3')" hover-class="common-hover"
- :hover-stay-time="50">
- <view class=" icon position-relative">
- <image class="icon-img" src="../../static/icon/userorder3.png" mode="aspectFit">
- </image>
- </view>
- <text>已完成</text>
- </view>
- </view>
- </view>
- <view class="listBox">
- <view class="list">
- <view class="flex listItem" @click="navTo('/pages/user_home/myRent')">
- <view class="flex titleBox">
- <image class="listIconImg" src="../../static/icon/in1.png" mode="widthFix"></image>
- <text class="title">我的电池</text>
- </view>
- <view class="right flex">
- <text></text>
- <image class="img" src="../../static/icon/next1.png" mode="widthFix"></image>
- </view>
- </view>
- <view class="flex listItem" @click="smsh" v-if="userInfo && userInfo.adminid == 1">
- <view class="flex titleBox">
- <image class="listIconImg" src="../../static/icon/userhx.png" mode="widthFix"></image>
- <text class="title">核销</text>
- </view>
- <view class="right flex">
- <text></text>
- <image class="img" src="../../static/icon/next1.png" mode="widthFix"></image>
- </view>
- </view>
- <view class="flex listItem" @click="navTo('/pages/shop/attestation')"
- v-if="userInfo && userInfo.is_real != 1">
- <view class="flex titleBox">
- <image class="listIconImg" src="../../static/icon/userreal.png" mode="widthFix"></image>
- <text class="title">实名认证</text>
- </view>
- <view class="right flex">
- <text></text>
- <image class="img" src="../../static/icon/next1.png" mode="widthFix"></image>
- </view>
- </view>
- <button hover-class="none" class="flex listItem" open-type='contact'>
- <view class="flex titleBox">
- <image class="listIconImg" src="../../static/icon/userkf.png" mode="widthFix"></image>
- <text class="title">客服</text>
- </view>
- <view class="right flex">
- <text></text>
- <image class="img" src="../../static/icon/next1.png" mode="widthFix"></image>
- </view>
- </button>
- <view class="flex listItem" @click="navTo('/pages/user/shareQrCode')">
- <view class="flex titleBox">
- <image class="listIconImg" src="../../static/icon/usergg.png" mode="widthFix"></image>
- <text class="title">邀请好友</text>
- </view>
- <view class="right flex">
- <text></text>
- <image class="img" src="../../static/icon/next1.png" mode="widthFix"></image>
- </view>
- </view>
- <view class="flex listItem" @click="navTo('/pages/set/set')">
- <view class="flex titleBox">
- <image class="listIconImg" src="../../static/icon/userset.png" mode="widthFix"></image>
- <text class="title">设置</text>
- </view>
- <view class="right flex">
- <text></text>
- <image class="img" src="../../static/icon/next1.png" mode="widthFix"></image>
- </view>
- </view>
- </view>
- </view>
- </view>
- </view>
- <!-- 核销弹窗 -->
- <uni-popup ref="popuphx" class="agree-wrapper">
- <view class="hx-wrapper">
- <view class="hx-img">
- <image src="../../static/img/hxbg.png" mode=""></image>
- </view>
- <view class="hx-body">
- <view class="nav-hx">
- <text @click="hxtype = 0" :class="{'action': hxtype == 0}">商品核销</text ><text @click="hxtype = 1" :class="{'action': hxtype ==1}">电池核销</text>
- </view>
- <!-- <view class="hx-title">
- 核销码
- </view> -->
- <input type="text" v-model="code" placeholder="请输入核销码" placeholder-class="hx-placeholder" />
- <!-- <image src="../../static/icon/scend.png" mode=""></image> -->
- <input type="text" v-model="dcode" placeholder="请输入电池编号" placeholder-class="hx-placeholder" v-if="hxtype == 1"/>
- <view class="hx-btn" @click="qhx">
- 立即核销
- </view>
- </view>
- <view class="hx-close" @click="close">
- <image src="../../static/icon/close.png" mode=""></image>
- </view>
- </view>
- </uni-popup>
- </view>
- </template>
- <script>
- import weixinObj from "@/plugin/jweixin-module/index.js";
- import {
- mapState,
- mapMutations
- } from 'vuex';
- import {
- share
- } from '@/api/wx';
- import {
- getUser
- } from '@/api/user.js';
- import {
- articleList,
- notify,
- rentVerific,
- orderVerific
- } from '@/api/index.js';
- import {
- saveUrl,
- interceptor
- } from '@/utils/loginUtils.js';
- export default {
- data() {
- return {
- hxLoading: false,
- hxtype: 0, //0普通核销1电池核销
- dcode: '', //电池编号
- code: '', //商品核销码
- user: {
- avatar: '', //头像
- nickname: '', //昵称
- phone: ''
- },
- shareData: {}
- };
- },
- computed: {
- ...mapState('user', ['userInfo', 'orderInfo', 'hasLogin']),
- ...mapState(['baseURL', 'urlFile']),
- ...mapState(['fx']),
- // 总消息条数
- notic() {
- return this.user.question_sum + this.user.notice_sum;
- },
- },
- // 创建时获取分享信息
- onLoad() {
- // share().then((res) => {
- // this.shareData = res.data.data
- // }).catch((res) => {
- // console.log(res, '分享加载失败');
- // })
- },
- onShow() {
- this.getUser();
- },
- methods: {
- ...mapMutations('user', ['setUserInfo']),
- qhx() {
- let that = this
- if (that.hxLoading) {
- return
- }
- if (that.code == '') {
- return that.$api.msg('请输入核销码')
- }
- if (that.hxtype == 0) {
- that.hxLoading = true
- orderVerific({
- verify_code: that.code,
- is_confirm: 1
- }).then(res => {
- uni.showToast({
- title: '核销成功',
- mask: true,
- duration: 1500
- });
- that.close()
- that.hxLoading = false
- }).catch(err => [
- that.hxLoading = false
- ])
- } else {
- if (that.dcode == '') {
- return that.$api.msg('请输入电池编号')
- }
- that.hxLoading = false
- rentVerific({
- verify_code: that.code,
- battery_number: that.dcode,
- is_confirm: 1
- }).then(res => {
- uni.showToast({
- title: '核销成功',
- mask: true,
- duration: 1500
- });
- that.close()
- that.hxLoading = false
- })
- }
- },
- openHx() {
- this.$refs.popuphx.open()
- },
- close() {
- this.code == ''
- this.dcode == ''
- this.$refs.popuphx.close()
- },
- // 扫码
- smsh() {
- let that = this
- // #ifdef H5
- try {
- weixinObj.scanQRCode({
- needResult: 1, // 默认为0,扫描结果由微信处理,1则直接返回扫描结果,
- scanType: ["qrCode", "barCode"], // 可以指定扫二维码还是一维码,默认二者都有
- success: function(res) {
- var result = res.resultStr; // 当needResult 为 1 时,扫码返回的结果
- that.code = result
- that.openHx()
- // 判断是否为电池核销
-
- }
- });
- } catch (err) {
- console.log(err)
- that.openHx()
- }
- // #endif
- // #ifndef H5
- uni.scanCode({
- success: (res) => {
- let result = res.result
- that.code = result
- that.openHx()
- }
- })
- // #endif
- },
- // 跳转卡片页面
- navcard() {
- // 判断是否已经认证
- if (this.user.work_type_id <= 0) {
- this.navTo('/pages/user/model/modelrz')
- } else {
- if (this.user.show_template_id) {
- this.navTo('/pages/user/model/model?mtype=' + this.user.show_template_id + '&look=1')
- } else {
- this.navTo('/pages/user/model/model')
- }
- }
- },
- //#ifdef APP
- shareDomApp() {
- uni.share({
- provider: 'weixin',
- type: 0,
- title: '母婴界严选',
- summary: '',
- imageUrl: this.shareData.img,
- href: this.baseURL + this.urlFile + '/pages/public/register?spread=' + this.userInfo.uid
- })
- },
- //#endif
- // 获取用户数据
- getUser() {
- console.log('data')
- const that = this;
- getUser({}).then((e) => {
- this.user = e.data;
- this.setUserInfo(e.data)
- }).catch((e) => {
- console.log(e, 'sj');
- })
- // 系统消息
- // articleList({}, 1).then((e) => {
- // that.user.question_sum = e.data.count
- // console.log(that, 1);
- // }).catch((e) => {
- // console.log(e);
- // })
- // 报警消息
- // notify().then((e) => {
- // that.user.notice_sum = e.data.count
- // }).catch((e) => {
- // console.log(e);
- // })
- },
- changeTab() {
- this.$emit('tab', true)
- },
- navTo(url) {
- console.log(this.hasLogin, 'this.hasLogin');
- if (!this.hasLogin) {
- // 保存地址
- saveUrl();
- // 登录拦截
- interceptor();
- } else {
- uni.navigateTo({
- url,
- fail(e) {
- console.log(e);
- }
- });
- }
- },
- }
- };
- </script>
- <style lang="scss">
- %section {
- display: flex;
- justify-content: space-around;
- align-content: center;
- border-radius: 10rpx;
- }
- %flex-center {
- display: flex;
- flex-direction: column;
- justify-content: center;
- align-items: center;
- }
- .listBox {
- margin-top: 20rpx;
- overflow: hidden;
- }
- .list {
- .listItem {
- padding: 35rpx 40rpx;
- margin-bottom: 15rpx;
- background-color: #FFFFFF;
- border-radius: 20rpx;
- border: none;
- line-height: 1;
- &::after {
- border: none;
- }
- }
- .listIconImg {
- width: 36rpx;
- height: 36rpx;
- }
- .right {
- .img {
- width: 26rpx;
- }
- }
- .titleBox {
- .title {
- padding-left: 20rpx;
- color: $font-color-base;
- font-size: $font-base;
- }
- }
- }
- .container {
- background-color: $page-color-base;
- background-image: url('../../static/image/userbg.png');
- background-repeat: no-repeat;
- background-size: 100% auto;
- padding-top: 100rpx;
- padding-bottom: 50rpx;
- }
- .user-section {
- background-color: #FFF;
- border-radius: 20rpx;
- margin: 0 $page-row-spacing;
- padding: 40rpx 0;
- .avatar {
- width: 130rpx;
- height: 130rpx;
- margin: 0 auto;
- border-radius: 100rpx;
- overflow: hidden;
- margin-bottom: 30rpx;
- .image {
- width: 100%;
- height: 100%;
- }
- }
- .phone {
- height: 1rem;
- margin-bottom: 30rpx;
- }
- }
- .cover-container {
- padding: 0 30rpx;
- position: relative;
- padding-bottom: 20rpx;
- }
- .tj-sction {
- @extend %section;
- .tj-item {
- @extend %flex-center;
- flex-direction: column;
- height: 100rpx;
- font-size: $font-sm;
- color: $font-color-light;
- }
- .num {
- font-size: $font-lg + 4rpx;
- color: $font-color-dark;
- margin-bottom: 8rpx;
- font-weight: bold;
- }
- }
- .item-box {
- border-radius: 20rpx;
- background-color: white;
- margin-top: 20rpx;
- .box-title {
- line-height: 1;
- padding: 30rpx 40rpx;
- .title {
- font-size: $font-lg;
- font-weight: bold;
- }
- .link {
- font-size: $font-base - 2rpx;
- color: $font-color-light;
- .img {
- width: 26rpx;
- }
- }
- }
- .order-section {
- @extend %section;
- padding: 28rpx 0;
- padding-top: 0;
- .order-item {
- @extend %flex-center;
- width: 120rpx;
- height: 120rpx;
- border-radius: 10rpx;
- font-size: $font-sm;
- color: $font-color-dark;
- }
- .iconfont {
- font-size: 48rpx;
- margin-bottom: 18rpx;
- color: #fa436a;
- }
- .icon-shouhoutuikuan {
- font-size: 44rpx;
- }
- .icon {
- height: 50rpx;
- width: 48rpx;
- margin-bottom: 18rpx;
- background-size: 100%;
- background-repeat: no-repeat;
- background-position: center;
- .icon-img {
- width: 100%;
- height: 100%;
- }
- }
- }
- }
- .hx-wrapper {
- width: 536rpx;
- // height: 630rpx;
- position: relative;
- padding-bottom: 40rpx;
- background-color: #fff;
- border-radius: 20rpx;
- .hx-img {
- width: 536rpx;
- height: 281rpx;
- image {
- width: 536rpx;
- height: 281rpx;
- }
- }
- .hx-close {
- position: absolute;
- left: 243rpx;
- bottom: -80rpx;
- width: 52rpx;
- height: 52rpx;
- image {
- width: 52rpx;
- height: 52rpx;
- }
- }
- .hx-body {
- width: 536rpx;
- // min-height: 349rpx;
- background-color: #fff;
- border-radius: 0 0 10rpx 10rpx;
- padding-top: 40rpx;
- .hx-title {
- width: 536rpx;
- font-size: 36rpx;
- font-weight: 500;
- color: #333333;
- line-height: 1;
- padding-top: 42rpx;
- text-align: center;
- padding-bottom: 10rpx;
- }
- input {
- width: 439rpx;
- height: 68rpx;
- background: #f1faf6;
- border-radius: 10rpx;
- margin: 0 auto 40rpx;
- padding-left: 26rpx;
- .hx-placeholder {
- font-size: 26rpx;
- font-weight: 500;
- color: $base-color;
- }
- }
- .hx-btn {
- margin: 44rpx auto 0;
- width: 353rpx;
- height: 71rpx;
- background: $base-color;
- border-radius: 34rpx;
- font-size: 36rpx;
- font-weight: 500;
- color: #F8F9F9;
- line-height: 71rpx;
- text-align: center;
- }
- }
- }
- .nav-hx {
- display: flex;
- justify-content: center;
- margin-bottom: 20rpx;
- text {
- font-size:28rpx;
- padding: 10rpx;
- }
- .action {
- color: $base-color;
- font-weight: bold;
-
- }
- }
- </style>
|