prize.html 9.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394
  1. <!DOCTYPE html>
  2. <html lang="en">
  3. <head>
  4. <meta charset="UTF-8">
  5. <meta http-equiv="X-UA-Compatible" content="IE=edge">
  6. <meta name="viewport"
  7. content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no, viewport-fit=cover" />
  8. <title>数据查看</title>
  9. <!--引入 element-ui 的样式,-->
  10. <link rel="stylesheet"
  11. href="https://wl-1306604067.cos.ap-guangzhou.myqcloud.com/production/ct/103548289110001/1742018383195/element-ui.css">
  12. <!-- 必须先引入vue, 后使用element-ui -->
  13. <script
  14. src="https://wl-1306604067.cos.ap-guangzhou.myqcloud.com/production/ct/103548289110001/1742017957144/vue.js"></script>
  15. <!-- 引入element 的组件库-->
  16. <script
  17. src="https://wl-1306604067.cos.ap-guangzhou.myqcloud.com/production/ct/103548289110001/1742017747738/element-ui.js"></script>
  18. <!-- <script src="js/vconsole.min.js"></script>
  19. <script>
  20. var vConsole = new window.VConsole();
  21. </script> -->
  22. </head>
  23. <style>
  24. body {
  25. margin: 0;
  26. padding: 0;
  27. }
  28. .box {
  29. width: 100vw;
  30. height: 100vh;
  31. box-sizing: border-box;
  32. background: #FAFAFA;
  33. }
  34. .page4 {
  35. width: 100vw;
  36. height: 100vh;
  37. box-sizing: border-box;
  38. padding: 20px 10px 0;
  39. }
  40. .data_box {
  41. height: 137px;
  42. margin: 0 auto;
  43. background: #FFFFFF;
  44. border-radius: 10px;
  45. padding: 20px 48px;
  46. box-sizing: border-box;
  47. }
  48. .data_title {
  49. font-weight: 500;
  50. font-size: 16px;
  51. color: #222222;
  52. text-align: center;
  53. }
  54. .total_num {
  55. display: flex;
  56. align-items: center;
  57. justify-content: space-between;
  58. text-align: center;
  59. padding-top: 20px;
  60. }
  61. .data_line {
  62. width: 1px;
  63. height: 49px;
  64. background: #F5F5F5;
  65. }
  66. .total {
  67. font-weight: 600;
  68. font-size: 24px;
  69. color: #222222;
  70. line-height: 24px;
  71. }
  72. .des {
  73. font-weight: 400;
  74. font-size: 12px;
  75. color: #222222;
  76. padding-top: 5px;
  77. }
  78. .prize_list {
  79. background: #FFFFFF;
  80. height: calc(100vh - 167px);
  81. margin-top: 10px;
  82. padding: 20px 15px;
  83. box-sizing: border-box;
  84. overflow-y: auto;
  85. }
  86. .prize_title {
  87. display: flex;
  88. align-items: center;
  89. justify-content: center;
  90. padding-bottom: 5px;
  91. }
  92. .prize_title img {
  93. width: 22px;
  94. height: 22px;
  95. }
  96. .prize_title span {
  97. font-weight: 500;
  98. font-size: 16px;
  99. color: #222222;
  100. padding: 0 5px;
  101. }
  102. .prize_item {
  103. display: flex;
  104. align-items: center;
  105. justify-content: space-between;
  106. border-bottom: 1px solid #F9F9F9;
  107. padding: 15px 0 20px;
  108. }
  109. .prize_item_title {
  110. font-weight: 400;
  111. font-size: 14px;
  112. color: #222222;
  113. line-height: 20px;
  114. }
  115. .prize_item_num {
  116. font-weight: 400;
  117. font-size: 12px;
  118. color: #666666;
  119. padding-top: 5px;
  120. line-height: 17px;
  121. }
  122. .prize_item_btn {
  123. width: 72px;
  124. height: 33px;
  125. line-height: 33px;
  126. border-radius: 17px;
  127. font-weight: 500;
  128. font-size: 12px;
  129. color: #FFFFFF;
  130. text-align: center;
  131. }
  132. .btn_no {
  133. background: #2885FF;
  134. }
  135. .btn_ok {
  136. background: #CCCCCC;
  137. }
  138. .el-dialog {
  139. width: 335px;
  140. border-radius: 20px;
  141. }
  142. .el-dialog__header {
  143. text-align: center;
  144. }
  145. .el-dialog__title {
  146. font-weight: 500;
  147. font-size: 16px;
  148. color: #222222;
  149. }
  150. .prize_form .el-form-item {
  151. padding: 0;
  152. }
  153. .prize_form .el-form-item__label {
  154. line-height: 20px;
  155. }
  156. .prize_form .el-input {
  157. border: 1px solid #CCCCCC;
  158. border-radius: 5px;
  159. width: 295px;
  160. }
  161. .prize_form .el-input__inner {
  162. text-align: left;
  163. }
  164. .dialog-footer {
  165. text-align: center;
  166. }
  167. .dialog-footer button {
  168. width: 119px;
  169. height: 46px;
  170. background: #2885FF;
  171. border-radius: 20px;
  172. font-weight: 500;
  173. font-size: 16px;
  174. color: #FFFFFF;
  175. }
  176. </style>
  177. <body>
  178. <div id="box" class="box">
  179. <!-- 数据查看 -->
  180. <div class="page4">
  181. <div class="data_box">
  182. <div class="data_title">新增客户数量</div>
  183. <div class="total_num">
  184. <div>
  185. <div class="total">{{countData.total}}</div>
  186. <div class="des">累计新增客户</div>
  187. </div>
  188. <div class="data_line"></div>
  189. <div>
  190. <div class="total">{{countData.todayAdd}}</div>
  191. <div class="des">今日新增客户</div>
  192. </div>
  193. </div>
  194. </div>
  195. <div class="prize_list">
  196. <div class="prize_title">
  197. <image class="left_icon" src="./img/left.png"></image>
  198. <span>我的奖品</span>
  199. <image class="right_icon" src="./img/right.png"></image>
  200. </div>
  201. <div class="prize_item" v-for="(item, index) in countData.stimulateList" :key="index">
  202. <div class="prize_des">
  203. <div class="prize_item_title">
  204. <span>{{item.complete ? '恭喜您已达成' : '未达成'}}</span>
  205. <span style="color: #2885FF;">
  206. <span v-if="item.rank===1">一等奖:</span>
  207. <span v-if="item.rank===2">二等奖:</span>
  208. <span v-if="item.rank===3">三等奖:</span>
  209. <span>{{item.prizeName}}</span>
  210. </span>
  211. </div>
  212. <div class="prize_item_num" v-if="!item.complete">距离下一阶段奖励还差{{item.needNum}}人</div>
  213. </div>
  214. <div v-if="item.complete">
  215. <div class="prize_item_btn btn_no" @click="handlePrize(item)" v-if="!item.accept">领取奖励</div>
  216. <div class="prize_item_btn btn_ok" v-else>已领取</div>
  217. </div>
  218. </div>
  219. </div>
  220. <el-dialog title="填写收货信息" :visible.sync="showDialog">
  221. <el-form :model="prizeMsg" class="prize_form" label-position="top">
  222. <el-form-item label="收件人">
  223. <el-input v-model="prizeMsg.name"></el-input>
  224. </el-form-item>
  225. <el-form-item label="联系方式">
  226. <el-input v-model="prizeMsg.phone"></el-input>
  227. </el-form-item>
  228. <el-form-item label="收件地址">
  229. <el-input type="textarea" v-model="prizeMsg.address"></el-input>
  230. </el-form-item>
  231. </el-form>
  232. <div slot="footer" class="dialog-footer">
  233. <el-button type="primary" @click="handleSavePrize">确 定</el-button>
  234. </div>
  235. </el-dialog>
  236. </div>
  237. </div>
  238. </body>
  239. <script>
  240. new Vue({
  241. el: '#box',
  242. data () {
  243. return {
  244. httpUrl: '',
  245. memberId: null,
  246. corpId: null,
  247. countData: {
  248. stimulateList: [],
  249. todayAdd: null,
  250. total: null,
  251. },
  252. showDialog: false,
  253. prizeMsg: {
  254. name: '',
  255. phone: '',
  256. address: '',
  257. stimulateId: null,
  258. },
  259. moneyData: {
  260. money: null,
  261. prizeCode: '',
  262. urlQrCode: '',
  263. },
  264. }
  265. },
  266. created () {
  267. this.httpUrl = this.getQueryParam('httpUrl')
  268. this.corpId = this.getQueryParam('corpId')
  269. this.memberId = this.getQueryParam('memberId')
  270. this.showData()
  271. },
  272. methods: {
  273. // 查看数据
  274. showData () {
  275. fetch(this.httpUrl + '/scrm/v1/wxcp-live-code-counselor/p/findCountByH5', {
  276. method: 'post',
  277. body: JSON.stringify({
  278. corpId: this.corpId,
  279. memberId: this.memberId,
  280. }),
  281. headers: {
  282. 'Content-Type': 'application/json'
  283. }
  284. }).then(res => {
  285. return res.json()
  286. }).then(result => {
  287. let { data, code, msg } = result
  288. if (data) {
  289. this.countData = data
  290. } else {
  291. this.$message.error(msg)
  292. }
  293. })
  294. },
  295. // 领取奖励
  296. handlePrize (item) {
  297. this.prizeMsg.stimulateId = item.stimulateId
  298. if (item.acceptType === 1) {
  299. // 表单
  300. this.showDialog = true
  301. } else if (item.acceptType === 2) {
  302. // 红包
  303. this.getRedMoney()
  304. }
  305. },
  306. // 保存填写的收货信息
  307. handleSavePrize () {
  308. fetch(this.httpUrl + '/scrm/v1/wxcp-live-code-counselor/p/receivePrizeByH5', {
  309. method: 'post',
  310. body: JSON.stringify({
  311. corpId: this.corpId,
  312. memberId: this.memberId,
  313. ...this.prizeMsg
  314. }),
  315. headers: {
  316. 'Content-Type': 'application/json'
  317. }
  318. }).then(res => {
  319. return res.json()
  320. }).then(result => {
  321. let { data, code, msg } = result
  322. if (code === 1) {
  323. this.showDialog = false
  324. this.showData()
  325. } else {
  326. this.$message.error(msg)
  327. }
  328. })
  329. },
  330. // 红包数据
  331. getRedMoney () {
  332. fetch(this.httpUrl + '/scrm/v1/wxcp-live-code-counselor/p/receiveMoneyByH5', {
  333. method: 'post',
  334. body: JSON.stringify({
  335. corpId: this.corpId,
  336. memberId: this.memberId,
  337. ...this.prizeMsg
  338. }),
  339. headers: {
  340. 'Content-Type': 'application/json'
  341. }
  342. }).then(res => {
  343. return res.json()
  344. }).then(result => {
  345. let { data, code, msg } = result
  346. if (data) {
  347. // 跳转兑换页
  348. window.location.href = `money.html?prizeCode=${data.prizeCode}&urlQrCode=${data.urlQrCode}`;
  349. }
  350. })
  351. },
  352. // 截取url中的数据
  353. getQueryParam (paramName) {
  354. // 获取当前URL的查询字符串部分
  355. const queryString = window.location.search;
  356. // 创建一个URLSearchParams对象
  357. const urlParams = new URLSearchParams(queryString);
  358. // 返回指定参数的值,如果不存在则返回null
  359. return urlParams.get(paramName);
  360. },
  361. }
  362. })
  363. </script>
  364. </html>