Browse Source

Merge branch 'iteration-upload-works'

lex 1 year ago
parent
commit
bac5e4f071
2 changed files with 128 additions and 36 deletions
  1. 44 0
      src/teacher/cash-protocol/index.module.less
  2. 84 36
      src/teacher/cash-protocol/index.tsx

+ 44 - 0
src/teacher/cash-protocol/index.module.less

@@ -11,4 +11,48 @@
     line-height: 44px;
     z-index: 99;
   }
+}
+
+.dialogPopup {
+  width: 84%;
+
+  border-radius: 8px;
+}
+
+.dialogSection {
+  padding: 18px;
+
+  .dialogTitle {
+    display: flex;
+    align-items: center;
+    font-size: 18px;
+    font-weight: 500;
+    color: #333333;
+    line-height: 30px;
+
+    &::before {
+      content: '';
+      width: 4px;
+      height: 17px;
+      background: linear-gradient(180deg, #59E5D5 0%, #2DC7AA 100%);
+      border-radius: 3px;
+      margin-right: 7px;
+    }
+  }
+
+  .dialogContent {
+    padding-top: 20px;
+    padding-bottom: 32px;
+    font-size: 14px;
+    color: #666666;
+    line-height: 20px;
+  }
+
+  .dialogBtn {
+    display: block;
+    width: 114px;
+    height: 40px;
+    font-size: 16px;
+    margin: 0 auto;
+  }
 }

+ 84 - 36
src/teacher/cash-protocol/index.tsx

@@ -1,5 +1,5 @@
 import request from '@/helpers/request'
-import { Button, Toast } from 'vant'
+import { Button, Popup, Toast } from 'vant'
 import { defineComponent } from 'vue'
 import styles from './index.module.less'
 import UserAuth from '@/views/order-detail/userAuth/index'
@@ -7,11 +7,13 @@ import { postMessage } from '@/helpers/native-message'
 import { state } from '@/state'
 import ColHeader from '@/components/col-header'
 import TheSticky from '@/components/the-sticky'
+import { browser } from '@/helpers/utils'
 
 export default defineComponent({
   name: 'cash-protocol',
   data() {
     return {
+      dialogStatus: false,
       realStatus: true, // 是否已经实名认证
       url: '',
       signStatus: '' // 签署状态
@@ -20,18 +22,16 @@ export default defineComponent({
   async mounted() {
     try {
       // 先实名认证
-      console.log(state.user)
       const user = state.user.data
       if (!user.realName || !user.idCardNo) {
         this.realStatus = false
       } else {
+        const { data } = await request.get(
+          '/api-teacher/sysUserContractRecord/checkContractSignV2?contractType=WITHDRAW'
+        )
+        this.signStatus = data
         this.getDetail()
       }
-
-      const { data } = await request.get(
-        '/api-teacher/sysUserContractRecord/checkContractSignV2?contractType=WITHDRAW'
-      )
-      this.signStatus = data
     } catch {
       //
     }
@@ -40,25 +40,41 @@ export default defineComponent({
     async getDetail() {
       try {
         // 查询提现协议
-        const res = await request.get(
-          '/api-teacher/sysUserContractRecord/queryLatestContractTemplate',
-          {
-            params: {
-              contractType: 'WITHDRAW'
+        if (this.signStatus === 'SUCCESS') {
+          const res = await request.get(
+            '/api-teacher/sysUserContractRecord/querySignContract',
+            {
+              params: {
+                contractType: 'WITHDRAW'
+              }
             }
-          }
-        )
+          )
+          this.url =
+            window.location.origin +
+            window.location.pathname +
+            '/pdf/web/viewer.html?file=' +
+            encodeURIComponent(res.data) +
+            '&btn=1'
+        } else {
+          const res = await request.get(
+            '/api-teacher/sysUserContractRecord/queryLatestContractTemplate',
+            {
+              params: {
+                contractType: 'WITHDRAW'
+              }
+            }
+          )
 
-        this.url =
-          window.location.origin +
-          window.location.pathname +
-          '/pdf/web/viewer.html?file=' +
-          // encodeURIComponent(
-          //   'http://daya.ks3-cn-beijing.ksyun.com/202207/TAxRhc6.pdf'
-          // ) +
-          encodeURIComponent(res.data.origanalFileUrl) +
-          '&btn=1'
-      } catch {}
+          this.url =
+            window.location.origin +
+            window.location.pathname +
+            '/pdf/web/viewer.html?file=' +
+            encodeURIComponent(res.data.origanalFileUrl) +
+            '&btn=1'
+        }
+      } catch {
+        //
+      }
     },
     async onSubmit() {
       try {
@@ -67,23 +83,33 @@ export default defineComponent({
             contractType: 'WITHDRAW'
           }
         })
-        setTimeout(() => {
-          Toast('签署成功')
-        }, 100)
-        setTimeout(() => {
-          postMessage({
-            api: 'openPageSuccess',
-            content: {
-              page: 'WITHDRAW'
-            }
-          })
-        }, 1000)
-      } catch {}
+        this.dialogStatus = true
+        // setTimeout(() => {
+        //   // Toast('签署成功')
+        // }, 100)
+        // setTimeout(() => {
+        //   postMessage({
+        //     api: 'openPageSuccess',
+        //     content: {
+        //       page: 'WITHDRAW'
+        //     }
+        //   })
+        // }, 1000)
+      } catch {
+        //
+      }
     },
     onSuccess() {
       // 实名成功
       this.realStatus = true
       this.getDetail()
+    },
+    onBack() {
+      if (browser().isApp) {
+        postMessage({ api: 'goBack' })
+      } else {
+        this.$router.back()
+      }
     }
   },
   render() {
@@ -121,6 +147,28 @@ export default defineComponent({
         ) : (
           <UserAuth hideHeader onSuccess={this.onSuccess} />
         )}
+
+        <Popup
+          v-model:show={this.dialogStatus}
+          round
+          class={styles.dialogPopup}
+        >
+          <div class={styles.dialogSection}>
+            <div class={styles.dialogTitle}>提示</div>
+            <div class={styles.dialogContent}>
+              结算协议签署中,签署成功后即可申请结算
+            </div>
+
+            <Button
+              round
+              type="primary"
+              class={styles.dialogBtn}
+              onClick={() => this.onBack()}
+            >
+              我知道了
+            </Button>
+          </div>
+        </Popup>
       </div>
     )
   }