Explorar el Código

change: 商品详情页启用enquiry按钮.

peter hace 6 días
padre
commit
eda3617910
Se han modificado 1 ficheros con 85 adiciones y 80 borrados
  1. 85 80
      components/product/Quote.vue

+ 85 - 80
components/product/Quote.vue

@@ -160,13 +160,13 @@
             <pc-switch v-model="freight_switch"></pc-switch>
           </div>
         </div>
-        <el-button
-          size="medium"
-          class="button-black"
-          @click="openMailDialog">
-          Enquiry
-        </el-button>
       </section> -->
+      <el-button
+        size="medium"
+        class="button-black"
+        @click="openMailDialog">
+        Enquiry
+      </el-button>
       <!-- <section>
         <unit-table
           :tableData="unitData"
@@ -210,7 +210,7 @@
     <no-ssr>
       <div v-if="quoteLoadState == 1">
         <!-- Enquiry按钮 -->
-        <!-- <form-dialog
+        <form-dialog
           :emailForm="enquiryForm"
           :enquiryConfig="enquiryConfig"
           :visible.sync="enquiryFormVisible"
@@ -218,7 +218,7 @@
           :rules="rules"
           :labelWidth="
             enquiryConfig[3].selectlist?.length ? 140 : 82
-          "></form-dialog> -->
+          "></form-dialog>
         <mail-table
           ref="mailtable"
           :mailData="mailData"
@@ -841,27 +841,32 @@ export default {
     dividePrice(a) {
       return npDivide(+a, 100)
     },
-    // openMailDialog() {
-    //   if (this.$utils.checkLogin()) {
-    //     this.getUserInfo()
-    //     const { contacts, email, phone, crm_users_id:crmUsersId } = this.userInfo
-    //     this.enquiryForm.Name = contacts
-    //     this.enquiryForm.Email = email
-    //     this.enquiryForm.Phone = phone
-    //     if (crmUsersId?.length) {
-    //       this.enquiryConfig[3].selectlist = crmUsersId
-    //       if (crmUsersId?.length === 1) {
-    //         this.enquiryForm['Customer manager'] = crmUsersId[0].name
-    //       }
-    //     } else {
-    //       this.enquiryConfig[3].isShow = false
-    //       this.$delete(this.enquiryForm, 'Customer manager')
-    //     }
-    //     this.enquiryFormVisible = true
-    //   } else {
-    //     this.openDialog()
-    //   }
-    // },
+    openMailDialog() {
+      if (this.$utils.checkLogin()) {
+        this.getUserInfo()
+        const {
+          contacts,
+          email,
+          phone,
+          crm_users_id: crmUsersId,
+        } = this.userInfo
+        this.enquiryForm.Name = contacts
+        this.enquiryForm.Email = email
+        this.enquiryForm.Phone = phone
+        if (crmUsersId?.length) {
+          this.enquiryConfig[3].selectlist = crmUsersId
+          if (crmUsersId?.length === 1) {
+            this.enquiryForm['Customer manager'] = crmUsersId[0].name
+          }
+        } else {
+          this.enquiryConfig[3].isShow = false
+          this.$delete(this.enquiryForm, 'Customer manager')
+        }
+        this.enquiryFormVisible = true
+      } else {
+        this.openDialog()
+      }
+    },
     getMailData() {
       this.mailData.Url = window.location.href
       const { Name, Email, Phone, Comments } = this.enquiryForm
@@ -877,57 +882,57 @@ export default {
       this.mailData['Quote time'] = this.$utils.formatTime(new Date())
     },
     // 发送价格邮件 Enquiry按钮
-    // async sendPriceMail() {
-    //   await this.getMailData()
-    //   await this.getCustomerQuoteData()
-    //   const {
-    //     Name,
-    //     Email,
-    //     Phone,
-    //     Comments,
-    //     'Customer manager': customerManager,
-    //   } = this.enquiryForm
-    //   this.$axios
-    //     .post('/uk-api/quote/sendenquiry', {
-    //       content: this.$refs.mailtable.$el.innerHTML,
-    //       name: Name,
-    //       email: Email,
-    //       phone: Phone,
-    //       customer_manager: customerManager || '',
-    //       url: this.mailData.Url,
-    //       product_code: this.pageData.product_code,
-    //       comments: Comments,
-    //       member_id: this.userInfo.id,
-    //     })
-    //     .then(res => {
-    //       this.setLoading(false)
-    //       this.enquiryFormVisible = false
-    //       this.$confirm('Enquiry Sent', {
-    //         confirmButtonText: 'OK',
-    //         showCancelButton: false,
-    //         type: 'success',
-    //         center: true,
-    //         showClose: false,
-    //         confirmButtonClass: 'com-btnblack',
-    //       }).then(() => {})
-    //     })
-    //     .catch(() => {
-    //       this.setLoading(false)
-    //     })
-    // },
-    // getCustomerQuoteData() {
-    //   const { name, selectAdditionRow } = this.comCurWeekPrice
-    //   this.specificationsObj.time = name
-    //   this.specificationsObj.model = this.comBasePrice.model
-    //   this.specificationsObj.decoration = this.comCurBasePrice.name
-    //   if (selectAdditionRow.length) {
-    //     this.specificationsObj.addonArr = selectAdditionRow.map(
-    //       item => item.name
-    //     )
-    //   } else {
-    //     this.specificationsObj.addonArr = null
-    //   }
-    // },
+    async sendPriceMail() {
+      await this.getMailData()
+      await this.getCustomerQuoteData()
+      const {
+        Name,
+        Email,
+        Phone,
+        Comments,
+        'Customer manager': customerManager,
+      } = this.enquiryForm
+      this.$axios
+        .post('/uk-api/quote/sendenquiry', {
+          content: this.$refs.mailtable.$el.innerHTML,
+          name: Name,
+          email: Email,
+          phone: Phone,
+          customer_manager: customerManager || '',
+          url: this.mailData.Url,
+          product_code: this.pageData.product_code,
+          comments: Comments,
+          member_id: this.userInfo.id,
+        })
+        .then(res => {
+          this.setLoading(false)
+          this.enquiryFormVisible = false
+          this.$confirm('Enquiry Sent', {
+            confirmButtonText: 'OK',
+            showCancelButton: false,
+            type: 'success',
+            center: true,
+            showClose: false,
+            confirmButtonClass: 'com-btnblack',
+          }).then(() => {})
+        })
+        .catch(() => {
+          this.setLoading(false)
+        })
+    },
+    getCustomerQuoteData() {
+      const { name, selectAdditionRow } = this.comCurWeekPrice
+      this.specificationsObj.time = name
+      this.specificationsObj.model = this.comBasePrice.model
+      this.specificationsObj.decoration = this.comCurBasePrice.name
+      if (selectAdditionRow.length) {
+        this.specificationsObj.addonArr = selectAdditionRow.map(
+          item => item.name
+        )
+      } else {
+        this.specificationsObj.addonArr = null
+      }
+    },
     // openDownloadDialog(type) {
     //   this.getCustomerQuoteData()
     //   type