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

443 рядки
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. <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. })
  204. },
  205. baochunfun(){
  206. const {
  207. dataCode
  208. } = uni.getStorageSync("weapp_session_userInfo_data");
  209. if(this.parames.phone.length==0){
  210. this.parames.phone=null
  211. }
  212. uni.showLoading({
  213. title: "保存中",
  214. mask: true
  215. })
  216. if (dataCode == 6) {
  217. this.$u.post("/customer/gwAdd", this.parames).then(res => {
  218. this.saveisshow=true;
  219. uni.hideLoading();
  220. uni.showToast({
  221. icon: "none",
  222. title: "保存成功"
  223. })
  224. uni.navigateBack()
  225. })
  226. } else {
  227. this.$u.post("/customer/add", this.parames).then(res => {
  228. this.saveisshow=true;
  229. uni.hideLoading();
  230. uni.showToast({
  231. icon: "none",
  232. title: "保存成功"
  233. })
  234. uni.navigateBack()
  235. })
  236. }
  237. },
  238. changeSex(sex) {
  239. this.parames.sex = sex;
  240. },
  241. changeHowMany(num) {
  242. this.parames.howMany = num;
  243. },
  244. clickShowhid(){
  245. if(this.freeList.length==0){
  246. uni.showToast({
  247. icon:'none',
  248. title: '当前无可用排班顾问',
  249. duration: 2000
  250. });
  251. }else{
  252. this.Showhid=true;
  253. }
  254. },
  255. cancel1(){
  256. this.Showhid=false;
  257. },
  258. confirm1(e) {
  259. this.text=e[0].label;
  260. this.parames.agentId=e[0].value;
  261. this.Showhid=false;
  262. },
  263. Buildingselection(){
  264. this.Showhiddenunits=true;
  265. },
  266. cancel(){
  267. this.Showhiddenunits=false;
  268. },
  269. confirm(e) {
  270. console.log(e)
  271. this.showSourceName = e[0].label;
  272. this.parames.sourceId=e[0].value;
  273. this.Showhiddenunits=false;
  274. },
  275. init(){
  276. uni.request({
  277. url: config.service.getSelfAssignedByHouseId+"?houseId="+this.parames.projectId,
  278. method: "GET",
  279. header: {
  280. 'content-type': 'application/json',
  281. 'Access-Token': uni.getStorageSync('weapp_session_login_data').token
  282. },
  283. success: (data) => {
  284. if(data.data.code==10000){
  285. this.shifoinfo=data.data.data.selfAssigned
  286. }
  287. }
  288. })
  289. },
  290. //获取顾问列表
  291. getFreeList() {
  292. this.$u.get("/zkAgentPool/freeList?itemId="+this.parames.projectId).then(res => {
  293. this.freeList = res;
  294. this.freeList.forEach(item=>{
  295. if(item.onLine==0){
  296. item.label=item.name+"(离线)";
  297. }else if(item.onLine==1){
  298. item.label=item.name+"(在线)";
  299. }else{
  300. item.label=item.name+"(无设备)";
  301. }
  302. item.value=item.agentId
  303. })
  304. })
  305. },
  306. }
  307. };
  308. </script>
  309. <style lang="scss" scoped>
  310. .sexRadio{
  311. color: #BFBFBF;
  312. border: 1rpx solid #BFBFBF;
  313. font-size: 24upx;
  314. width: 100rpx;
  315. height: 43rpx;
  316. text-align: center;
  317. line-height: 40rpx;
  318. &:last-child {
  319. margin-left: 20rpx;
  320. }
  321. &.active {
  322. color: #2B6FFF;
  323. border-color: #2B6FFF;
  324. }
  325. }
  326. .num {
  327. width: 50rpx;
  328. height: 50rpx;
  329. background: rgba(43, 110, 253, 0.1);
  330. color: #2B6EFD;
  331. font-size: 30rpx;
  332. display: flex;
  333. align-items: center;
  334. justify-content: center;
  335. &.active {
  336. background: #2B6EFD;
  337. color: #FFFFFF;
  338. }
  339. }
  340. .cented-box{
  341. background: #F8F8F8;
  342. width: 100%;
  343. height: 100vh;
  344. }
  345. .Pinspeak{
  346. width: 100%;
  347. height: 92rpx;
  348. border-bottom: 1rpx solid #E0E0E0;
  349. font-size: 32rpx;
  350. font-weight: bold;
  351. color: #333333;
  352. text-indent: 30rpx;
  353. line-height: 92rpx;
  354. background: #FFFFFF;
  355. margin-top: 20rpx;
  356. padding-left: 10rpx;
  357. }
  358. .chented{
  359. width: 100%;
  360. padding-left: 30rpx;
  361. padding-right: 30rpx;
  362. background-color: #FFFFFF;
  363. .title{
  364. width: 100%;
  365. height: 90rpx;
  366. border-bottom: 1rpx solid #E0E0E0;
  367. display: flex;
  368. align-items: center;
  369. .titletext{
  370. width: 21%;
  371. height: 90rpx;
  372. font-size: 30rpx;
  373. font-weight: 400;
  374. color: #333333;
  375. line-height: 90rpx;
  376. text-indent: 10rpx;
  377. }
  378. .titletext2{
  379. width: 71%;
  380. height: 90rpx;
  381. }
  382. .titletext-input{
  383. width: 100%;
  384. height: 90rpx;
  385. font-size: 30rpx;
  386. font-weight: 400;
  387. color: #B2B2B2;
  388. line-height: 90rpx;
  389. padding-left: 10rpx;
  390. }
  391. .titleimg{
  392. width: 8%;
  393. text-align: right;
  394. .titleimg1{
  395. width: 16rpx;
  396. height: 36rpx;
  397. }
  398. }
  399. }
  400. }
  401. .clive{
  402. width: 690rpx;
  403. height: 88rpx;
  404. background: #2671E2;
  405. text-align: center;
  406. line-height: 88rpx;
  407. color: #FFFFFF;
  408. border-radius: 8rpx;
  409. margin: 0 auto;
  410. margin-top: 300rpx;
  411. font-size: 32rpx;
  412. }
  413. .clive2{
  414. width: 690rpx;
  415. height: 88rpx;
  416. background: #9999;
  417. text-align: center;
  418. line-height: 88rpx;
  419. color: #666;
  420. border-radius: 8rpx;
  421. margin: 0 auto;
  422. margin-top: 300rpx;
  423. font-size: 32rpx;
  424. }
  425. </style>