user.vue 27 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780
  1. <template>
  2. <view>
  3. <view :class="'mine' + (skinNotColor ? ' not-color' : '')">
  4. <image :src="'/static/pages/images/' + iconSrc + (skinNotColor ? 'wdbg1.png' : 'wdbg.png')" class="wdbg"
  5. @click="jumpUrl('mine/userinfo/userinfo')"></image>
  6. <view class="minec">
  7. <image :src="userInfos.avatar ? userInfos.avatar : '/static/pages/images/userimg.png'" mode="aspectFit"
  8. class="user" @click="jumpUrl('mine/userinfo/userinfo')"></image>
  9. <view class="mines" @click="jumpUrl('mine/userinfo/userinfo')" v-if="isLogin">
  10. <view class="ddflex">{{userInfos.nickName}}
  11. <image :src="config.ordinary_member_icon" class="common-vip"
  12. v-if="config.ordinary_member_icon&&!userinfovip.levelGrade"></image>
  13. </view>
  14. <text class="edu" v-if="userInfos.mobile">{{userInfos.mobile}}</text>
  15. </view>
  16. <view class="flex" v-else>
  17. <text class="login-btn" @click="jumpUrl('')">点击登录</text>
  18. </view>
  19. <!-- <navigator url="/mine/userinfo/userinfo" hover-class="none" class="set"> -->
  20. <!-- <view class="set">
  21. <image src="/static/pages/images/set.png" @click="signFun"></image>
  22. </view> -->
  23. <view class="rule dflex" @click="jumpUrl('integralshop/task/index')" v-if="isShowSign"><!-- isSign==0||sign==1?jumpUrl(''):signFun() -->
  24. <image src="/static/pages/images/qdico.png"></image>
  25. {{!isLogin ? '签到' : isSign==0||sign==1?'已签到':'签到'}}
  26. </view>
  27. <!-- </navigator> -->
  28. </view>
  29. <view class="datas dflex">
  30. <navigator url="" hover-class="none" class="li" v-if="is_open_wallet.isOpenWallet==1"
  31. @click="jumpUrl('wallet/index/index')"><text>{{userMoney?userMoney:'0.00'}}</text>钱包
  32. </navigator>
  33. <navigator url="" hover-class="none" class="li"
  34. :style="is_open_wallet.isOpenWallet!=1&&Open_Points_Mall!=1?'width:50%':''"
  35. @click="jumpUrl('mine/coupons/coupons')">
  36. <text>{{userInfos.coupon?userInfos.coupon:'0'}}</text>优惠券
  37. </navigator>
  38. <navigator url="" hover-class="none" class="li" @click="jumpUrl('integralshop/index/index')">
  39. <text>{{userInfos.integral?userInfos.integral:'0'}}</text>积分
  40. </navigator>
  41. <navigator url="" hover-class="none" class="li"
  42. :style="is_open_wallet.isOpenWallet!=1&&Open_Points_Mall!=1?'width:50%':''"
  43. @click="jumpUrl('mine/collect/collect')">
  44. <text>{{userInfos.collect?userInfos.collect:'0'}}</text>收藏
  45. </navigator>
  46. <!-- <navigator url="/mine/footprint/footprint" hover-class="none" class="li"><text>{{footprint?footprint:'0'}}</text>足迹</navigator> -->
  47. </view>
  48. <block v-if="isLogin">
  49. <view class="upgrade ddflex" v-if="config.is_show_member_upgrade == 1 && userinfovip.levelGrade < vipList.length"><!-- config.ordinary_member_icon -->
  50. <view :class="'li' + (!userinfovip.levelGrade ? ' active':'')">
  51. <view>普通会员</view>
  52. </view>
  53. <view class="li" :class="{active:userinfovip.level == item.id,cur:item.isShowInfo}" v-for="(item,index) in vipList" :key="index"
  54. @click="showInfo(index)">
  55. <view class="vip-info" v-if="item.isShowInfo&&item.upgradeTerm.terms.length>0">
  56. <text
  57. v-if="item.upgradeTerm.terms[0].bind == 'order_money'">累计消费金额达到{{item.upgradeTerm.terms[0].value}}元即可升级</text>
  58. <text
  59. v-if="item.upgradeTerm.terms[0].bind == 'order_num'">累计购买订单达到{{item.upgradeTerm.terms[0].value}}笔即可升级</text>
  60. <text
  61. v-if="item.upgradeTerm.terms[0].bind == 'share_new'">分享拉新人数累计达到{{item.upgradeTerm.terms[0].value}}人即可升级</text>
  62. </view>
  63. <view class="vip-tit">{{item.title}}</view>
  64. </view>
  65. </view>
  66. <view class="vip" v-if="vipList&&vipList.length>=1&&rongkang!='ZQ1VK5oc17I387E'"
  67. @click="jumpUrl('mine/vip/vip')">
  68. <image :src="picUrlss+'vip_bg.png'" class="vipbg"></image>
  69. <view class="vipc dflex">
  70. <view class="dflex flex" v-if="userinfovip.levelGrade>0&& !userinfovip.end">
  71. <!-- <image :src="userinfovip.icon"></image> -->
  72. <image src="/static/pages/images/hg_ico1.png" class="vipimg"></image>
  73. <view class="huiyuan">{{userinfovip.levelName}}</view>
  74. <!-- <text class="level" >{{userinfovip.levelGrade}}</text> -->
  75. </view>
  76. <view class="dflex flex" v-else>
  77. <image src="/static/pages/images/hg_ico1.png" class="vipimg"></image>
  78. <text class="huiyuan">会员立享专属权益</text>
  79. </view>
  80. <view class="cheng" v-if="userinfovip.levelGrade>0&& !userinfovip.end">
  81. {{userinfovip.expireTime}} 到期
  82. </view>
  83. <view class="ling" v-else>立即开通</view>
  84. </view>
  85. </view>
  86. </block>
  87. <view class="vip" v-else @click="jumpUrl('mine/vip/vip')">
  88. <image :src="picUrlss+'vip_bg.png'" class="vipbg"></image>
  89. <view class="vipc dflex">
  90. <view class="dflex flex">
  91. <image src="/static/pages/images/hg_ico1.png" class="vipimg"></image>
  92. <text class="huiyuan">会员立享专属权益</text>
  93. </view>
  94. <view class="ling">立即开通</view>
  95. </view>
  96. </view>
  97. </view>
  98. <view class="con">
  99. <view class="order">
  100. <navigator url="" hover-class="none" class="tits dflex" @click="jumpUrl('mine/order/order')">
  101. <view class="flex">我的订单</view>查看全部<image src="/static/pages/images/rico.png" class="rico"></image>
  102. </navigator>
  103. <view class="list1">
  104. <navigator url="" hover-class="none" class="li" @click="jumpUrl('mine/order/order')">
  105. <image :src="picUrlss+'ddico0.png'"></image>
  106. <view>全部订单</view>
  107. </navigator>
  108. <navigator url="" hover-class="none" class="li" @click="jumpUrl('mine/order/order?state=1')">
  109. <image :src="picUrlss+'ddico1.png'"></image>
  110. <text class="new" v-if="userInfos.dfk > 0">{{userInfos.dfk}}</text>
  111. <view>待付款</view>
  112. </navigator>
  113. <navigator url="" hover-class="none" class="li" @click="jumpUrl('mine/order/order?state=3')">
  114. <image :src="picUrlss+'ddico2.png'"></image>
  115. <text class="new" v-if="userInfos.yqr > 0">{{userInfos.yqr}}</text>
  116. <view>待发货</view>
  117. </navigator>
  118. <navigator url="" hover-class="none" class="li" @click="jumpUrl('mine/order/order?state=5')">
  119. <image :src="picUrlss+'ddico3.png'"></image>
  120. <text class="new" v-if="userInfos.yfh > 0">{{userInfos.yfh}}</text>
  121. <view>待收货</view>
  122. </navigator>
  123. <navigator url="" hover-class="none" class="li" @click="jumpUrl('mine/order/order?state=7')">
  124. <image :src="picUrlss+'ddico4.png'"></image>
  125. <text class="new" v-if="userInfos.ywc > 0">{{userInfos.ywc}}</text>
  126. <view>已完成</view>
  127. </navigator>
  128. <!-- <navigator url="/mine/order/order?state=21" hover-class="none" class="li">
  129. <image src="/pages/images/ddico0_1.png"></image>
  130. <text class="new" wx:if="{{ywc > 0}}">{{ywc}}</text>
  131. <view>退款售后</view>
  132. </navigator> -->
  133. </view>
  134. </view>
  135. </view>
  136. <!-- 店铺 -->
  137. <view class="order shopname"
  138. v-if="(userInfos.listMerchant&&userInfos.listMerchant!=null&&userInfos.listMerchant.length>0)||(is_open_shop == 1&&userInfos.listShopBase&&userInfos.listShopBase!=null&&userInfos.listShopBase.length>0)||userInfos.merchantId!=null">
  139. <image src="/static/pages/images/md_ic_bg.png" class="md_ic_bg"></image>
  140. <navigator url="" hover-class="none" class="tits dflex" @click="jumpMerchantManage()">
  141. <view class="dflex flex">
  142. <image src="/static/pages/images/position_b_icon.png" class="bico"></image>
  143. <block v-if="!userInfos.listShopBase||!userInfos.listMerchant">
  144. 门店管理
  145. </block>
  146. <block v-else>
  147. <block v-if="userInfos.listMerchant.length>0&&userInfos.listShopBase.length<1">
  148. {{userInfos.listMerchant[0].title?userInfos.listMerchant[0].title:'门店管理'}}</block>
  149. <block v-else-if="userInfos.listShopBase.length>0">
  150. {{userInfos.listShopBase[0].title?userInfos.listShopBase[0].title:'门店管理'}}</block>
  151. <!-- {{!listShopBase?listMerchant[0].title:listShopBase.length==0?listMerchant[0].title:listShopBase[0].title}} -->
  152. </block>
  153. </view>
  154. 查看更多<image src="/static/pages/images/rico.png" class="rico"></image>
  155. </navigator>
  156. <view class="datasw dflex">
  157. <navigator url="" hover-class="none" class="li" @click="jumpMerchantManage()">
  158. 全部订单<text>{{statistics.total}}</text>
  159. </navigator>
  160. <navigator url="" hover-class="none" class="li" @click="jumpMerchantManage()">
  161. 待发货<text>{{statistics.t3}}</text>
  162. </navigator>
  163. <navigator url="" hover-class="none" class="li" @click="jumpMerchantManage()">
  164. 待提货<text>{{statistics.t4}}</text>
  165. </navigator>
  166. </view>
  167. </view>
  168. <view class="order" v-if="distr.distributionIsOpen==1&&userInfos.isDistriUser == 2">
  169. <navigator url hover-class="none" class="tits dflex">
  170. <view class="flex">全民推广</view>
  171. <!-- 查看更多<image src="/pages/images/rico.png" class="rico"></image> -->
  172. </navigator>
  173. <view class="list3 dflex">
  174. <navigator url="" hover-class="none" class="li" @click="jumpUrl('promote/team/team')">
  175. <image :src="picUrlss+'fxico1.png'"></image>
  176. <view>推广中心</view>
  177. </navigator>
  178. <navigator url="" hover-class="none" class="li"
  179. @click="jumpUrl('promote/teamList/teamList?IS_secondary_members=' + IS_secondary_members)">
  180. <image :src="picUrlss+'fxico2.png'"></image>
  181. <view>我的客户</view>
  182. </navigator>
  183. <navigator url="" hover-class="none" class="li" @click="jumpUrl('promote/sales/sales')">
  184. <image :src="picUrlss+'fxico3.png'"></image>
  185. <view>业绩订单</view>
  186. </navigator>
  187. <navigator url="" hover-class="none" class="li" @click="jumpUrl('promote/invite/invite')">
  188. <image :src="picUrlss+'fxico4.png'"></image>
  189. <view>我要推广</view>
  190. </navigator>
  191. </view>
  192. </view>
  193. <block v-if="isLogin">
  194. <block v-if="distr.distributionIsOpen==1&&config.is_hide_distribution_entry != 1">
  195. <navigator url="" hover-class="none" class="order tuig" v-if="userInfos.isDistriUser==1"
  196. @click="jumpUrl('promote/status/status')">
  197. <view class="tits dflex">
  198. <view class="flex">全民推广</view>
  199. </view>
  200. <image :src="picUrlss+'fenxiao.png'" class="fenxiao"></image>
  201. </navigator>
  202. <navigator url="" hover-class="none" class="order tuig"
  203. v-if="userInfos.isDistriUser!=2 && userInfos.isDistriUser!=1" @click="jumpUrl('promote/info/info')">
  204. <view class="tits dflex">
  205. <view class="flex">全民推广</view>
  206. </view>
  207. <image :src="picUrlss+'fenxiao.png'" class="fenxiao"></image>
  208. </navigator>
  209. </block>
  210. </block>
  211. <navigator url="" hover-class="none" class="order tuig" @click="jumpUrl('promote/apply/apply')"
  212. v-if="!isLogin&&config.is_hide_distribution_entry != 1">
  213. <view class="tits dflex">
  214. <view class="flex">全民推广</view>
  215. </view>
  216. <image :src="picUrlss+'fenxiao.png'" class="fenxiao"></image>
  217. </navigator>
  218. <view class="order">
  219. <view class="tits dflex">
  220. <view class="flex">我的服务</view>
  221. </view>
  222. <view class="list2 dflex">
  223. <!-- <navigator url="/mine/order/order?orderType=5" hover-class="none" class="li">
  224. <image src="/pages/images/ddico5_1.png"></image>
  225. <text>及时达订单</text>
  226. </navigator> -->
  227. <!-- <navigator url="/pages/supplier/supplier" hover-class="none" class="li">
  228. <image :src="picUrlss+'supplier.png'"></image>
  229. <text>我是供应商</text>
  230. </navigator> -->
  231. <!-- <navigator url="" hover-class="none" class="li" @click="jumpUrl('mine/order/order?orderType=2')">
  232. <image :src="picUrlss+'ddico5_2.png'"></image>
  233. <text>社区团购</text>
  234. </navigator> -->
  235. <navigator url="" hover-class="none" class="li" @click="jumpUrl('mine/order/order?orderType=4')">
  236. <image :src="picUrlss+'ddico4_1.png'"></image>
  237. <text>拼团订单</text>
  238. </navigator>
  239. <navigator url="" hover-class="none" class="li" @click="jumpUrl('mine/order/order?orderType=7')">
  240. <image :src="picUrlss+'ddico7_1.png'"></image>
  241. <text>砍价订单</text>
  242. </navigator>
  243. <navigator url="" hover-class="none" class="li" v-if="Open_Points_Mall==1"
  244. @click="jumpUrl('integralshop/index/index')">
  245. <image :src="picUrlss+'ddico8_1.png'"></image>
  246. <text>积分商城</text>
  247. </navigator>
  248. <!-- <navigator url="" hover-class="none" class="li" @click="jumpUrl('mine/remind/remind')">
  249. <image :src="picUrlss+'ddico7.png'"></image>
  250. <text>开团提醒</text>
  251. </navigator> -->
  252. <navigator url="" hover-class="none" class="li" @click="jumpUrl('product/coupon/coupon')">
  253. <image :src="picUrlss+'ddico5_3.png'"></image>
  254. <text>领券中心</text>
  255. </navigator>
  256. <navigator url="" hover-class="none" class="li" @click="jumpUrl('topics/release/release')">
  257. <image :src="picUrlss+'ddico7.png'"></image>
  258. <text>我的发布</text>
  259. </navigator>
  260. <navigator url="" hover-class="none" class="li" @click="jumpUrl('office/follow/index')">
  261. <image :src="picUrlss+'ddico5_2.png'"></image>
  262. <text>我的关注</text>
  263. </navigator>
  264. <navigator url="" hover-class="none" class="li" @click="jumpUrl('mine/news/news')">
  265. <image :src="picUrlss+'ddico5_1.png'"></image>
  266. <text>我的消息</text>
  267. <view class="new" v-if="newsCount > 0">{{newsCount}}</view>
  268. </navigator>
  269. <!-- <navigator url="/pages/nearby/nearby" hover-class="none" class="li">
  270. <image src="/pages/images/ddico5.png"></image>
  271. <text>附近门店</text>
  272. </navigator> -->
  273. <navigator url="" hover-class="none" class="li" @click="jumpUrl('mine/address/address')">
  274. <image :src="picUrlss+'ddico6.png'"></image>
  275. <text>收货地址</text>
  276. </navigator>
  277. <navigator url="" hover-class="none" class="li" @click="jumpUrl('mine/invoice/invoice')"
  278. v-if="config.is_open_invoice == 1">
  279. <image :src="picUrlss+'ddico11_4.png'"></image>
  280. <text>我的发票</text>
  281. </navigator>
  282. <view class="li" v-if="!isLogin" @click="jumpUrl('')">
  283. <image :src="picUrlss+'ddico11_1.png'"></image>
  284. <text>绑定手机号</text>
  285. </view>
  286. <button class="li" v-if="!userInfos.mobile && isLogin" open-type="getPhoneNumber"
  287. @getphonenumber="getphonenumber" hover-class="none">
  288. <image :src="picUrlss+'ddico11_1.png'"></image>
  289. <text>绑定手机号</text>
  290. </button>
  291. <view class="li">
  292. <contact-button :img-url="picUrlss+'ddico9.png'" img-style='width: 74rpx;height: 74rpx;margin: 0 auto 12rpx;' button-text="联系客服" styles="line-height:initial;"></contact-button>
  293. </view>
  294. <!-- <button open-type="contact" class="li" hover-class="none">
  295. <image :src="picUrlss+'ddico9.png'"></image>
  296. <text>联系客服</text>
  297. </button> -->
  298. <view class="li" @tap="callPhone" v-if="phone">
  299. <image :src="picUrlss+'ddico11_2.png'"></image>
  300. <text>服务热线</text>
  301. </view>
  302. <navigator url="/mine/help/help" hover-class="none" class="li">
  303. <image :src="picUrlss+'ddico8.png'"></image>
  304. <text>帮助中心</text>
  305. </navigator>
  306. <navigator url="/pages/about/about" hover-class="none" class="li">
  307. <image :src="picUrlss+'ddico11_3.png'"></image>
  308. <text>关于我们</text>
  309. </navigator>
  310. <navigator url="/mine/feedback/feedback" hover-class="none" class="li">
  311. <image :src="picUrlss+'ddico10.png'"></image>
  312. <text>建议反馈</text>
  313. </navigator>
  314. <!-- <navigator url="/pages/web/web" hover-class="none" class="li" wx:if="{{merchantId}}">
  315. <image src="/pages/images/ddico11.png"></image>
  316. <text>门店管理</text>
  317. </navigator> -->
  318. </view>
  319. </view>
  320. <!-- 注册成为会员 -->
  321. <view class="mask" :hidden="isHide" @tap="hideRegister"></view>
  322. <view class="regi" :hidden="isHide">
  323. <view class="regi-tit">注册会员<image src="/static/pages/images/close1.png" class="regi-close"
  324. @tap="hideRegister"></image>
  325. </view>
  326. <view class="phone dflex">
  327. <input placeholder="手机号" placeholder-class="placeholder" class="flex"></input>
  328. <button open-type="getPhoneNumber" @getphonenumber="getphonenumber" class="getphone dflex">
  329. <image src="/static/pages/images/wxico.png"></image>一键获取
  330. </button>
  331. </view>
  332. <view class="regi-btn">立即注册</view>
  333. </view>
  334. <footer-copyright></footer-copyright>
  335. <!-- <view class="placeholder-view" :style="'height:' + (bottomBlankHeignt + 115) + 'rpx'"></view> -->
  336. <foot channel="user" :isUpdate="isUpdate"></foot>
  337. <update-userinfo :update-info="isUpdateInfo" :update-mobile="isUpdateMobile" v-if="isShowUpdate" @closeUpdate="closeUpdate" @updateInfo="updateInfo" @updateMobile="updateMobile"></update-userinfo>
  338. <!-- <web-view src="https://open.weixin.qq.com/connect/oauth2/authorize?appid=wx86937a61b8d50977&redirect_uri=https%3a%2f%2fwebtest.tongyu99.com&response_type=code&scope=snsapi_base&state=STATE#wechat_redirect"></web-view> -->
  339. </view>
  340. </template>
  341. <script>
  342. // pages/user/user.js
  343. const app = getApp();
  344. const req = require("../../utils/request.js");
  345. const route = require("../../utils/route");
  346. import foot from "../../components/nav-bar/index";
  347. import footerCopyright from "../../components/footer-copyright/footer-copyright";
  348. export default {
  349. data() {
  350. return {
  351. skinNotColor: req.public.skinNotColor,
  352. picUrlss: req.public.picUrls,
  353. bottomBlankHeignt: app.globalData.isIPhoneX ? 68 : 0,
  354. // merchantId: '',
  355. iconSrc: req.public.iconSrc,
  356. //头部页面背景链接
  357. isUpdate: false,
  358. // 是否更新消息
  359. isHideVip: true,
  360. //隐藏会员
  361. isVip: true,
  362. //是否是会员
  363. isHide: true,
  364. //是否隐藏注册会员弹窗
  365. IS_secondary_members: 0,
  366. distr: "",
  367. userinfovip: "",
  368. userMoney: "",
  369. istetphone: "",
  370. logo: "",
  371. name: "",
  372. is_open_wallet: "",
  373. Open_Points_Mall: "",
  374. statistics: "",
  375. vipList: "",
  376. rongkang: req.header.appId,
  377. isSign: '',
  378. sign: 0,
  379. isLogin: false,
  380. noLogin: false,
  381. is_open_shop: '',
  382. isShowSign: false, //是否显示签到按钮
  383. config: {},
  384. userInfos: {},
  385. newsCount: 0,
  386. isShowUpdate: false,//是否显示更新信息弹窗
  387. isUpdateInfo: false,//更新用户信息
  388. isUpdateMobile: false,//绑定手机号
  389. };
  390. },
  391. components: {
  392. foot,
  393. footerCopyright
  394. },
  395. props: {},
  396. onLoad(options) {
  397. app.globalData.getCheckSessoin(json => {
  398. this.sessionKey = json.session_key;
  399. });
  400. uni.setNavigationBarColor({
  401. frontColor: this.skinNotColor ? '#000' : '#ffffff',
  402. backgroundColor: this.skinNotColor ? '#fff' : req.public.titleTopBgColor
  403. });
  404. if (JSON.parse(req.getStorage('configRes')).IS_secondary_members) {
  405. let IS_secondary_members = JSON.parse(req.getStorage('configRes')).IS_secondary_members;
  406. console.log(IS_secondary_members)
  407. this.setData({
  408. IS_secondary_members: IS_secondary_members
  409. });
  410. }
  411. let userInfo = req.getStorage('userInfo');
  412. if(req.isAuth()){
  413. setTimeout(res=>{
  414. if(!userInfo.avatar || userInfo.nickName == '微信用户' || this.userInfos.nickName == '微信用户'){
  415. this.isShowUpdate = true
  416. this.isUpdateInfo = true
  417. }
  418. if(userInfo.avatar&&!userInfo.mobile&&(this.userInfos&&!this.userInfos.mobile)){
  419. this.isShowUpdate = true
  420. this.isUpdateMobile = true
  421. }
  422. },2000)
  423. }
  424. },
  425. onShow: function() {
  426. this.setData({
  427. isUpdate: !this.isUpdate
  428. }); // let merchantId = req.getStorage('userInfo').merchantId
  429. // this.setData({
  430. // merchantId: merchantId,
  431. // })
  432. // console.log(this.merchantId);
  433. // this.getMy();
  434. // this.getAbout();
  435. // console.log(this.noLogin, 111111111111)
  436. let userInfo = req.getStorage('userInfo');
  437. // if (userInfo) this.isLogin = true;
  438. this.isLogin = req.isAuth();
  439. if (this.isLogin) {
  440. this.getMy();
  441. this.getNewsCount();
  442. this.getAbout();
  443. this.getRule();
  444. this.noLogin = true;
  445. } else {
  446. this.noLogin = false;
  447. }
  448. },
  449. methods: {
  450. jumpUrl(url) {
  451. if (!req.isLogin()) return false;
  452. app.globalData.navigateTo(url);
  453. },
  454. jumpMerchantManage() {
  455. // jumpUrl('pages/web/web')
  456. let token = req.getStorage('AUTH_TOKEN');
  457. this.jumpUrl('merchant/index?appId=' + req.header.appId + '&token=' + token);
  458. },
  459. // 是否签到{}
  460. isSignFun() {
  461. req.getRequest('/api/integral/isSign', {}, res => {
  462. this.setData({
  463. isSign: res
  464. });
  465. });
  466. },
  467. gouserInfo() {
  468. app.globalData.navigateTo('mine/userinfo/userinfo')
  469. },
  470. getDistributionConfig() {
  471. req.postRequest('/api/distribution/config', {}, res => {
  472. this.setData({
  473. distr: res
  474. });
  475. });
  476. },
  477. // 签到
  478. signFun() {
  479. req.postRequest('/api/integral/sign', {}, data => {
  480. if (data) {
  481. req.msg('连续签到' + data.continuityDay + '天' + ',获得' + data.IntegralChange + '积分');
  482. this.setData({
  483. sign: 1
  484. });
  485. this.getOpenPonints();
  486. }
  487. });
  488. },
  489. getuserVip() {
  490. req.getRequest('/api/user/levelDetails', {}, data => {
  491. let expireTime = Array;
  492. if (data.expireTime) {
  493. expireTime = data.expireTime.split(" ");
  494. data.expireTime = data.expireTime.replace(/-/g, '/');
  495. } // 解决苹果不兼容---日期
  496. // data.expireTime=data.expireTime.replace(/-/g, '/')
  497. let nowTime = new Date().getTime();
  498. let endTime = new Date(data.expireTime).getTime();
  499. let times = parseInt((endTime - nowTime) / 1000); // var expireTime= new Date(data.expireTime)
  500. // var time1=expireTime.getTime();
  501. // console.log(times, nowTime, endTime, data.expireTime);
  502. this.setData({
  503. userinfovip: data,
  504. ['userinfovip.expireTime']: expireTime[0]
  505. });
  506. if (times <= 0) {
  507. this.setData({
  508. ['userinfovip.end']: true
  509. });
  510. } else {
  511. this.setData({
  512. ['userinfovip.end']: false
  513. });
  514. }
  515. // console.log(data);
  516. });
  517. },
  518. getOpenPonints() {
  519. req.getRequest('/api/integral/returnIntegral', {}, res => {
  520. this.setData({
  521. integral: res
  522. })
  523. })
  524. },
  525. getMy() {
  526. let that = this;
  527. req.getRequest('/api/user/my', {}, data => {
  528. // data.merchantId = req.getStorage('userInfo').merchantId
  529. data.nickName = req.excludeSpecial(data.nickName);
  530. this.userInfos = data;
  531. let userInfo = req.getStorage('userInfo');
  532. userInfo.isDistriUser = suc.isDistriUser;
  533. req.setStorage('userInfo', userInfo);
  534. // that.setData(data); // this.isbindmobile();
  535. console.log('userinfo==' + JSON.stringify(data))
  536. this.isSignFun();
  537. this.getstatistics(data);
  538. this.getDistributionConfig();
  539. this.getuserVip();
  540. this.getuserMoney();
  541. this.getVip();
  542. this.getOpenPonints();
  543. // console.log(this);
  544. });
  545. },
  546. getuserMoney() {
  547. let is_open_wallet = JSON.parse(req.getStorage('configRes')).is_open_wallet;
  548. if (is_open_wallet) {
  549. if (JSON.parse(is_open_wallet).isOpenWallet == 1) {
  550. route.extendNew({}, res => {
  551. // console.log(parseFloat(res.all).toFixed(2));
  552. if (res) this.setData({
  553. userMoney: parseFloat(res.all).toFixed(2)
  554. });
  555. });
  556. }
  557. }
  558. },
  559. getNewsCount(){
  560. req.getRequest('/api/v3/fabulous/countComment',{},res=>{
  561. this.newsCount = res;
  562. })
  563. },
  564. getAbout() {
  565. var _this = this;
  566. req.getRequest('/api/config', {}, function(res) {
  567. _this.phone = res.CONFIG_SERVICE_HOT_MOBILE;
  568. _this.config = res;
  569. _this.setData({
  570. istetphone: res.user_bind_mobile,
  571. logo: res.CONFIG_PROJECT_LOGO,
  572. name: res.CONFIG_PROJECT_TITLE
  573. });
  574. // console.log(res);
  575. if (res && res.is_open_wallet) {
  576. _this.setData({
  577. is_open_wallet: JSON.parse(res.is_open_wallet)
  578. });
  579. }
  580. if (res.is_open_shop) {
  581. _this.is_open_shop = res.is_open_shop;
  582. }
  583. // if (res.user_bind_mobile == '1') {
  584. // let userInfo = req.getStorage('userInfo');
  585. // if (userInfo && (userInfo.mobile == null || userInfo.mobile == '')) {
  586. // app.globalData.openPage('pages/authorize/authorize?bindmobile=1');
  587. // }
  588. // }
  589. });
  590. // 是否开启积分商城
  591. req.getRequest('/api/params/value', {
  592. type: 'Open_Points_Mall'
  593. }, res => {
  594. this.setData({
  595. Open_Points_Mall: res
  596. });
  597. });
  598. },
  599. getphonenumber(event) {
  600. const detail = event.detail;
  601. const _ts = this;
  602. if (!detail || !detail.encryptedData || !detail.iv) return false;
  603. req.postRequest('/api/weixin/mobile', {
  604. encryptedData: detail.encryptedData,
  605. iv: detail.iv,
  606. sessionKey: this.sessionKey
  607. }, res => {
  608. _ts.getMy();
  609. });
  610. },
  611. callPhone() {
  612. if (!req.isLogin()) return false;
  613. uni.makePhoneCall({
  614. phoneNumber: this.phone
  615. });
  616. },
  617. showRegister() {
  618. //显示注册会员弹窗
  619. this.setData({
  620. isHide: false
  621. });
  622. },
  623. hideRegister() {
  624. //隐藏注册会员弹窗
  625. this.setData({
  626. isHide: true
  627. });
  628. },
  629. goUrl() {
  630. app.globalData.openPage('mine/vip/vip');
  631. },
  632. // 门店统计
  633. getstatistics(data) {
  634. let from = {};
  635. if (data.listShopBase && data.listShopBase != null && data.listShopBase.length > 0) {
  636. from.shopId = data.listShopBase[0].id;
  637. }
  638. if (data.listMerchant && data.listMerchant != null && data.listMerchant.length > 0 && data.listShopBase
  639. .length < 1) {
  640. from.merchantId = data.listMerchant[0].id;
  641. }
  642. req.getRequest('/api/order/statistics', from, data => {
  643. this.setData({
  644. statistics: data
  645. });
  646. console.log(data);
  647. });
  648. },
  649. getRule() {
  650. let that = this;
  651. req.getRequest('/api/integral/config', {}, res => {
  652. if (res && res.length > 0) {
  653. res.map(it => {
  654. if (it.illustrate && it.illustrate.indexOf('签到') > -1) {
  655. if (it.state == 2) {
  656. that.isShowSign = true;
  657. }
  658. }
  659. })
  660. }
  661. })
  662. },
  663. getVipListOrg() {
  664. if (this.vipList && this.userinfovip) {
  665. if(!this.userinfovip.levelGrade){
  666. this.vipList.map((it,index)=>{
  667. this.vipList[0].isShowInfo = true;
  668. })
  669. }else{
  670. this.vipList.map((it,index)=>{
  671. if(this.userinfovip.level == it.id){
  672. if(index < this.vipList.length-1){
  673. this.vipList[index+1].isShowInfo = true;
  674. }
  675. }
  676. })
  677. }
  678. }
  679. },
  680. getVip() {
  681. req.getRequest('/api/levelStrategy/userLevelList', {}, data => {
  682. if (data && data.length > 0) {
  683. data.map((it,index) => {
  684. it.upgradeTerm = JSON.parse(it.upgradeTerm)
  685. it.isShowInfo = false
  686. // if(index == 0) it.isShowInfo = true;
  687. return it;
  688. })
  689. this.vipList = data
  690. this.getVipListOrg();
  691. }
  692. });
  693. },
  694. showInfo(index) {
  695. if(!this.vipList[index].isShowInfo){
  696. this.vipList.map(it=>{
  697. it.isShowInfo = false;
  698. return it
  699. })
  700. }
  701. this.vipList[index].isShowInfo = !this.vipList[index].isShowInfo
  702. },
  703. closeUpdate(){
  704. this.isShowUpdate = false
  705. },
  706. updateInfo(e){
  707. this.isUpdateInfo = e
  708. this.getMy()
  709. },
  710. updateMobile(e){
  711. this.isUpdateMobile = e
  712. this.getMy()
  713. },
  714. // 判断强制绑定手机号
  715. // isbindmobile() {
  716. // if (req.getStorage('configRes')) {
  717. // let configRes = JSON.parse(req.getStorage('configRes'))
  718. // this.setData({ istetphone: configRes.user_bind_mobile, logo: configRes.CONFIG_PROJECT_LOGO, name: configRes.CONFIG_PROJECT_TITLE })
  719. // } else {
  720. // req.g('/api/config', (res) => {
  721. // req.setStorage('configRes', JSON.stringify(res))
  722. // this.setData({ istetphone: res.user_bind_mobile, logo: res.CONFIG_PROJECT_LOGO, name: res.CONFIG_PROJECT_TITLE })
  723. // })
  724. // }
  725. // if(this.data.istetphone=='1'){
  726. // // 获取用户手机号
  727. // let userInfo= req.getStorage('userInfo')
  728. // if(userInfo.mobile==null||userInfo.mobile==''){
  729. // console.log("获取用户手机号===============================")
  730. // app.openPage('pages/authorize/authorize?bindmobile=1')
  731. // }
  732. // }
  733. // },
  734. }
  735. };
  736. </script>
  737. <style>
  738. @import "./user.css";
  739. </style>