complaint.vue 9.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391
  1. <template>
  2. <view class="cooperation">
  3. <u-toast ref="uToast" />
  4. <view class="formBgc">
  5. <view class="form">
  6. <view class="item message" >
  7. <view class="label">
  8. 您的称呼:
  9. </view>
  10. <input v-model="name" placeholder-style="font-size:24rpx;text-align:right" placeholder="输入您的称呼" type="text" />
  11. </view>
  12. <view class="item message">
  13. <view class="label">
  14. 联系电话:
  15. </view>
  16. <view class="sms">
  17. <input v-model="phone" maxlength="11" placeholder-style="font-size:24rpx;text-align:right" placeholder="输入您的电话" type="text" />
  18. <view class="wrap" v-if="configAll.system_sms_open">
  19. <u-toast ref="uToast"></u-toast>
  20. <u-verification-code :seconds="seconds" start-text="验证码" @end="end" @start="start" ref="uCode"
  21. @change="codeChange"></u-verification-code>
  22. <view class="tips" @tap="getCode" >{{tips}}</view>
  23. </view>
  24. </view>
  25. </view>
  26. <view class="item message" v-if="configAll.system_sms_open">
  27. <view class="label">
  28. 验证码:
  29. </view>
  30. <input v-model="sms_code" max placeholder-style="font-size:24rpx;text-align:right" maxlength="4" placeholder="输入验证码" type="text" />
  31. </view>
  32. <view class="item message" >
  33. <view class="label">
  34. 标题:
  35. </view>
  36. <input v-model="title" maxlength="10" placeholder-style="font-size:24rpx;text-align:right" placeholder="输入标题(10字内)" type="text" />
  37. </view>
  38. <view class="item textarea">
  39. <view class="inputTextarea">
  40. <u-input v-model="content" type="textarea" height="230" placeholder-style="font-size:24rpx;color:#CBCBCB;" :clearable="false" placeholder="请输入购买手机号遇到的问题(120字内)我们将在24小时内给您回复"/>
  41. </view>
  42. <view class="label">
  43. 付款截图:(最多3张,大小1M内)
  44. </view>
  45. <!-- width="600rpx" height="300rpx" -->
  46. <u-upload ref="uUpload1" max-count="3" @on-change="progress1" :action="action" ></u-upload>
  47. </view>
  48. <view class="btn">
  49. <u-button @click="business_form()">提交</u-button>
  50. </view>
  51. </view>
  52. </view>
  53. </view>
  54. </template>
  55. <script>
  56. export default {
  57. data() {
  58. return {
  59. name:'',
  60. phone:'',//手机号
  61. sms_code:'',//短信
  62. title: '',
  63. content: '',
  64. // refCode: null,
  65. seconds: 60,
  66. tips: '获取验证码',
  67. // 上传地址
  68. action: '',
  69. };
  70. },
  71. onLoad() {
  72. this.action=this.$httpUrl+'/api/common/upload'
  73. },
  74. methods: {
  75. progress1(res, index, lists, name){
  76. // console.log(JSON.parse(res.data))
  77. if(JSON.parse(res.data).code==0){
  78. this.$refs.uToast.show({
  79. title: JSON.parse(res.data).msg,
  80. type: 'error ',
  81. })
  82. this.$refs.uUpload1.clear()
  83. }
  84. },
  85. codeChange(text) {
  86. this.tips = text;
  87. },
  88. //商务合作
  89. business_form(){
  90. if(this.name==''){
  91. this.$refs.uToast.show({
  92. title: '请输入姓名',
  93. type: 'error ',
  94. })
  95. return;
  96. }
  97. if(!this.$check.checkName(this.name)){
  98. this.$refs.uToast.show({
  99. title: '请输入正确的格式',
  100. type: 'error ',
  101. })
  102. return;
  103. }
  104. if(this.phone==''){
  105. this.$refs.uToast.show({
  106. title: '请输入手机号',
  107. type: 'error ',
  108. })
  109. return;
  110. }
  111. if(!this.$check.checkMobile(this.phone)){
  112. this.$refs.uToast.show({
  113. title: '请输入正确手机号的格式',
  114. type: 'error ',
  115. })
  116. return;
  117. }
  118. if(this.phone==''){
  119. this.$refs.uToast.show({
  120. title: '请输入手机号',
  121. type: 'error ',
  122. })
  123. return;
  124. }
  125. if(this.title==''){
  126. this.$refs.uToast.show({
  127. title: '请输入标题',
  128. type: 'error ',
  129. })
  130. return;
  131. }
  132. let files1 = [];
  133. files1 = this.$refs.uUpload1.lists.filter(val => {
  134. return val.progress == 100;
  135. })
  136. let imgs=[]
  137. if(files1.length>0){
  138. files1.forEach(item=>{
  139. imgs.push(item.response.data.url)
  140. })
  141. }else{
  142. this.$refs.uToast.show({
  143. title: '请上传截图',
  144. type: 'error ',
  145. })
  146. return;
  147. }
  148. console.log(imgs)
  149. let obj={
  150. name:this.name,
  151. phone:this.phone,
  152. sms_code:this.sms_code,
  153. title:this.title,
  154. content:this.content,
  155. images:imgs,
  156. }
  157. this.$http.feedback(obj).then(res=>{
  158. console.log(res)
  159. if(res.data.code==1){
  160. uni.reLaunch({
  161. url: '/pages/index/index',
  162. })
  163. }else{
  164. this.$refs.uToast.show({
  165. title: res.data.msg,
  166. type: 'error ',
  167. })
  168. }
  169. })
  170. },
  171. // 获取短信
  172. getCode() {
  173. console.log('发送验证码')
  174. if(this.$refs.uCode.canGetCode) {
  175. // 模拟向后端请求验证码
  176. // uni.showLoading({
  177. // title: '正在获取验证码'
  178. // })
  179. console.log(this.phone)
  180. if(this.phone==''){
  181. this.$refs.uToast.show({
  182. title: '请输入手机号',
  183. type: 'error ',
  184. })
  185. return;
  186. }
  187. if (!this.$check.checkMobile.test(this.phone)) {
  188. this.$refs.uToast.show({
  189. title: '请输入正确的手机号格式',
  190. type: 'warning ',
  191. })
  192. return;
  193. }
  194. this.$http.send({mobile:this.phone,event:'complaint'})
  195. .then(res=>{
  196. console.log(res)
  197. if(res.data.code==1){
  198. this.$u.toast('验证码已发送');
  199. this.$refs.uCode.start();
  200. }else{
  201. this.$refs.uToast.show({
  202. title: res.data.msg,
  203. type: 'error ',
  204. })
  205. }
  206. })
  207. // setTimeout(() => {
  208. // uni.hideLoading();
  209. // // 这里此提示会被this.start()方法中的提示覆盖
  210. // this.$u.toast('验证码已发送');
  211. // // 通知验证码组件内部开始倒计时
  212. // this.$refs.uCode.start();
  213. // }, 2000);
  214. } else {
  215. this.$u.toast('倒计时结束后再发送');
  216. }
  217. },
  218. end() {
  219. // this.$u.toast('倒计时结束');
  220. },
  221. start() {
  222. // this.$u.toast('倒计时开始');
  223. },
  224. }
  225. };
  226. </script>
  227. <style lang="scss">
  228. .cooperation{
  229. width: 100%;
  230. .formBgc{
  231. // border-top: 1rpx solid #fff;
  232. width: 100%;
  233. height: 725rpx;
  234. background: linear-gradient(rgb(213, 46, 76), #fff);
  235. padding-top: 30rpx;
  236. .form{
  237. background-color: #fff;
  238. margin: 0rpx 20rpx 0;
  239. box-sizing: border-box;
  240. padding: 25rpx;
  241. border-radius: 10rpx;
  242. /deep/ .u-radio__label{
  243. font-size: 25rpx
  244. }
  245. /deep/ .u-radio-group{
  246. margin-left: 28rpx;
  247. margin-bottom:4rpx;
  248. }
  249. /deep/ input::-webkit-input-placeholder {
  250. /* placeholder颜色 */
  251. color: #aab2bd;
  252. /* placeholder字体大小 */
  253. font-size: 24rpx;
  254. }
  255. .item{
  256. padding:33rpx 0;
  257. border-bottom: 1rpx solid #F2F2F7;
  258. display: flex;
  259. flex-wrap: wrap;
  260. justify-content: left;
  261. .label{
  262. position: relative;
  263. font-size: 24rpx;
  264. color: #333;
  265. padding-left: 20rpx;
  266. }
  267. .label::after{
  268. position: absolute;
  269. content:'*';
  270. color: $uni-color-BGC;
  271. top: 50%;
  272. transform: translateY(-50%);
  273. left: 0;
  274. }
  275. }
  276. .textarea{
  277. display:block;
  278. .inputTextarea{
  279. border: 1px solid #e2e2e2;
  280. border-radius: 10rpx;
  281. padding: 10rpx;
  282. }
  283. /deep/ .u-input{
  284. width: 100%;
  285. padding: 10rpx 0;
  286. }
  287. /depp/ .u-add-wrap{
  288. display: none;
  289. }
  290. .label{
  291. margin: 20rpx 0;
  292. }
  293. }
  294. .type{
  295. position: relative;
  296. box-sizing: border-box;
  297. padding-left: 90rpx;
  298. border-bottom: 1rpx solid #F2F2F7;
  299. .label{
  300. position: absolute;
  301. top: 50%;
  302. left: 0;
  303. transform: translateY(-50%);
  304. font-size: 25rpx;
  305. }
  306. .inputBox{
  307. display: flex;
  308. flex-wrap: wrap;
  309. // justify-content: space-between;
  310. }
  311. .inputBoxTop{
  312. margin-top: 16rpx;
  313. }
  314. /deep/ input{
  315. width:230rpx;
  316. height: 42rpx;
  317. line-height: 42rpx;
  318. background: #FFFFFF;
  319. min-height: 42rpx;
  320. max-height: 42rpx;
  321. border-radius: 8rpx;
  322. font-size: 20rpx;
  323. color: #BABABA;
  324. border: 1rpx solid rgba(86, 86, 86, 0.2);
  325. padding: 0 16rpx;
  326. }
  327. }
  328. .message{
  329. position: relative;
  330. justify-content: space-between;
  331. .tips{
  332. width: 168rpx;
  333. height: 49rpx;
  334. text-align: center;
  335. line-height: 49rpx;
  336. // border: 1rpx solid #D52E4C;
  337. border-radius: 20rpx;
  338. font-size: 24rpx;
  339. color: #fff;
  340. background-color: $uni-color-BGC;
  341. }
  342. .sms{
  343. display: flex;
  344. flex-wrap: wrap;
  345. }
  346. /deep/ .u-input.u-input--border{
  347. border: 0!important;
  348. }
  349. /deep/ input{
  350. width:260rpx;
  351. border: 0;
  352. line-height: 40rpx !important;
  353. height: 40rpx;
  354. min-height: 40rpx!important;
  355. font-size: 24rpx;
  356. text-align: right;
  357. padding-right: 10rpx;
  358. }
  359. .label::after{
  360. content:'';
  361. position: absolute;
  362. }
  363. }
  364. .btn{
  365. .u-size-default{
  366. height: 80rpx;
  367. line-height: 80rpx;
  368. background: #D52E4C;
  369. border-radius: 40px;
  370. color: #fff;
  371. margin-top: 40rpx;
  372. margin-bottom: 40rpx;
  373. }
  374. .u-default-hover{
  375. background: #c02b46!important;
  376. border-radius: 40px!important;
  377. color: #fff!important;
  378. }
  379. }
  380. }
  381. }
  382. }
  383. </style>