金诚优选前端代码
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.

378 lines
9.5 KiB

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