金诚优选前端代码
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

368 lines
9.2 KiB

4 years ago
  1. <template>
  2. <view>
  3. <lf-nav title="我的" :showIcon="true" :spreadOut="false" bgColor="transparent" titleColor="#fff"></lf-nav>
  4. <block v-if="$isRight(detail)">
  5. <view class="head">
  6. <view class="bg-left"></view>
  7. <view class="bg-right"></view>
  8. <view class="head-content">
  9. <view class="lf-flex">
  10. <image class="head-img" mode="widthFix" :src="detail.brand.logo"></image>
  11. <view class="head-title lf-line-3">{{ detail.brand.name }}</view>
  12. </view>
  13. <view class="lf-flex">
  14. <view class="head-menu" @click="$url('/pages/business/balance/balance')">
  15. <text class="lf-iconfont icon-yue"></text>
  16. <text>余额</text>
  17. </view>
  18. <view class="head-menu" @click="onScanCode">
  19. <text class="lf-iconfont icon-saoyisao"></text>
  20. <text>扫一扫</text>
  21. </view>
  22. </view>
  23. </view>
  24. </view>
  25. <view class="notice" v-if="detail.notice.length">
  26. <u-notice-bar mode="vertical" type="none" :list="detail.notice"></u-notice-bar>
  27. </view>
  28. <view class="card">
  29. <view class="lf-row-between">
  30. <view class="title">待处理</view>
  31. <view class="lf-color-777" @click="$url('/pages/business/order/list')">
  32. <text class="lf-font-24 lf-m-r-10">订单管理</text>
  33. <text class="lf-iconfont icon-xiangyou lf-font-20"></text>
  34. </view>
  35. </view>
  36. <view class="lf-flex lf-m-t-50">
  37. <view class="item" :style="{width: 100 / 3 +'%'}">
  38. <view class="num">{{ detail.todo.new }}</view>
  39. <view>待付款</view>
  40. </view>
  41. <view class="item" :style="{width: 100 / 3 +'%'}">
  42. <view class="num">{{ detail.todo.send }}</view>
  43. <view>待发货</view>
  44. </view>
  45. <view class="item" :style="{width: 100 / 3 +'%'}">
  46. <view class="num">{{ detail.todo.pick }}</view>
  47. <view>待提货</view>
  48. </view>
  49. </view>
  50. </view>
  51. <view class="card">
  52. <view class="lf-row-between">
  53. <view class="title">今日数据</view>
  54. </view>
  55. <view class="lf-flex lf-m-t-50">
  56. <view class="item" :style="{width: 100 / 3 +'%'}">
  57. <view class="num">
  58. <text>{{ detail.today.pay }}</text>
  59. <text class="lf-font-24">()</text>
  60. </view>
  61. <view>支付金额</view>
  62. </view>
  63. <view class="item" :style="{width: 100 / 3 +'%'}">
  64. <view class="num">
  65. <text>{{ detail.today.online }}</text>
  66. <text class="lf-font-24">()</text>
  67. </view>
  68. <view>线上订单</view>
  69. </view>
  70. <view class="item" :style="{width: 100 / 3 +'%'}">
  71. <view class="num">
  72. <text>{{ detail.today.offline }}</text>
  73. <text class="lf-font-24">()</text>
  74. </view>
  75. <view>线下订单</view>
  76. </view>
  77. </view>
  78. </view>
  79. <view class="card">
  80. <view class="lf-row-between">
  81. <view class="title">我的商品</view>
  82. </view>
  83. <view class="lf-flex lf-m-t-50">
  84. <view class="item" :style="{width: 100 / 3 +'%'}">
  85. <view class="num">{{ detail.goods.del }}</view>
  86. <view>销售中</view>
  87. </view>
  88. <view class="item" :style="{width: 100 / 3 +'%'}">
  89. <view class="num">{{ detail.goods.on_sell }}</view>
  90. <view>待上架</view>
  91. </view>
  92. <view class="item" :style="{width: 100 / 3 +'%'}">
  93. <view class="num">{{ detail.goods.off_sell }}</view>
  94. <view>已下架</view>
  95. </view>
  96. </view>
  97. </view>
  98. <view class="card">
  99. <view class="lf-row-between">
  100. <view class="title">我的活动</view>
  101. </view>
  102. <view class="lf-flex lf-m-t-50">
  103. <view class="item" :style="{width: 100 / 3 +'%'}" @click="$url('/pages/business/activity/add')">
  104. <view class="lf-iconfont icon-bianji lf-font-60"></view>
  105. <view>新增活动</view>
  106. </view>
  107. <view class="item" :style="{width: 100 / 3 +'%'}" @click="$url('/pages/business/activity/list')">
  108. <view class="lf-iconfont icon-fabujilu lf-font-60"></view>
  109. <view>活动列表</view>
  110. </view>
  111. </view>
  112. </view>
  113. <button class="out-btn" hover-class="lf-opacity" @click="outLogin">退出登录</button>
  114. <view style="height: 30rpx;"></view>
  115. </block>
  116. </view>
  117. </template>
  118. <script>
  119. export default {
  120. data(){
  121. return {
  122. token: '',
  123. detail: {}
  124. }
  125. },
  126. onLoad(){
  127. let store_token = this.$cookieStorage.get('store_token');
  128. if(!store_token){
  129. this.$msg('登录状态异常, 即将跳转至登录页').then(() => {
  130. this.$url('/pages/business/login/login', {type: 'redirect'});
  131. })
  132. }else{
  133. this.token = store_token;
  134. this.getStoreCenter();
  135. }
  136. },
  137. methods: {
  138. getStoreCenter(){
  139. this.$http.get({
  140. api: 'api/supplier/index',
  141. header: {
  142. token: this.token
  143. }
  144. }).then(res => {
  145. console.log("getStoreCenter", res);
  146. if(res.data.code == 200){
  147. this.detail = res.data.data;
  148. }else{
  149. this.$msg('您的状态异常,请重新登录').then(() => {
  150. this.$url('/pages/business/login/login', {type: 'redirect'});
  151. })
  152. }
  153. })
  154. },
  155. // 扫一扫
  156. onScanCode(){
  157. uni.scanCode({
  158. complete: res => {
  159. if(res.errMsg == 'scanCode:ok'){
  160. // 二维码内的内容
  161. let result = this.codeParse(res.result);
  162. if(this.$shared.isValueType(result) == 'object'){
  163. if(result.rand && result.time && result.u_id){
  164. let url = '/pages/business/payment/money';
  165. url += `?u_id=${result.u_id}`;
  166. url += `&rand=${result.rand}`;
  167. url += `&time=${result.time}`;
  168. this.$url(url);
  169. }else if(result.u_id && result.a_id){
  170. this.activityJoin(result);
  171. }else if(result.u_id && result.no){
  172. this.orderSelf(result);
  173. }
  174. }else{
  175. this.$msg('不是有效的支付码');
  176. }
  177. }else{
  178. this.$msg('请扫二维码或条形码');
  179. }
  180. }
  181. })
  182. },
  183. codeParse(str){
  184. str = String(str);
  185. let new_data = null;
  186. try{
  187. new_data = JSON.parse(str);
  188. }catch{
  189. new_data = str;
  190. }
  191. return new_data;
  192. },
  193. // 核销活动
  194. activityJoin(result){
  195. this.$http.post({
  196. api: 'api/supplier/activity/join',
  197. data: {
  198. user_id: result.u_id,
  199. activity_id: result.a_id
  200. },
  201. header: {
  202. token: this.token
  203. }
  204. }).then(res => {
  205. this.$msg(res.data.message || '核销失败');
  206. })
  207. },
  208. // 自提
  209. orderSelf(result){
  210. this.$http.post({
  211. api: `api/supplier/order/self/${result.no}`,
  212. data: {
  213. user_id: result.u_id
  214. },
  215. header: {
  216. token: this.token
  217. }
  218. }).then(res => {
  219. this.$msg(res.data.message || '自提核销成功');
  220. })
  221. },
  222. // 退出登录
  223. outLogin(){
  224. uni.showModal({
  225. title: '温馨提示',
  226. content: '您确定退出登录商家中心吗?',
  227. success: result => {
  228. if(result.confirm){
  229. this.$cookieStorage.clear('store_token');
  230. this.$msg('退出成功', {icon: 'success'}).then(() => {
  231. this.$toBack();
  232. })
  233. }
  234. }
  235. })
  236. }
  237. }
  238. }
  239. </script>
  240. <style lang="scss" scoped="scoped">
  241. .head{
  242. width: 750rpx;
  243. height: 409rpx;
  244. background: linear-gradient(90deg, #1339B8 0%, #092788 100%);
  245. position: relative;
  246. overflow: hidden;
  247. display: flex;
  248. align-items: flex-end;
  249. box-sizing: border-box;
  250. padding: 60rpx 32rpx 110rpx;
  251. color: #FFFFFF;
  252. .bg-left{
  253. position: absolute;
  254. width: 196rpx;
  255. height: 196rpx;
  256. border-radius: 50%;
  257. background-color: rgba(255,255,255,0.04);
  258. left: -92rpx;
  259. bottom: 60rpx;
  260. }
  261. .bg-right{
  262. position: absolute;
  263. width: 520rpx;
  264. height: 520rpx;
  265. border-radius: 50%;
  266. background-color: rgba(255,255,255,0.04);
  267. right: -168rpx;
  268. top: -142rpx;
  269. }
  270. .head-content{
  271. width: 100%;
  272. display: flex;
  273. justify-content: space-between;
  274. position: relative;
  275. z-index: 9;
  276. .head-img{
  277. width: 100rpx;
  278. height: 100rpx;
  279. border: 2rpx solid #FFFFFF;
  280. box-sizing: border-box;
  281. margin-right: 20rpx;
  282. border-radius: 50%;
  283. }
  284. .head-title{
  285. font-size: 36rpx;
  286. color: #FFFFFF;
  287. font-weight: bold;
  288. width: 390rpx;
  289. }
  290. .head-menu{
  291. display: flex;
  292. flex-direction: column;
  293. align-items: center;
  294. justify-content: center;
  295. color: #FFFFFF;
  296. &:nth-child(n+2){
  297. margin-left: 30rpx;
  298. }
  299. &>text:nth-child(1){
  300. font-size: 50rpx;
  301. }
  302. &>text:nth-child(2){
  303. font-size: 24rpx;
  304. }
  305. }
  306. }
  307. }
  308. .notice{
  309. width: 686rpx;
  310. height: 100rpx;
  311. background: #FFFFFF;
  312. box-shadow: 0rpx 2rpx 8rpx 1rpx rgba(0, 0, 0, 0.1);
  313. border-radius: 20rpx;
  314. margin: -50rpx auto 0;
  315. position: relative;
  316. z-index: 9;
  317. padding: 16rpx 4rpx 0;
  318. box-sizing: border-box;
  319. }
  320. .card{
  321. padding: 30rpx;
  322. width: 686rpx;
  323. height: 287rpx;
  324. background: #FFFFFF;
  325. box-shadow: 0rpx 2rpx 8rpx 1rpx rgba(0, 0, 0, 0.1);
  326. border-radius: 20rpx;
  327. margin: 30rpx auto 0;
  328. &:last-child{
  329. margin-bottom: 50rpx;
  330. }
  331. .title{
  332. font-size: 32rpx;
  333. color: #222222;
  334. font-weight: bold;
  335. }
  336. .item{
  337. box-sizing: border-box;
  338. padding: 0 20rpx;
  339. text-align: center;
  340. font-size: 24rpx;
  341. color: #777777;
  342. .num{
  343. font-size: 36rpx;
  344. color: #222222;
  345. font-weight: bold;
  346. // word-break: break-all;
  347. // line-height: 1;
  348. }
  349. }
  350. }
  351. .out-btn{
  352. width: 686rpx;
  353. height: 90rpx;
  354. background-color: #0D2E9A;
  355. color: #FFFFFF;
  356. font-size: 32rpx;
  357. margin: 0 auto;
  358. display: flex;
  359. justify-content: center;
  360. align-items: center;
  361. margin-top: 60rpx;
  362. }
  363. </style>