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.
 
 
 

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