AI销管
Ви не можете вибрати більше 25 тем Теми мають розпочинатися з літери або цифри, можуть містити дефіси (-) і не повинні перевищувати 35 символів.
 
 
 
 

416 рядки
11 KiB

  1. <template>
  2. <view class="cented-box">
  3. <view class="Pinspeak">客户信息</view>
  4. <view class="chented">
  5. <view class="title">
  6. <view class="titletext">客户姓名</view>
  7. <view class="titletext2">
  8. <input class="titletext-input" style="color: #333333;" v-model="parames.name" placeholder-class="titletext-input" placeholder-style="color:#B2B2B2;" type="text" placeholder="请输入客户姓名(必填)" />
  9. </view>
  10. <view class="titleimg">
  11. <!-- <image class="titleimg1" src="../../../static/images/arrow.png" mode=""></image> -->
  12. </view>
  13. </view>
  14. <view class="title">
  15. <view class="titletext">客户性别</view>
  16. <view class="titletext2 displayclick" style="display: flex;align-items: center;padding-left: 10rpx;">
  17. <view class="sexRadio" @click="changeSex(1)" :class="{active:parames.sex == 1}">男士</view>
  18. <view class="sexRadio" @click="changeSex(2)" :class="{active:parames.sex == 2}">女士</view>
  19. </view>
  20. </view>
  21. <view class="title">
  22. <view class="titletext">联系电话</view>
  23. <view class="titletext2">
  24. <input class="titletext-input" style="color: #333333;" v-model="parames.phone" placeholder-class="titletext-input" placeholder-style="color:#B2B2B2;" type="number" placeholder="请输入联系电话" />
  25. </view>
  26. </view>
  27. <view class="title">
  28. <view class="titletext">接待人数</view>
  29. <view class="titletext2" style="display: flex;align-items: center;justify-content: space-around;">
  30. <view class="num" v-for="i in 6" :key="i" :class="{active:parames.howMany == i+1}"
  31. @click="changeHowMany(i+1)">
  32. {{i + 1}}
  33. </view>
  34. </view>
  35. </view>
  36. <view class="title" style="border: none;" @click="Buildingselection()">
  37. <view class="titletext">客户来源</view>
  38. <view class="titletext2" style="font-size: 30rpx;font-weight: 400;color: #B2B2B2;line-height: 90rpx;padding-left: 10rpx;">
  39. <!-- {{parames.sourceName||'请选择客户来源'}} -->
  40. <text v-if="parames.sourceName" style="color: #333333;">{{parames.sourceName}}</text>
  41. <text v-else>请选择客户来源</text>
  42. </view>
  43. <view class="titleimg">
  44. <image class="titleimg1" src="../../../static/images/arrow.png" mode=""></image>
  45. </view>
  46. </view>
  47. </view>
  48. <view class="Pinspeak" v-if="shifoinfo==0">顾问</view>
  49. <view class="chented" v-if="shifoinfo==0" @click="clickShowhid()">
  50. <view class="title" style="border: none;">
  51. <view class="titletext">接待顾问</view>
  52. <view class="titletext2" style="font-size: 30rpx;font-weight: 400;color: #B2B2B2;line-height: 90rpx;padding-left: 10rpx;">
  53. <!-- {{text || '请选择接待顾问'}} -->
  54. <text v-if="text" style="color: #333333;">{{text}}</text>
  55. <text v-else>请选择接待顾问</text>
  56. </view>
  57. <view class="titleimg">
  58. <image class="titleimg1" src="../../../static/images/arrow.png" mode=""></image>
  59. </view>
  60. </view>
  61. </view>
  62. <view class="clive" @click="save">确定</view>
  63. <view v-if="Showhiddenunits">
  64. <u-select :mask-close-able="false" v-model="Showhiddenunits" mode="single-column" :list="list" @cancel="cancel" @confirm="confirm"></u-select>
  65. </view>
  66. <view v-if="Showhid">
  67. <u-select :mask-close-able="false" v-model="Showhid" mode="single-column" :list="freeList" @cancel="cancel1" @confirm="confirm1"></u-select>
  68. </view>
  69. <u-modal v-model="show" :mask-close-able="true" :title="'代接待提醒'" :confirm-text="confirmtext" :cancel-text='canceltext' @cancel="confirmA" @confirm="confirmB" :show-cancel-button='true' :content="content"></u-modal>
  70. </view>
  71. </template>
  72. <script>
  73. var app = getApp();
  74. var config = require("../../../config");
  75. export default {
  76. data() {
  77. return {
  78. Showhiddenunits:false,
  79. list: [
  80. {label: '自然到访',value:'自然到访'},
  81. {label: '渠道推荐',value:'渠道推荐'},
  82. ],
  83. parames: {
  84. name: '',
  85. // 性别1男 2女
  86. sex: 1,
  87. phone: '',
  88. source: null,
  89. sourceName: null,
  90. howMany: 1,
  91. agentId:null,
  92. projectId:'',
  93. replaceReception:0
  94. },
  95. shifoinfo:0,
  96. freeList:[],
  97. Showhid:false,
  98. text:null,
  99. show:false,
  100. content: '东临碣石,以观沧海',
  101. confirmtext:'1',//确认文字
  102. canceltext:'2',//取消文字
  103. daitiReceptionobj:{}
  104. };
  105. },
  106. onShow: function() {
  107. this.parames.projectId=uni.getStorageSync('buildingID').id;
  108. this.init()
  109. this.getFreeList();
  110. },
  111. methods: {
  112. //取消
  113. confirmA(){
  114. if(this.daitiReceptionobj.assign!=null){
  115. this.parames.agentId=this.daitiReceptionobj.assign.accountId;
  116. this.baochunfun()
  117. }else{
  118. uni.showToast({
  119. icon: "none",
  120. title: "【"+this.daitiReceptionobj.owner.name+"】正在接待中"
  121. })
  122. return;
  123. }
  124. },
  125. // 确认
  126. confirmB(){
  127. this.parames.agentId=this.daitiReceptionobj.replacement.accountId;
  128. this.parames.replaceReception=1;
  129. this.baochunfun()
  130. },
  131. save() {
  132. if (this.parames.name.length==0) {
  133. uni.showToast({
  134. icon: "none",
  135. title: "客户姓名不能为空"
  136. })
  137. return;
  138. }
  139. // (this.parames.phone && !this.$u.test.mobile(this.parames.phone))
  140. // if (this.parames.phone) {
  141. // uni.showToast({
  142. // icon: "none",
  143. // title: "手机号码不能为空"
  144. // })
  145. // return;
  146. // }
  147. console.log(this.parames.phone.length)
  148. if (this.parames.phone && this.parames.phone.length<11) {
  149. uni.showToast({
  150. icon: "none",
  151. title: "手机号码不能小于11位"
  152. })
  153. return;
  154. }
  155. if (this.parames.phone && this.parames.phone.length>11) {
  156. uni.showToast({
  157. icon: "none",
  158. title: "手机号码不能大于11位"
  159. })
  160. return;
  161. }
  162. const that = this;
  163. this.$u.post("customer/daitiReception", {
  164. phone: that.parames.phone,
  165. projectId: that.parames.projectId,
  166. agentId:that.parames.agentId
  167. }).then(res => {
  168. if(res.unchecked==0){
  169. that.baochunfun()
  170. }else{
  171. if(res.zs==0){
  172. that.parames.agentId=res.assign.accountId;
  173. that.baochunfun()
  174. }else{
  175. console.log("zo")
  176. if(res.assign==null&&res.replacement==null){
  177. that.baochunfun()
  178. }else{
  179. if(res.assign==null){
  180. that.daitiReceptionobj=res;
  181. that.content="此客户的顾问为【"+ res.owner.name +"】,确认让【"+ res.replacement.name +"】代接待吗?"
  182. that.confirmtext=res.replacement.name +"代接代",//确认文字
  183. that.canceltext=res.owner.name +'接待',//取消文字
  184. that.show=true;
  185. }else{
  186. that.daitiReceptionobj=res;
  187. console.log(that.daitiReceptionobj)
  188. that.content="此客户的顾问为【"+ res.owner.name +"】,确认让【"+ res.replacement.name +"】代接待吗?"
  189. that.confirmtext=res.replacement.name +"代接代",//确认文字
  190. that.canceltext=res.assign.name +'接待',//取消文字
  191. that.show=true;
  192. }
  193. }
  194. }
  195. }
  196. })
  197. },
  198. baochunfun(){
  199. const { dataCode } = uni.getStorageSync("weapp_session_userInfo_data");
  200. if(this.parames.phone.length==0){
  201. this.parames.phone=null
  202. }
  203. uni.showLoading({
  204. title: "保存中",
  205. mask: true
  206. })
  207. if (dataCode == 6) {
  208. this.$u.post("/customer/gwAdd", this.parames).then(res => {
  209. uni.hideLoading();
  210. uni.showToast({
  211. icon: "none",
  212. title: "保存成功"
  213. })
  214. uni.navigateBack()
  215. })
  216. } else {
  217. this.$u.post("/customer/add", this.parames).then(res => {
  218. uni.hideLoading();
  219. uni.showToast({
  220. icon: "none",
  221. title: "保存成功"
  222. })
  223. uni.navigateBack()
  224. })
  225. }
  226. },
  227. changeSex(sex) {
  228. this.parames.sex = sex;
  229. },
  230. changeHowMany(num) {
  231. this.parames.howMany = num;
  232. },
  233. clickShowhid(){
  234. if(this.freeList.length==0){
  235. uni.showToast({
  236. icon:'none',
  237. title: '当前无可用排班顾问',
  238. duration: 2000
  239. });
  240. }else{
  241. this.Showhid=true;
  242. }
  243. },
  244. cancel1(){
  245. this.Showhid=false;
  246. },
  247. confirm1(e) {
  248. this.text=e[0].label;
  249. this.parames.agentId=e[0].value;
  250. this.Showhid=false;
  251. },
  252. Buildingselection(){
  253. this.Showhiddenunits=true;
  254. },
  255. cancel(){
  256. this.Showhiddenunits=false;
  257. },
  258. confirm(e) {
  259. this.parames.sourceName=e[0].value;
  260. this.Showhiddenunits=false;
  261. },
  262. init(){
  263. uni.request({
  264. url: config.service.getSelfAssignedByHouseId+"?houseId="+this.parames.projectId,
  265. method: "GET",
  266. header: {
  267. 'content-type': 'application/json',
  268. 'Authorization': 'Bearer '+uni.getStorageSync('weapp_session_login_data').token
  269. },
  270. success: (data) => {
  271. if(data.data.code==10000){
  272. this.shifoinfo=data.data.data.selfAssigned
  273. }
  274. }
  275. })
  276. },
  277. //获取顾问列表
  278. getFreeList() {
  279. this.$u.get("/zkAgentPool/freeList?itemId="+this.parames.projectId).then(res => {
  280. this.freeList = res;
  281. this.freeList.forEach(item=>{
  282. if(item.onLine==0){
  283. item.label=item.name+"(离线)";
  284. }else if(item.onLine==1){
  285. item.label=item.name+"(在线)";
  286. }else{
  287. item.label=item.name+"(无设备)";
  288. }
  289. item.value=item.agentId
  290. })
  291. })
  292. },
  293. }
  294. };
  295. </script>
  296. <style lang="scss" scoped>
  297. .sexRadio{
  298. color: #BFBFBF;
  299. border: 1rpx solid #BFBFBF;
  300. font-size: 24upx;
  301. width: 100rpx;
  302. height: 43rpx;
  303. text-align: center;
  304. line-height: 40rpx;
  305. &:last-child {
  306. margin-left: 20rpx;
  307. }
  308. &.active {
  309. color: #2B6FFF;
  310. border-color: #2B6FFF;
  311. }
  312. }
  313. .num {
  314. width: 50rpx;
  315. height: 50rpx;
  316. background: rgba(43, 110, 253, 0.1);
  317. color: #2B6EFD;
  318. font-size: 30rpx;
  319. display: flex;
  320. align-items: center;
  321. justify-content: center;
  322. &.active {
  323. background: #2B6EFD;
  324. color: #FFFFFF;
  325. }
  326. }
  327. .cented-box{
  328. background: #F8F8F8;
  329. width: 100%;
  330. height: 100vh;
  331. }
  332. .Pinspeak{
  333. width: 100%;
  334. height: 92rpx;
  335. border-bottom: 1rpx solid #E0E0E0;
  336. font-size: 32rpx;
  337. font-weight: bold;
  338. color: #333333;
  339. text-indent: 30rpx;
  340. line-height: 92rpx;
  341. background: #FFFFFF;
  342. margin-top: 20rpx;
  343. padding-left: 10rpx;
  344. }
  345. .chented{
  346. width: 100%;
  347. padding-left: 30rpx;
  348. padding-right: 30rpx;
  349. background-color: #FFFFFF;
  350. .title{
  351. width: 100%;
  352. height: 90rpx;
  353. border-bottom: 1rpx solid #E0E0E0;
  354. display: flex;
  355. align-items: center;
  356. .titletext{
  357. width: 21%;
  358. height: 90rpx;
  359. font-size: 30rpx;
  360. font-weight: 400;
  361. color: #333333;
  362. line-height: 90rpx;
  363. text-indent: 10rpx;
  364. }
  365. .titletext2{
  366. width: 71%;
  367. height: 90rpx;
  368. }
  369. .titletext-input{
  370. width: 100%;
  371. height: 90rpx;
  372. font-size: 30rpx;
  373. font-weight: 400;
  374. color: #B2B2B2;
  375. line-height: 90rpx;
  376. padding-left: 10rpx;
  377. }
  378. .titleimg{
  379. width: 8%;
  380. text-align: right;
  381. .titleimg1{
  382. width: 16rpx;
  383. height: 36rpx;
  384. }
  385. }
  386. }
  387. }
  388. .clive{
  389. width: 690rpx;
  390. height: 88rpx;
  391. background: #2671E2;
  392. text-align: center;
  393. line-height: 88rpx;
  394. color: #FFFFFF;
  395. border-radius: 8rpx;
  396. margin: 0 auto;
  397. margin-top: 300rpx;
  398. font-size: 32rpx;
  399. }
  400. </style>