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

339 lines
8.5 KiB

  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="aspectFill" :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. </block>
  114. </view>
  115. </template>
  116. <script>
  117. export default {
  118. data(){
  119. return {
  120. token: '',
  121. detail: {}
  122. }
  123. },
  124. onLoad(){
  125. let store_token = this.$cookieStorage.get('store_token');
  126. if(!store_token){
  127. this.$msg('登录状态异常, 即将跳转至登录页').then(() => {
  128. this.$url('/pages/business/login/login', {type: 'redirect'});
  129. })
  130. }else{
  131. this.token = store_token;
  132. this.getStoreCenter();
  133. }
  134. },
  135. methods: {
  136. getStoreCenter(){
  137. this.$http.get({
  138. api: 'api/supplier/index',
  139. header: {
  140. token: this.token
  141. }
  142. }).then(res => {
  143. console.log("getStoreCenter", res);
  144. if(res.data.code == 200){
  145. this.detail = res.data.data;
  146. }else{
  147. this.$msg('您的状态异常,请重新登录').then(() => {
  148. this.$url('/pages/business/login/login', {type: 'redirect'});
  149. })
  150. }
  151. })
  152. },
  153. // 扫一扫
  154. onScanCode(){
  155. uni.scanCode({
  156. complete: res => {
  157. if(res.errMsg == 'scanCode:ok'){
  158. // 二维码内的内容
  159. let result = this.codeParse(res.result);
  160. if(this.$shared.isValueType(result) == 'object'){
  161. if(result.rand && result.time && result.u_id){
  162. let url = '/pages/business/payment/money';
  163. url += `?u_id=${result.u_id}`;
  164. url += `&rand=${result.rand}`;
  165. url += `&time=${result.time}`;
  166. this.$url(url);
  167. }else if(result.u_id && result.a_id){
  168. this.activityJoin(result);
  169. }else if(result.u_id && result.no){
  170. this.orderSelf(result);
  171. }
  172. }else{
  173. this.$msg('不是有效的支付码');
  174. }
  175. }else{
  176. this.$msg('请扫二维码或条形码');
  177. }
  178. }
  179. })
  180. },
  181. codeParse(str){
  182. str = String(str);
  183. let new_data = null;
  184. try{
  185. new_data = JSON.parse(str);
  186. }catch{
  187. new_data = str;
  188. }
  189. return new_data;
  190. },
  191. // 核销活动
  192. activityJoin(result){
  193. this.$http.post({
  194. api: 'api/supplier/activity/join',
  195. data: {
  196. user_id: result.u_id,
  197. activity_id: result.a_id
  198. },
  199. header: {
  200. token: this.token
  201. }
  202. }).then(res => {
  203. this.$msg(res.data.message || '核销失败');
  204. })
  205. },
  206. // 自提
  207. orderSelf(result){
  208. this.$http.post({
  209. api: `api/supplier/order/self/${result.no}`,
  210. data: {
  211. user_id: result.u_id
  212. },
  213. header: {
  214. token: this.token
  215. }
  216. }).then(res => {
  217. this.$msg(res.data.message || '自提核销成功');
  218. })
  219. }
  220. }
  221. }
  222. </script>
  223. <style lang="scss" scoped="scoped">
  224. .head{
  225. width: 750rpx;
  226. height: 409rpx;
  227. background: linear-gradient(90deg, #1339B8 0%, #092788 100%);
  228. position: relative;
  229. overflow: hidden;
  230. display: flex;
  231. align-items: flex-end;
  232. box-sizing: border-box;
  233. padding: 60rpx 32rpx 110rpx;
  234. color: #FFFFFF;
  235. .bg-left{
  236. position: absolute;
  237. width: 196rpx;
  238. height: 196rpx;
  239. border-radius: 50%;
  240. background-color: rgba(255,255,255,0.04);
  241. left: -92rpx;
  242. bottom: 60rpx;
  243. }
  244. .bg-right{
  245. position: absolute;
  246. width: 520rpx;
  247. height: 520rpx;
  248. border-radius: 50%;
  249. background-color: rgba(255,255,255,0.04);
  250. right: -168rpx;
  251. top: -142rpx;
  252. }
  253. .head-content{
  254. width: 100%;
  255. display: flex;
  256. justify-content: space-between;
  257. position: relative;
  258. z-index: 9;
  259. .head-img{
  260. width: 100rpx;
  261. height: 100rpx;
  262. border: 2rpx solid #FFFFFF;
  263. box-sizing: border-box;
  264. margin-right: 20rpx;
  265. border-radius: 50%;
  266. }
  267. .head-title{
  268. font-size: 36rpx;
  269. color: #FFFFFF;
  270. font-weight: bold;
  271. width: 390rpx;
  272. }
  273. .head-menu{
  274. display: flex;
  275. flex-direction: column;
  276. align-items: center;
  277. justify-content: center;
  278. color: #FFFFFF;
  279. &:nth-child(n+2){
  280. margin-left: 30rpx;
  281. }
  282. &>text:nth-child(1){
  283. font-size: 50rpx;
  284. }
  285. &>text:nth-child(2){
  286. font-size: 24rpx;
  287. }
  288. }
  289. }
  290. }
  291. .notice{
  292. width: 686rpx;
  293. height: 100rpx;
  294. background: #FFFFFF;
  295. box-shadow: 0rpx 2rpx 8rpx 1rpx rgba(0, 0, 0, 0.1);
  296. border-radius: 20rpx;
  297. margin: -50rpx auto 0;
  298. position: relative;
  299. z-index: 9;
  300. padding: 16rpx 4rpx 0;
  301. box-sizing: border-box;
  302. }
  303. .card{
  304. padding: 30rpx;
  305. width: 686rpx;
  306. height: 287rpx;
  307. background: #FFFFFF;
  308. box-shadow: 0rpx 2rpx 8rpx 1rpx rgba(0, 0, 0, 0.1);
  309. border-radius: 20rpx;
  310. margin: 30rpx auto 0;
  311. &:last-child{
  312. margin-bottom: 50rpx;
  313. }
  314. .title{
  315. font-size: 32rpx;
  316. color: #222222;
  317. font-weight: bold;
  318. }
  319. .item{
  320. box-sizing: border-box;
  321. padding: 0 20rpx;
  322. text-align: center;
  323. font-size: 24rpx;
  324. color: #777777;
  325. .num{
  326. font-size: 36rpx;
  327. color: #222222;
  328. font-weight: bold;
  329. // word-break: break-all;
  330. // line-height: 1;
  331. }
  332. }
  333. }
  334. </style>