enquiryDetail.vue 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415
  1. <template>
  2. <a-modal
  3. :title="title"
  4. :width="width"
  5. v-model:open="modalVisible"
  6. centered
  7. :closable="true"
  8. :keyboard="false"
  9. :maskClosable="false"
  10. >
  11. <template #footer>
  12. <a-popconfirm
  13. title="您确定要删除这个询盘吗"
  14. ok-text="是"
  15. cancel-text="否"
  16. @confirm="handleDel"
  17. v-if="showDelBtn"
  18. >
  19. <a-button>删除</a-button>
  20. </a-popconfirm>
  21. <a-button type="primary" @click="handleCancel">关闭</a-button>
  22. </template>
  23. <div class="wrap">
  24. <a-spin :spinning="spinning" tip="正在修改询盘分类">
  25. <p><span>咨询时间:</span>{{ filter_Null_format(record.recordCtime) }}</p>
  26. <p><span>公司:</span>{{ filter_Null_format(record.formCompany) }}</p>
  27. <p><span>姓名:</span>{{ filter_Null_format(record.contact)}}</p>
  28. <p><span>邮箱:</span><a :href="'mailto:'+record.fromEmail">{{filter_Null_format(record.fromEmail)}}</a></p>
  29. <p><span>电话:</span>{{ filter_Null_format(record.phone)}}</p>
  30. <p><span>WhatsApp:</span>{{filter_Null_format(record.whatsApp)}}</p>
  31. <p><span>客户IP:</span>{{ filter_Null_format(record.customerIp) }}</p>
  32. <p style="display: none"><span>来源IP:</span>{{ filter_Null_format(record.fromIp) }}</p>
  33. <p><span>来源国家/地区:</span>{{ filter_Null_format(record.countryName) }}</p>
  34. <template v-if="record.cartItems != null">
  35. <p><span>感兴趣的产品:</span>
  36. <div class="product-list">
  37. <template v-for="item in record.cartItems">
  38. 数量:{{ item.quantity }}, 产品: <a :href="item.productLink" target="_blank">{{ item.productTitle }}</a><br/>
  39. </template>
  40. </div>
  41. </p>
  42. </template>
  43. <p><span>来源页:</span>
  44. <template v-if="!record.fromPage">-</template>
  45. <template v-else-if="record.fromPage.indexOf('http') < 0">-</template>
  46. <template v-else-if="record.fromPage.indexOf('http') === 0">
  47. <template v-if="record.fromPage.lastIndexOf('/') <= 7">
  48. <a
  49. v-if="edition === 1" :href="record.fromPage" target="_blank"
  50. style="text-decoration: underline">Home</a>
  51. <span v-else>Home</span>
  52. </template>
  53. <template v-else>
  54. <a
  55. v-if="edition === 1" :href="record.fromPage" target="_blank"
  56. style="text-decoration: underline">{{ record.fromPage.substring(record.fromPage.lastIndexOf('/') + 1) }}</a>
  57. <span v-else>{{ record.fromPage.substring(record.fromPage.lastIndexOf('/') + 1) }}</span>
  58. </template>
  59. </template>
  60. <template v-else-if="record.fromPage.indexOf('http') > 0">
  61. <a
  62. v-if="edition === 1" :href="record.fromPage.substring(record.fromPage.indexOf('http'))" target="_blank"
  63. style="text-decoration: underline">{{ record.fromPage.substring(0, record.fromPage.indexOf('http')) }}</a>
  64. <span v-else>{{ record.fromPage.substring(0, record.fromPage.indexOf('http')) }}</span>
  65. </template>
  66. <template v-else>-</template>
  67. </p>
  68. <p v-if="userEffectiveOption != undefined"><span>询盘分类:</span>
  69. <a-radio-group v-model:value="modelUserEffective" @change="onChangeUserEffect">
  70. <a-radio v-for="item in userEffectiveOption" :key="item.value" :value="parseInt(item.value)" >
  71. {{item.label}}
  72. </a-radio>
  73. </a-radio-group>
  74. </p>
  75. <p class="translate">
  76. <span>详细内容:</span>
  77. <a-spin tips="翻译中" :spinning="translateStatus">
  78. <span style="flex: auto;" >
  79. <div v-html="record.context" v-if="translateContent == ''">
  80. </div>
  81. <div v-html="translateContent">
  82. </div>
  83. <!-- {{translateContent == '' ? record.context : translateContent}} -->
  84. <i @click="enquiryTransContent">
  85. <img v-if="translateContent == '' " src="../../.././../assets/enquiry/translate1.svg" />
  86. </i>
  87. <i @click="backToEcglish">
  88. <img v-if="translateContent != '' " src="../../.././../assets/enquiry/translate2.svg" />
  89. </i>
  90. </span>
  91. </a-spin>
  92. </p>
  93. <p v-if="record.userEffective == 0 && (userRole.indexOf('admin') > -1 || userRole.indexOf('adweb_admin') > -1 || userRole.indexOf('adweb_seo_manager') > -1 || userRole.indexOf('adweb_site_manager') > -1)"><span>疑似原因:</span>{{ filter_Null_format(record.effectiveReason) }}</p>
  94. <div class="info" v-if="record.specialFieldList && record.specialFieldList.length > 0">
  95. <a-descriptions title="扩展信息" bordered :column=1 class="slef_desc">
  96. <a-descriptions-item :label="item.field" v-for="item in record.specialFieldList">
  97. {{ filter_Null_format(item.value) }}
  98. </a-descriptions-item>
  99. </a-descriptions>
  100. </div>
  101. </a-spin>
  102. </div>
  103. <!-- 垃圾询盘原因填写 -->
  104. <a-modal
  105. :title="wasteEnquiryTitle"
  106. :width="width"
  107. v-model:open="wasteEnquiryVisible"
  108. centered
  109. :closable="true"
  110. :keyboard="false"
  111. :maskClosable="false"
  112. @cancel="wasteEnquiryCancel"
  113. >
  114. <template #footer>
  115. <a-button @click="wasteEnquiryCancel">关闭</a-button>
  116. <a-button type="primary" @click="wasteEnquiryOk">确认</a-button>
  117. </template>
  118. <div class="wrap">
  119. <div class="ant-alert ant-alert-info" style="color: #e74c3c;padding: 5px 8px;">
  120. <span>&nbsp&nbsp&nbsp&nbsp当垃圾询盘类型选择确认后,对应类型的内容便会加入对应黑名单中,同时获取询盘时会把此内容的询盘当作垃圾询盘处理,请谨慎操作。</span>
  121. </div>
  122. <p><span>垃圾询盘类型:</span>
  123. <a-radio-group v-model:value="wasteEnquiryType" @change="onChangeWasteEnquiry">
  124. <a-radio v-for="item in wasteEnquiryOption" :key="item.value" :value="item.value" >
  125. {{item.label}}
  126. </a-radio>
  127. </a-radio-group>
  128. </p>
  129. <p v-if="wasteEnquiryType === 'keyword'">
  130. <span>关键词:</span>
  131. <span style="flex: auto">
  132. 详细内容:{{record.context}}
  133. <i>
  134. <a-textarea v-model:value="wasteEnquirySeason" :placeholder="wasteEnquiryPlaceholder" :auto-size="{ minRows: 3 }" />
  135. </i>
  136. </span>
  137. </p>
  138. <p v-if="wasteEnquiryType === 'other'">
  139. <span>原因:</span>
  140. <a-textarea v-model:value="wasteEnquirySeason" :placeholder="wasteEnquiryPlaceholder" :auto-size="{ minRows: 3 }" />
  141. </p>
  142. </div>
  143. </a-modal>
  144. </a-modal>
  145. </template>
  146. <script lang="js">
  147. import {getAction, postActionForm} from '/@/api/manage/manage'
  148. import {useUserStore} from "@/store/modules/user";
  149. import {useMessage} from "@/hooks/web/useMessage";
  150. const { createMessage } = useMessage();
  151. export default {
  152. name: 'EnquiryDetail',
  153. props:{
  154. userEffectiveOption: Array,
  155. showDelBtn:{
  156. default: false,
  157. type: Boolean,
  158. //目前只支持询盘列表通过询盘详情删除询盘,其他地方不展示删除按钮
  159. }
  160. },
  161. data () {
  162. return {
  163. title:"询盘详情",
  164. width:900,
  165. modalVisible: false,
  166. record:{},
  167. spinning:false,
  168. value:1,
  169. translateStatus:false,
  170. translateContent:'',
  171. modelUserEffective:2,
  172. edition: 1,
  173. userRole: '',
  174. wasteEnquiryTitle:"垃圾询盘类型",
  175. wasteEnquiryVisible: false,
  176. wasteEnquiryOption:[{label:'关键词',value:'keyword'},{label:'邮箱',value:'email'},{label:'IP',value:'ip'},{label:'其他',value:'other'}],
  177. wasteEnquirySeason:'',
  178. wasteEnquiryType:'',
  179. wasteEnquiryPlaceholder:''
  180. }
  181. },
  182. mounted() {
  183. this.userRole = useUserStore().roleList;
  184. },
  185. methods: {
  186. init (record) {
  187. this.translateContent = ''
  188. this.modalVisible=true
  189. this.record = record
  190. this.modelUserEffective = record.userEffective
  191. record.cartItems = JSON.parse(record.cartItems);
  192. },
  193. filter_Null_format(value) {
  194. if(value === '' || value === null || value === undefined){
  195. return '--'
  196. }else{
  197. return value
  198. }
  199. },
  200. handleCancel () {
  201. this.$emit('close');
  202. this.translateContent = ''
  203. this.modalVisible = false;
  204. },
  205. async handleDel() {
  206. //目前该方法只在询盘列表使用
  207. await getAction('/adweb/adwebEnquiry/delBatch', {id: this.record.id}).then((res) => {
  208. if (res.success) {
  209. createMessage.success(`删除询盘成功!`)
  210. } else {
  211. if (res.code == 403) {
  212. createMessage.warning(res.message)
  213. } else {
  214. createMessage.error('删除失败!')
  215. }
  216. }
  217. })
  218. //当删除之后,调用父组件中的重新刷新
  219. this.$emit('reload');
  220. this.modalVisible = false;
  221. },
  222. onChangeUserEffect(e){
  223. let that = this
  224. if(e.target.value === 0){
  225. that.wasteEnquiryVisible = true
  226. }else{
  227. that.submitUserEffect();
  228. }
  229. },
  230. //翻译
  231. enquiryTransContent(r) {
  232. let that = this;
  233. that.translateStatus = true;
  234. // 创建一个表单数据
  235. const formData = new FormData();
  236. formData.append('id', that.record.id);
  237. formData.append('query', that.translateContent === '' ? that.record.context : that.translateContent);
  238. let recordId = that.record.id;
  239. postActionForm('/adweb/adwebEnquiry/enquiryTrans', formData, 1000 * 60 * 2).then(function(res) {
  240. that.translateStatus = false
  241. if (res.code === 200) {
  242. let beforeList = res.result;
  243. if(beforeList == null){
  244. createMessage.error("该内容暂不支持翻译")
  245. return;
  246. }
  247. if (beforeList.length > 0) {
  248. that.translateContent = beforeList
  249. }
  250. } else {
  251. createMessage.error("该内容暂不支持翻译")
  252. }
  253. }).catch(function(err) {
  254. console.log(err)
  255. })
  256. },
  257. backToEcglish(){
  258. this.translateContent = ''
  259. },
  260. wasteEnquiryOk(){
  261. let that = this;
  262. if(that.wasteEnquiryType === 'keyword'){
  263. let season = that.wasteEnquirySeason.trim();
  264. if(season == null || season === ""){
  265. createMessage.warning("关键词不能为空")
  266. that.wasteEnquirySeason = null;
  267. return;
  268. }
  269. }
  270. if(that.wasteEnquiryType === 'other'){
  271. let season = that.wasteEnquirySeason.trim();
  272. if(season == null || season === ""){
  273. createMessage.warning("原因不能为空")
  274. that.wasteEnquirySeason = null;
  275. return;
  276. }
  277. }
  278. that.wasteEnquiryVisible = false;
  279. that.submitUserEffect();
  280. },
  281. wasteEnquiryCancel(){
  282. let that = this;
  283. that.wasteEnquiryVisible = false;
  284. that.modelUserEffective = that.record.userEffective;
  285. that.wasteEnquiryType = "";
  286. that.wasteEnquirySeason = "";
  287. that.wasteEnquiryPlaceholder = "";
  288. },
  289. onChangeWasteEnquiry(e){
  290. let that = this;
  291. that.wasteEnquirySeason = "";
  292. that.wasteEnquiryType = e.target.value;
  293. if(that.wasteEnquiryType === 'email'){
  294. that.wasteEnquirySeason = that.record.fromEmail;
  295. }
  296. if(that.wasteEnquiryType === 'ip'){
  297. that.wasteEnquirySeason = that.record.customerIp;
  298. }
  299. if(that.wasteEnquiryType === 'keyword'){
  300. that.wasteEnquiryPlaceholder = "请输入关键词";
  301. }
  302. if(that.wasteEnquiryType === 'other'){
  303. that.wasteEnquiryPlaceholder = "请输入原因";
  304. }
  305. },
  306. submitUserEffect(){
  307. let that = this;
  308. this.spinning = true
  309. let d = {
  310. id: that.record.id,
  311. siteId: that.record.siteId,
  312. siteCode: that.record.siteCode,
  313. userEffective: that.modelUserEffective,
  314. wasteEnquiryType: that.wasteEnquiryType,
  315. wasteEnquirySeason: that.wasteEnquirySeason
  316. }
  317. postActionForm('/adweb/adwebEnquiry/update/user/effective', d).then(function(res) {
  318. that.spinning = false
  319. if (res.code === 200) {
  320. createMessage.success('分类修改成功!');
  321. that.$emit('ok')
  322. that.record.userEffective = that.modelUserEffective
  323. if(that.wasteEnquiryType === "ip"){
  324. that.record.effectiveReason = "人工操作-ip-" + that.wasteEnquirySeason
  325. }else if(that.wasteEnquiryType === "email"){
  326. that.record.effectiveReason = "人工操作-邮箱-" + that.wasteEnquirySeason
  327. }else if(that.wasteEnquiryType === "keyword"){
  328. that.record.effectiveReason = "人工操作-关键词-" + that.wasteEnquirySeason
  329. }else if(that.wasteEnquiryType === "other"){
  330. that.record.effectiveReason = "人工操作-其他-" + that.wasteEnquirySeason
  331. }
  332. } else {
  333. if (res.code === 403) {
  334. createMessage.warning(res.message)
  335. } else {
  336. createMessage.error('分类修改失败!')
  337. }
  338. }
  339. }).catch(function(err) {
  340. console.log(err)
  341. }).finally(()=>{
  342. that.wasteEnquiryType = "";
  343. that.wasteEnquirySeason = "";
  344. that.wasteEnquiryPlaceholder = "";
  345. })
  346. }
  347. }
  348. }
  349. </script>
  350. <style lang="less" scoped>
  351. .wrap {
  352. p{
  353. margin-bottom: 10px;
  354. border-bottom: 1px solid #e7e7e7;
  355. padding-bottom: 10px;
  356. display: flex;
  357. color: #000;
  358. &:last-child{
  359. border-bottom: none;
  360. }
  361. span{
  362. color: #000;
  363. flex: 110px 0 0;
  364. }
  365. }
  366. /deep/ .ant-radio-wrapper {
  367. color: rgba(0, 0, 0, 1);
  368. }
  369. .translate{
  370. img{
  371. width: 26px;
  372. cursor: pointer;
  373. }
  374. }
  375. .my-text::first-line {
  376. white-space: pre-line;
  377. position: relative; /* 父元素设置为相对定位 */
  378. }
  379. .child {
  380. position: absolute; /* 子元素设置为绝对定位 */
  381. bottom: 0; /* 将其放置在父元素的底部 */
  382. left: 0; /* 将其放置在父元素的左侧 */
  383. }
  384. }
  385. </style>