duanshenglang 7 mesi fa
parent
commit
37c8ef7822
2 ha cambiato i file con 379 aggiunte e 387 eliminazioni
  1. 4 387
      lottery/index.html
  2. 375 0
      lottery/onePersonOneCode.html

+ 4 - 387
lottery/index.html

@@ -32,393 +32,6 @@
 		height: 100vh;
 		box-sizing: border-box;
 	}
-
-	.lotteryPage {
-		width: 100%;
-		height: 620px;
-		background: url('./img/lottery-bg.png');
-		background-size: 100% 620px;
-		background-repeat: no-repeat;
-		position: relative;
-	}
-
-	.prize_content {
-		padding: 267px 61px 0 60px;
-		display: flex;
-		flex-wrap: wrap;
-		justify-content: center;
-		gap: 10px;
-	}
-
-	.prize_item {
-		width: 78px;
-		height: 78px;
-		background: url('./img/prize-bg.png');
-		background-size: 78px 78px;
-		background-repeat: no-repeat;
-		display: flex;
-		justify-content: center;
-		align-items: center;
-		flex-direction: column;
-		font-weight: 400;
-		font-size: 10px;
-		color: #CC745A;
-		box-sizing: border-box;
-	}
-
-	.prize_img {
-		width: 48px;
-		height: 48px;
-		padding-bottom: 3px;
-	}
-
-	.lottery_btn {
-		position: absolute;
-		bottom: -14px;
-		display: flex;
-		flex-direction: column;
-		align-items: center;
-		width: 100%;
-	}
-
-	.btn_img {
-		width: 290px;
-	}
-
-	.lottery_tip {
-		text-align: center;
-		font-size: 14px;
-		color: #FFFFFF;
-		font-weight: 600;
-		line-height: 14px;
-	}
-
-	.rule {
-		width: 100%;
-		height: 509px;
-		background: linear-gradient(180deg, #FF6C52 0%, #FFBA9B 100%);
-		margin-top: -50px;
-		padding: 65px 15px 40px;
-		box-sizing: border-box;
-	}
-
-	.rule_body {
-		height: 404px;
-		background: #FEE8D0;
-		border-radius: 20px;
-		padding: 20px 15px;
-		box-sizing: border-box;
-	}
-
-	.tabs {
-		display: flex;
-		justify-content: space-around;
-		align-items: center;
-		padding: 0 2px;
-		margin: 0 auto;
-		width: 255px;
-		height: 34px;
-		background: rgba(255, 125, 97, 0.2);
-		border-radius: 17px 17px 17px 17px;
-	}
-
-	.tab_link {
-		border: none;
-		outline: none;
-		cursor: pointer;
-		transition: 0.3s;
-		color: #FF765B;
-		background: unset;
-		width: 125px;
-		height: 30px;
-		border-radius: 17px
-	}
-
-	.tab_link:active {
-		background: rgba(255, 125, 97, 0.2);
-	}
-
-	.tab_link.active {
-		background: #FFFFFF;
-	}
-
-	.tab_content {
-		p {
-			font-weight: 400;
-			font-size: 14px;
-			color: #CB4E35;
-			margin-top: 20px;
-		}
-	}
-
-	.record_list {
-		overflow-y: auto;
-		height: 300px;
-		margin-top: 18px;
-	}
-
-	.record_item {
-		width: 315px;
-		height: 72px;
-		background: #FEDFC9;
-		border-radius: 10px;
-		padding: 9px 10px 8px;
-		display: flex;
-		align-items: center;
-		margin: 0 auto 10px;
-		box-sizing: border-box;
-	}
-
-	.record_img {
-		width: 55px;
-		height: 55px;
-		border-radius: 10px;
-		margin-right: 8px;
-	}
-
-	.get_btn {
-		width: 72px;
-		height: 30px;
-		background: #FF4646;
-		border-radius: 17px;
-		font-size: 14px;
-		color: #FFFFFF;
-		margin-left: 30px;
-		padding: 0;
-	}
-
-	.prize_name {
-		font-size: 14px;
-		font-weight: 500;
-		color: #FF4646;
-	}
-
-	.prize_time {
-		font-size: 12px;
-		color: #FF6767;
-	}
-
-	.el-dialog {
-		width: 335px;
-		border-radius: 20px;
-	}
-
-	.el-dialog__header {
-		text-align: center;
-	}
-
-	.el-dialog__title {
-		font-weight: 500;
-		font-size: 16px;
-		color: #222222;
-	}
-
-	.el-dialog__body {
-		height: 260px;
-		overflow-y: auto;
-	}
-
-	.prize_form .el-form-item {
-		padding: 0;
-	}
-
-	.prize_form .el-form-item__label {
-		line-height: 20px;
-	}
-
-	.prize_form .el-input {
-		width: 295px;
-	}
-
-	.prize_form .el-input__inner {
-		text-align: left;
-	}
-
-	.prize_form .el-input.is-active .el-input__inner,
-	.prize_form .el-input__inner:focus {
-		border: 1px solid #FF4646;
-	}
-
-	.prize_form .el-textarea.is-active .el-textarea__inner,
-	.prize_form .el-textarea__inner:focus {
-		border: 1px solid #FF4646;
-	}
-
-	.el-radio__input.is-checked .el-radio__inner {
-		border-color: #FF4646;
-		background: #FF4646;
-	}
-
-	.el-radio__input.is-checked+.el-radio__label {
-		color: #FF4646;
-	}
-
-	.el-select .el-input.is-focus .el-input__inner {
-		border-color: #FF4646;
-	}
-
-	.dialog-footer {
-		text-align: center;
-	}
-
-	.dialog-footer button {
-		width: 100%;
-		height: 46px;
-		background: #FF4646;
-		border-radius: 20px;
-		font-weight: 500;
-		font-size: 16px;
-		color: #FFFFFF;
-		border: none;
-	}
-
-	.prize_dialog {
-		position: fixed;
-		top: 0;
-		left: 0;
-		width: 100%;
-		height: 100%;
-		background-color: rgba(0, 0, 0, 0.5);
-		/* 半透明黑色 */
-		z-index: 1000;
-		/* 确保遮罩层在顶部 */
-		transition: opacity 0.5s ease;
-		/* 可选:添加透明度过渡效果 */
-	}
-
-	.dialog-body {
-		width: 100%;
-		height: 100%;
-		z-index: 1001;
-		/* 确保遮罩层在顶部 */
-		display: flex;
-		flex-direction: column;
-		align-items: center;
-		justify-content: center;
-	}
-
-	.dialog-tip {
-		width: 100%;
-		height: 100px;
-	}
-
-	.dialog-bg {
-		width: 295px;
-		height: 251px;
-		position: relative;
-	}
-
-	.prize-msg {
-		position: absolute;
-		text-align: center;
-	}
-
-	.money-title {
-		font-weight: 500;
-		font-size: 16px;
-		color: #FF4E4E;
-		padding-top: 90px;
-		padding-bottom: 10px;
-	}
-
-	.money-content {
-		margin-bottom: 30px;
-		height: 60px;
-		display: flex;
-		justify-content: center;
-		align-items: center;
-	}
-
-	.prize-money {
-		font-weight: bold;
-		font-size: 60px;
-		color: #FF4E4E;
-	}
-
-	.prize-unit {
-		font-weight: 500;
-		font-size: 16px;
-		color: #FF4E4E;
-		padding-left: 10px;
-		padding-top: 28px;
-	}
-
-	.dialog-btn {
-		width: 235px;
-		height: 52px;
-		margin-bottom: 10px;
-	}
-
-	.money-tip {
-		font-weight: 400;
-		font-size: 12px;
-		color: #999999;
-		margin-bottom: 15px;
-	}
-
-	.goods-img {
-		width: 100px;
-		height: 100px;
-		margin: 70px 0 10px;
-	}
-
-	.goods-name {
-		font-weight: 500;
-		font-size: 16px;
-		color: #222222;
-		margin-bottom: 20px;
-	}
-
-	.dialog-close {
-		width: 30px;
-		height: 30px;
-		margin-top: 20px;
-	}
-
-	.actives {
-		border: 2px solid #df2727;
-		border-radius: 15px;
-	}
-
-	.event_notice {
-		width: 30px;
-		height: 84px;
-		background: rgba(255, 255, 255, 0.5);
-		border-radius: 15px 0px 0px 15px;
-		border: 1px solid #FFFFFF;
-		font-weight: 500;
-		font-size: 14px;
-		color: #FF4E4E;
-		position: absolute;
-		right: 0;
-		top: 20%;
-		writing-mode: vertical-rl;
-		text-align: center;
-		padding-right: 4px;
-	}
-
-	.qrcode {
-		width: 100vw;
-		height: 100vh;
-		box-sizing: border-box;
-		display: flex;
-		align-items: center;
-		justify-content: center;
-		flex-direction: column;
-	}
-
-	.qrcode-msg {
-		text-align: center;
-		font-size: 18px;
-	}
-
-	.alert_dialog {
-		z-index: 999;
-		position: fixed;
-		top: 0;
-		left: 0;
-		width: 100%;
-	}
 </style>
 
 <body>
@@ -547,6 +160,10 @@
 						// 客户画像
 						var currentQueryParams = window.location.search;
 						window.location.replace('userProfile.html' + currentQueryParams)
+					} else if (this.h5Type == 35) {
+						// 客户画像
+						var currentQueryParams = window.location.search;
+						window.location.replace('onePersonOneCode.html' + currentQueryParams)
 					} else if (!this.h5Type) {
 						this.getAuth()
 					}

+ 375 - 0
lottery/onePersonOneCode.html

@@ -0,0 +1,375 @@
+<!DOCTYPE html>
+<html lang="en">
+
+<head>
+  <meta charset="UTF-8">
+  <meta http-equiv="X-UA-Compatible" content="IE=edge">
+  <meta name="viewport"
+    content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no, viewport-fit=cover" />
+  <title>专属活码</title>
+  <!--引入 element-ui 的样式,-->
+  <link rel="stylesheet"
+    href="https://wl-1306604067.cos.ap-guangzhou.myqcloud.com/production/ct/103548289110001/1742018383195/element-ui.css">
+  <!-- 必须先引入vue,  后使用element-ui -->
+  <script
+    src="https://wl-1306604067.cos.ap-guangzhou.myqcloud.com/production/ct/103548289110001/1742017957144/vue.js"></script>
+  <!-- 引入element 的组件库-->
+  <script
+    src="https://wl-1306604067.cos.ap-guangzhou.myqcloud.com/production/ct/103548289110001/1742017747738/element-ui.js"></script>
+  <script src="js/vconsole.min.js"></script>
+  <script>
+		  var vConsole = new window.VConsole();
+		</script>
+</head>
+<style>
+  body {
+    margin: 0;
+    padding: 0;
+  }
+
+  .box {
+    width: 100vw;
+    height: 100vh;
+    box-sizing: border-box;
+  }
+
+  .page1 {
+    background: #FAFAFA;
+  }
+
+  .page2 {
+    background: #FFFFFF;
+  }
+
+  .ready_code_box {
+    position: relative;
+    padding-top: 70px;
+  }
+
+  .ready_code {
+    width: 100%;
+  }
+
+  .code_tip {
+    position: absolute;
+    bottom: 7px;
+    font-weight: bold;
+    font-size: 24px;
+    color: #222222;
+    text-align: center;
+    width: 100%;
+  }
+
+  .form_title {
+    font-weight: bold;
+    font-size: 24px;
+    color: #222222;
+    text-align: center;
+    width: 100%;
+    padding: 60px 0 7px;
+    background: #FAFAFA;
+  }
+
+  .main_tip {
+    color: #2885FF;
+  }
+
+  .page_tip {
+    font-weight: 500;
+    font-size: 14px;
+    color: #222222;
+    text-align: center;
+    width: 100%;
+    padding-top: 8px;
+  }
+
+  .page_tip_page2 {
+    padding-bottom: 40px;
+  }
+
+  .form_list {
+    background: #FFFFFF;
+  }
+
+  .el-form-item__label {
+    padding-right: 0;
+    font-weight: 500;
+    font-size: 14px;
+    color: #666666;
+  }
+
+  .el-input__inner {
+    border: none;
+    font-weight: 500;
+    font-size: 14px;
+    color: #222222;
+    text-align: right;
+  }
+
+  .el-form-item {
+    margin-bottom: 0;
+    border-bottom: 1px solid #F9F9F9;
+    padding: 10px 0;
+    padding-left: 35px;
+  }
+  .post_box {
+    padding: 20px 35px;
+    height: calc(100vh - 92px);
+    box-sizing: border-box;
+    display: flex;
+    justify-content: center;
+    align-items: center;
+  }
+  .post_img {
+    width: auto;
+    height: auto;
+    max-width: 100%;
+    max-height: 100%;
+  }
+  .foot_btn {
+    position: absolute;
+    bottom: 40px;
+    padding: 0 35px;
+    width: 100%;
+    box-sizing: border-box;
+  }
+  
+  .create_btn {
+    width: 100%;
+    height: 52px;
+    background: #222222;
+    border-radius: 20px;
+    font-weight: 500;
+    font-size: 16px;
+    color: #FFFFFF;
+    text-align: center;
+  }
+  .save_btn {
+    width: 100%;
+    height: 52px;
+    line-height: 52px;
+    text-align: center;
+    border-radius: 20px;
+    border: 1px solid #222222;
+    box-sizing: border-box;
+    font-weight: 500;
+    font-size: 16px;
+    color: #222222;
+  }
+</style>
+
+<body>
+  <div id="box" class="box" :class="step === 2 ? 'page2' : 'page1'">
+    <!--  引导页面 -->
+    <div v-if="step === 1">
+      <div class="ready_code_box">
+        <image class="ready_code" src="./img/ready_code.png"></image>
+        <div class="code_tip">
+          <span>生成我的</span>
+          <span class="main_tip">专属活码</span>
+        </div>
+      </div>
+      <div class="page_tip">引导门店客户添加,领取引流激励!</div>
+      <div class="foot_btn">
+        <div class="create_btn" style="line-height: 52px;" @click="createQrcode">创建活码</div>
+      </div>
+    </div>
+    <!-- 创建活码 -->
+    <div v-if="step === 2">
+      <div class="form_title">
+        <span>生成我的</span>
+        <span class="main_tip">专属活码</span>
+      </div>
+      <div class="page_tip page1 page_tip_page2">引导好友添加,领取引流激励!</div>
+      <div class="form_list">
+        <el-form ref="form" :model="form" label-position="left" label-width="84px">
+          <el-form-item label="顾问姓名:">
+            <el-input v-model="form.salesMan" placeholder="请输入"></el-input>
+          </el-form-item>
+          <el-form-item label="合伙人姓名:">
+            <el-input v-model="form.partner" placeholder="请输入"></el-input>
+          </el-form-item>
+        </el-form>
+      </div>
+      <div class="foot_btn">
+        <el-button class="create_btn" :loading="loading" @click="handleQrcode">创建活码</el-button>
+      </div>
+    </div>
+    <!-- 我的活码 -->
+    <div v-if="step === 3">
+      <div class="post_box">
+        <image class="post_img" :src="postCode"></image>
+      </div>
+      <div class="foot_btn">
+        <div class="save_btn" @click="saveImage">长按二维码保存</div>
+      </div>
+    </div>
+  </div>
+</body>
+<script>
+  new Vue({
+    el: '#box',
+    data() {
+      return {
+        httpUrl: '',
+        bId: null,
+        env: '',
+        step: null,
+        postCode: '',
+        form: {
+          salesMan: '',
+          partner: '',
+          ownerDealerCode: '',
+          phone: ''
+        },
+        loading: false,
+      }
+    },
+    created() {
+      this.bId = this.getQueryParam('bId')
+      this.env = this.getQueryParam('env')
+
+      if (!this.env || this.env === 'prod') {
+        this.httpUrl = 'https://wlapi.wefanbot.com'
+      } else {
+        this.httpUrl = 'http://test.wefanbot.com:18993'
+      }
+      localStorage.removeItem('openId')
+      this.ifH5Type()
+    },
+    methods: {
+      ifH5Type() {
+        if (this.getQueryParam('openId') || localStorage.getItem('openId')) {
+          this.findQrCode()
+        } else {
+          // 走授权操作
+          this.getAuth();
+        }
+      },
+      getAuth() {
+        // 获取url上的code
+        let code = this.getQueryParam('code')
+        if (code) {
+          // 判断业务id是否生产环境业务id
+          fetch(this.httpUrl + `/p/insuite/p/isProdId?id=${this.bId}`)
+            .then(res => {
+              return res.json()
+            }).then(result => {
+              let { data, msg } = result
+              if (typeof data === 'boolean' && data) {
+                this.httpUrl = 'https://wlapi.wefanbot.com'
+              } else {
+                this.httpUrl = 'http://test.wefanbot.com:18993'
+              }
+              this.getInfoByh5Code(this.getQueryParam('code'))
+            })
+        } else {
+          let redirect_uri = window.location.href
+          // code 不存在,走微信网页授权逻辑 
+          let url = `https://open.weixin.qq.com/connect/oauth2/authorize?appId=wx99ec0d0828a4d2d3&redirect_uri=${redirect_uri}&scope=snsapi_userinfo&state=STATE#wechat_redirect`
+          window.location.replace(url)
+        }
+      },
+      getInfoByh5Code(code) {
+        fetch(this.httpUrl + `/scrm/v1/mp-client/p/getInfoByh5Code?code=${code}&bId=${this.bId}`)
+          .then(res => {
+            return res.json()
+          }).then(result => {
+            let { data, code, msg } = result
+            if (code === 1) {
+              localStorage.setItem('openId', data.openId)
+              this.ifH5Type()
+            }
+          })
+      },
+      findQrCode() {
+        fetch(this.httpUrl + '/scrm/v1/wxcp-live-code-opoc/p/findQrCodeByH5', {
+          method: 'post',
+          body: JSON.stringify({
+            bid: this.bId,
+            openId: this.getQueryParam('openId') || localStorage.getItem('openId'),
+          }),
+          headers: {
+            'Content-Type': 'application/json'
+          }
+        }).then(res => {
+          return res.json()
+        }).then(result => {
+          let { data, code, msg } = result
+          if (code === 1) {
+            if (data && data.postCode) {
+              this.step = 3
+              this.postCode = data.postCode
+            } else {
+              this.step = 1
+            }
+          } else {
+            this.$message.error(msg)
+            this.step = 1 
+          }
+        })
+      },
+      createQrcode() {
+        this.step = 2
+      },
+      // 创建活码
+      handleQrcode() {
+        if (!this.form.salesMan) {
+          this.$message.error('请输入顾问姓名')
+          return 
+        }
+        if (!this.form.partner) {
+          this.$message.error('请输入合伙人姓名')
+          return 
+        }
+        this.loading = true
+        fetch(this.httpUrl + '/scrm/v1/wxcp-live-code-opoc/p/addByH5', {
+          method: 'post',
+          body: JSON.stringify({
+            bid: this.bId,
+            openId: this.getQueryParam('openId') || localStorage.getItem('openId'),
+            ...this.form
+          }),
+          headers: {
+            'Content-Type': 'application/json'
+          }
+        }).then(res => {
+          return res.json()
+        }).then(result => {
+          let { data, code, msg } = result
+          if (code === 1) {
+            if (data && data.postCode) {
+              this.step = 3
+              this.postCode = data.postCode
+            } else {
+              this.step = 1
+            }
+          } else {
+            this.$message.error(msg)
+            this.step = 1
+          }
+        }).finally(() => {
+          this.loading = false
+        })
+      },
+      // 保存二维码
+      saveImage() {
+        this.$message({
+          message: '长按二维码保存',
+          type: 'success',
+        })
+      },
+      // 截取url中的数据
+      getQueryParam(paramName) {
+        // 获取当前URL的查询字符串部分  
+        const queryString = window.location.search;
+        // 创建一个URLSearchParams对象  
+        const urlParams = new URLSearchParams(queryString);
+        // 返回指定参数的值,如果不存在则返回null  
+        return urlParams.get(paramName);
+      },
+    }
+  })   
+</script>
+
+</html>