123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391 |
- <template>
- <view class="cooperation">
- <u-toast ref="uToast" />
- <view class="formBgc">
- <view class="form">
- <view class="item message" >
- <view class="label">
- 您的称呼:
- </view>
- <input v-model="name" placeholder-style="font-size:24rpx;text-align:right" placeholder="输入您的称呼" type="text" />
- </view>
- <view class="item message">
- <view class="label">
- 联系电话:
- </view>
- <view class="sms">
- <input v-model="phone" maxlength="11" placeholder-style="font-size:24rpx;text-align:right" placeholder="输入您的电话" type="text" />
- <view class="wrap" v-if="configAll.system_sms_open">
- <u-toast ref="uToast"></u-toast>
- <u-verification-code :seconds="seconds" start-text="验证码" @end="end" @start="start" ref="uCode"
- @change="codeChange"></u-verification-code>
- <view class="tips" @tap="getCode" >{{tips}}</view>
- </view>
- </view>
- </view>
- <view class="item message" v-if="configAll.system_sms_open">
- <view class="label">
- 验证码:
- </view>
- <input v-model="sms_code" max placeholder-style="font-size:24rpx;text-align:right" maxlength="4" placeholder="输入验证码" type="text" />
- </view>
- <view class="item message" >
- <view class="label">
- 标题:
- </view>
- <input v-model="title" maxlength="10" placeholder-style="font-size:24rpx;text-align:right" placeholder="输入标题(10字内)" type="text" />
- </view>
- <view class="item textarea">
- <view class="inputTextarea">
- <u-input v-model="content" type="textarea" height="230" placeholder-style="font-size:24rpx;color:#CBCBCB;" :clearable="false" placeholder="请输入购买手机号遇到的问题(120字内)我们将在24小时内给您回复"/>
- </view>
- <view class="label">
- 付款截图:(最多3张,大小1M内)
- </view>
- <!-- width="600rpx" height="300rpx" -->
- <u-upload ref="uUpload1" max-count="3" @on-change="progress1" :action="action" ></u-upload>
- </view>
- <view class="btn">
- <u-button @click="business_form()">提交</u-button>
- </view>
- </view>
- </view>
- </view>
- </template>
- <script>
- export default {
- data() {
- return {
- name:'',
- phone:'',//手机号
- sms_code:'',//短信
- title: '',
- content: '',
- // refCode: null,
- seconds: 60,
- tips: '获取验证码',
- // 上传地址
- action: '',
- };
- },
- onLoad() {
- this.action=this.$httpUrl+'/api/common/upload'
- },
- methods: {
- progress1(res, index, lists, name){
- // console.log(JSON.parse(res.data))
- if(JSON.parse(res.data).code==0){
- this.$refs.uToast.show({
- title: JSON.parse(res.data).msg,
- type: 'error ',
- })
- this.$refs.uUpload1.clear()
- }
- },
- codeChange(text) {
- this.tips = text;
- },
- //商务合作
- business_form(){
- if(this.name==''){
- this.$refs.uToast.show({
- title: '请输入姓名',
- type: 'error ',
- })
- return;
- }
- if(!this.$check.checkName(this.name)){
- this.$refs.uToast.show({
- title: '请输入正确的格式',
- type: 'error ',
- })
- return;
- }
- if(this.phone==''){
- this.$refs.uToast.show({
- title: '请输入手机号',
- type: 'error ',
- })
- return;
- }
- if(!this.$check.checkMobile(this.phone)){
- this.$refs.uToast.show({
- title: '请输入正确手机号的格式',
- type: 'error ',
- })
- return;
- }
- if(this.phone==''){
- this.$refs.uToast.show({
- title: '请输入手机号',
- type: 'error ',
- })
- return;
- }
- if(this.title==''){
- this.$refs.uToast.show({
- title: '请输入标题',
- type: 'error ',
- })
- return;
- }
- let files1 = [];
- files1 = this.$refs.uUpload1.lists.filter(val => {
- return val.progress == 100;
- })
- let imgs=[]
- if(files1.length>0){
- files1.forEach(item=>{
- imgs.push(item.response.data.url)
- })
- }else{
- this.$refs.uToast.show({
- title: '请上传截图',
- type: 'error ',
- })
- return;
- }
- console.log(imgs)
- let obj={
- name:this.name,
- phone:this.phone,
- sms_code:this.sms_code,
- title:this.title,
- content:this.content,
- images:imgs,
- }
- this.$http.feedback(obj).then(res=>{
- console.log(res)
- if(res.data.code==1){
- uni.reLaunch({
- url: '/pages/index/index',
- })
- }else{
- this.$refs.uToast.show({
- title: res.data.msg,
- type: 'error ',
- })
- }
- })
- },
- // 获取短信
- getCode() {
-
- console.log('发送验证码')
- if(this.$refs.uCode.canGetCode) {
- // 模拟向后端请求验证码
- // uni.showLoading({
- // title: '正在获取验证码'
- // })
- console.log(this.phone)
- if(this.phone==''){
- this.$refs.uToast.show({
- title: '请输入手机号',
- type: 'error ',
- })
- return;
- }
- if (!this.$check.checkMobile.test(this.phone)) {
- this.$refs.uToast.show({
- title: '请输入正确的手机号格式',
- type: 'warning ',
- })
- return;
- }
- this.$http.send({mobile:this.phone,event:'complaint'})
- .then(res=>{
- console.log(res)
- if(res.data.code==1){
- this.$u.toast('验证码已发送');
- this.$refs.uCode.start();
-
- }else{
- this.$refs.uToast.show({
- title: res.data.msg,
- type: 'error ',
- })
- }
- })
- // setTimeout(() => {
- // uni.hideLoading();
- // // 这里此提示会被this.start()方法中的提示覆盖
- // this.$u.toast('验证码已发送');
- // // 通知验证码组件内部开始倒计时
- // this.$refs.uCode.start();
- // }, 2000);
- } else {
- this.$u.toast('倒计时结束后再发送');
- }
- },
- end() {
- // this.$u.toast('倒计时结束');
- },
- start() {
- // this.$u.toast('倒计时开始');
- },
- }
- };
- </script>
- <style lang="scss">
- .cooperation{
- width: 100%;
- .formBgc{
- // border-top: 1rpx solid #fff;
- width: 100%;
- height: 725rpx;
- background: linear-gradient(rgb(213, 46, 76), #fff);
- padding-top: 30rpx;
- .form{
- background-color: #fff;
- margin: 0rpx 20rpx 0;
- box-sizing: border-box;
- padding: 25rpx;
- border-radius: 10rpx;
- /deep/ .u-radio__label{
- font-size: 25rpx
- }
- /deep/ .u-radio-group{
- margin-left: 28rpx;
- margin-bottom:4rpx;
- }
- /deep/ input::-webkit-input-placeholder {
- /* placeholder颜色 */
- color: #aab2bd;
- /* placeholder字体大小 */
- font-size: 24rpx;
- }
- .item{
- padding:33rpx 0;
- border-bottom: 1rpx solid #F2F2F7;
- display: flex;
- flex-wrap: wrap;
- justify-content: left;
- .label{
- position: relative;
- font-size: 24rpx;
- color: #333;
- padding-left: 20rpx;
- }
- .label::after{
- position: absolute;
- content:'*';
- color: $uni-color-BGC;
- top: 50%;
- transform: translateY(-50%);
- left: 0;
- }
- }
- .textarea{
- display:block;
- .inputTextarea{
- border: 1px solid #e2e2e2;
- border-radius: 10rpx;
- padding: 10rpx;
- }
- /deep/ .u-input{
- width: 100%;
- padding: 10rpx 0;
- }
- /depp/ .u-add-wrap{
- display: none;
- }
- .label{
- margin: 20rpx 0;
- }
- }
- .type{
- position: relative;
- box-sizing: border-box;
- padding-left: 90rpx;
- border-bottom: 1rpx solid #F2F2F7;
- .label{
- position: absolute;
- top: 50%;
- left: 0;
- transform: translateY(-50%);
- font-size: 25rpx;
- }
- .inputBox{
- display: flex;
- flex-wrap: wrap;
- // justify-content: space-between;
- }
- .inputBoxTop{
- margin-top: 16rpx;
- }
-
- /deep/ input{
- width:230rpx;
- height: 42rpx;
- line-height: 42rpx;
- background: #FFFFFF;
- min-height: 42rpx;
- max-height: 42rpx;
- border-radius: 8rpx;
- font-size: 20rpx;
- color: #BABABA;
- border: 1rpx solid rgba(86, 86, 86, 0.2);
- padding: 0 16rpx;
- }
- }
-
- .message{
- position: relative;
- justify-content: space-between;
- .tips{
- width: 168rpx;
- height: 49rpx;
- text-align: center;
- line-height: 49rpx;
- // border: 1rpx solid #D52E4C;
- border-radius: 20rpx;
- font-size: 24rpx;
- color: #fff;
- background-color: $uni-color-BGC;
- }
- .sms{
- display: flex;
- flex-wrap: wrap;
- }
- /deep/ .u-input.u-input--border{
- border: 0!important;
- }
- /deep/ input{
- width:260rpx;
- border: 0;
- line-height: 40rpx !important;
- height: 40rpx;
- min-height: 40rpx!important;
- font-size: 24rpx;
- text-align: right;
- padding-right: 10rpx;
- }
- .label::after{
- content:'';
- position: absolute;
- }
- }
- .btn{
- .u-size-default{
- height: 80rpx;
- line-height: 80rpx;
- background: #D52E4C;
- border-radius: 40px;
- color: #fff;
- margin-top: 40rpx;
- margin-bottom: 40rpx;
- }
- .u-default-hover{
- background: #c02b46!important;
- border-radius: 40px!important;
- color: #fff!important;
- }
- }
- }
- }
- }
- </style>
|