You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 

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