Cityservice.vue 30 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276
  1. <template>
  2. <view class="help_send" style="padding-bottom: 10upx;">
  3. <view class="part_two">
  4. <view class="service_box" @click="bindadd(4)">
  5. <view class="flex-sub margin-left-sm">
  6. <view class="service_name" style="font-weight: bold;">
  7. 服务地址
  8. </view>
  9. </view>
  10. <view class="service_address" v-if="JSON.stringify(citydata) != '{}'">
  11. <view class="service_name">
  12. {{citydata.province}}{{citydata.city}}{{citydata.district}}{{citydata.addressDetail}}
  13. </view>
  14. <view class="service_dd">
  15. {{citydata.userName}}
  16. <text>{{citydata.userPhone}}</text>
  17. </view>
  18. </view>
  19. <view class="text-lg" v-else>请选择地址</view>
  20. <view class="service_icon">
  21. <u-icon name="arrow-right"></u-icon>
  22. </view>
  23. </view>
  24. <u-line color="#E6E6E6" />
  25. <u-form :model="forms" ref="uForm" label-position="left" :label-style="labelstyle">
  26. <u-form-item label="服务时间" right-icon="arrow-right">
  27. <u-input @click="onshowdata" :clearable="clearable" :disabled="true" v-model="forms.data"
  28. input-align="right" placeholder="请确定服务时间" />
  29. </u-form-item>
  30. </u-form>
  31. </view>
  32. <view class="part_four" @click="bindtype()" v-if='title'>
  33. <view class="service_type">服务类型</view>
  34. <view class="service_type text-right">{{citytype}}</view>
  35. <view class="service_you">
  36. <u-icon name="arrow-right"></u-icon>
  37. </view>
  38. </view>
  39. <view class="part_one">
  40. <view class="pay_tit">
  41. <view class="pay_name">服务内容</view>
  42. <view class="pay_set">
  43. <u-input v-model="values" type="textarea" :maxlength="500" :placeholder='placeholder' />
  44. </view>
  45. </view>
  46. </view>
  47. <view class="part_three">
  48. <u-form :model="forms" ref="uForm" label-position="left" :label-style="labelstyle">
  49. <!-- <u-form-item label="自备配件" right-icon="arrow-right">
  50. <u-input @click="onshowm" :clearable="clearable" :disabled="true" v-model="forms.peijian"
  51. input-align="right" />
  52. </u-form-item> -->
  53. <!-- <u-form-item label="保修期" right-icon="arrow-right">
  54. <u-input @click="onshowvalua" v-model="forms.baoxiu" :disabled="true" :clearable="clearable"
  55. input-align="right" />
  56. </u-form-item> -->
  57. <u-form-item label="红包" right-icon="arrow-right">
  58. <u-input @click="onshowmoney" v-model="forms.hongbao" :disabled="true" :clearable="clearable"
  59. input-align="right" placeholder="请选择红包" />
  60. </u-form-item>
  61. <u-form-item label="小费" right-icon="arrow-right">
  62. <u-input v-model="forms.tip" type="number" :clearable="clearable" input-align="right"
  63. @input="onKeyInput()" placeholder="接单更快 购买更加及时" />
  64. </u-form-item>
  65. </u-form>
  66. </view>
  67. <view class="content_sure">
  68. <u-checkbox-group>
  69. <u-checkbox v-model="check" shape="circle" active-color="#FF7F00">同意并接受</u-checkbox>
  70. </u-checkbox-group>
  71. <view style="font-size: 25rpx;margin-left: -10rpx;" @click="binduserxieyi()">
  72. 《跑腿代购服务用户协议》
  73. </view>
  74. </view>
  75. <view class="tabbar">
  76. <view class="tabbar_price">支付:
  77. <text v-if="totalprice == ''">¥{{price || 0}}</text>
  78. <text v-else>¥{{totalprice}}</text>
  79. </view>
  80. <view class="tabbar_btn">
  81. <view class="but" @click="bindpay()">提交并支付</view>
  82. </view>
  83. </view>
  84. <!-- 服务类型弹框 -->
  85. <u-select v-model="typeshow" mode="single-column" value-name='id' label-name='serviceName' :list="list" @confirm="typeconfirm"></u-select>
  86. <!-- 取件时间弹框 :range="multiSelector"-->
  87. <u-picker mode="time" v-model="showdata" :default-selector='[0, 0]' cancel-tex="确认" :params="params"
  88. @confirm="confirm"></u-picker>
  89. <!-- 上门配件弹框 -->
  90. <u-select v-model="menshow" mode="single-column" :list="mlist" @confirm="confirms"></u-select>
  91. <!-- 红包弹框 -->
  92. <u-popup v-model="showmoney" mode="bottom" :closeable="true" close-icon="close-circle"
  93. close-icon-pos="top-right" close-icon-color="#8f9298" close-icon-size="50">
  94. <view class="popup_money">
  95. <view class="data_title">红包</view>
  96. <view class="data_select">
  97. <view class="money_box" v-for="(item,index) in hongbao" :key="index"
  98. v-if="Number(item.redPacketType)==0||Number(item.redPacketType)==indentType">
  99. <view class="box_tit">
  100. <view class="money_name">{{item.redPacketTitle}}</view>
  101. <view class="money_price">¥{{item.redPacketAmount}}</view>
  102. </view>
  103. <view class="money_data">有效期至{{item.expirationTime}}</view>
  104. <view class="money_line">
  105. <u-line direction="row" color="#E6E6E6" border-style="dashed" />
  106. </view>
  107. <view class="box_bottom">
  108. <view class="money_use">满{{item.minimumAmount}}元可使用</view>
  109. <view class="money_btn">
  110. <view class="lj_use" @click="bindhongindex(item.redPacketId,item.redPacketAmount)">
  111. 立即使用
  112. </view>
  113. </view>
  114. </view>
  115. </view>
  116. </view>
  117. <!-- 暂无红包 -->
  118. <view class="image_box" v-if="hongbao.length==0">
  119. <image src="https://mxys.chuanghai-tech.com/wmfile/20250814/99c5ced85df04062a736276ba75bdd1e.png" style="width:100%;height: 350rpx;"></image>
  120. <view style="width: 100%;text-align: center;color: #ccc;">暂无红包</view>
  121. </view>
  122. </view>
  123. </u-popup>
  124. <u-popup v-model="showpay" mode="bottom" close-icon="close-circle" close-icon-pos="top-right"
  125. close-icon-color="#8f9298" close-icon-size="50">
  126. <view class="popup_pay">
  127. <view class="bg margin-top padding-lr radius">
  128. <view style="padding: 0 20upx;margin-top: 36rpx;">
  129. <view
  130. style="display: flex;height: 100upx;align-items: center;padding: 20upx 0;justify-content: center;"
  131. v-for="(item,index) in openLists" :key='index'>
  132. <image :src="item.image" style="width: 55upx;height: 55upx;border-radius: 50upx;">
  133. </image>
  134. <view style="font-size: 30upx;margin-left: 20upx;width: 70%;">
  135. {{item.text}}
  136. </view>
  137. <radio-group name="openWay" style="margin-left: 20upx;" @tap='selectWay(item)'>
  138. <label class="tui-radio">
  139. <radio color="#FF7F00" :checked="openWay === item.id ? true : false" />
  140. </label>
  141. </radio-group>
  142. </view>
  143. </view>
  144. </view>
  145. <view class="pay_btns" @click="pay()">确认支付</view>
  146. </view>
  147. </u-popup>
  148. </view>
  149. </template>
  150. <script>
  151. export default {
  152. data() {
  153. return {
  154. title: true,
  155. openWay: 0,
  156. typeshow: false,
  157. values: '',
  158. placeholder: '请填写服务内容',
  159. list: [
  160. {
  161. value: '1',
  162. label: '全能帮手'
  163. }, {
  164. value: '2',
  165. label: '搬运货取'
  166. }, {
  167. value: '3',
  168. label: '小时工'
  169. }, {
  170. value: '4',
  171. label: '照顾宠物'
  172. }, {
  173. value: '5',
  174. label: '传单派发'
  175. }, {
  176. value: '6',
  177. label: '活动招募'
  178. }, {
  179. value: '7',
  180. label: '异地代办'
  181. }, {
  182. value: '8',
  183. label: '上门做饭'
  184. },
  185. ],
  186. menshow: false,
  187. mlist: [{
  188. value: '1',
  189. label: '不需要配件'
  190. }, {
  191. value: '2',
  192. label: '需要配件'
  193. }],
  194. // checked: false,
  195. check: false,
  196. mobile: '',
  197. code: '',
  198. forms: {
  199. data: '立即上门',
  200. baoxiu: '7天',
  201. hongbao: '',
  202. tip: '',
  203. peijian: ''
  204. },
  205. clearable: false,
  206. showdata: false,
  207. showmoney: false,
  208. showpay: false,
  209. value: '',
  210. type: 'text',
  211. border: true,
  212. params: {
  213. // year: true,
  214. // month: true,
  215. day: true,
  216. hour: true,
  217. minute: true,
  218. timestamp: true
  219. },
  220. price: 0,
  221. indentType: '4',
  222. cityPrice: {},
  223. hongbao: [],
  224. citydata: {},
  225. citytype: '',
  226. redPacketId: '',
  227. year: '',
  228. labelstyle: {
  229. whiteSpace: 'nowrap',
  230. fontWeight: 'bold',
  231. textIndent: '20rpx'
  232. },
  233. indentNumber: '',
  234. openLists: [],
  235. totalprice: '',
  236. addressId:''
  237. }
  238. },
  239. onLoad(e) {
  240. // console.log('``````', e)
  241. // this.indentType = e.index
  242. if(e.title) {
  243. this.title = false
  244. this.placeholder = '请填写'+ e.title + '的具体要求等'
  245. uni.setNavigationBarTitle({
  246.   title: e.title
  247. })
  248. }
  249. // 计算基础价格
  250. this.orderjc()
  251. // 获取服务类型
  252. this.getTypeList()
  253. // #ifdef H5
  254. let ua = navigator.userAgent.toLowerCase();
  255. if (ua.indexOf('micromessenger') !== -1) {
  256. this.openLists = [{
  257. image: '../static/icon_weixin.png',
  258. text: '微信',
  259. id: 2
  260. }];
  261. this.openWay = 2;
  262. } else {
  263. this.openLists = [{
  264. image: '../static/zhifubao.png',
  265. text: '支付宝',
  266. id: 1
  267. }];
  268. this.openWay = 1;
  269. }
  270. // #endif
  271. // #ifdef APP-PLUS
  272. this.openLists = [{
  273. image: '../static/zhifubao.png',
  274. text: '支付宝',
  275. id: 1
  276. }, {
  277. image: '../static/icon_weixin.png',
  278. text: '微信',
  279. id: 2
  280. }];
  281. this.openWay = 1;
  282. // #endif
  283. // #ifdef MP-WEIXIN
  284. this.openLists = [{
  285. image: '../static/icon_weixin.png',
  286. text: '微信',
  287. id: 2
  288. }];
  289. this.openWay = 2;
  290. // #endif
  291. },
  292. onShow() {
  293. console.log(this.addressId,'选择的地址id')
  294. this.addressId = this.addressId?this.addressId:uni.getStorageSync('addressId')
  295. if(this.addressId) {
  296. this.getAddress(this.addressId)
  297. }
  298. // this.citydata = uni.getStorageSync('closeAddress').citydata ? uni.getStorageSync('closeAddress').citydata : {}
  299. },
  300. methods: {
  301. getTypeList() {
  302. this.$Request.getT('/app/servicetype/selectServiceTypeList').then(res => {
  303. if (res.code == 0) {
  304. this.list = res.data
  305. }
  306. });
  307. },
  308. // 查询地址
  309. getAddress(e) {
  310. let data = {
  311. addressId: e
  312. }
  313. this.$Request.getT('/app/address/selectAddressById', data).then(res => {
  314. if (res.code == 0) {
  315. this.citydata = res.data
  316. uni.removeStorageSync('addressId')
  317. }
  318. });
  319. },
  320. // 跑腿协议
  321. binduserxieyi() {
  322. uni.navigateTo({
  323. url: '/my/setting/xieyi'
  324. })
  325. },
  326. // 服务类型
  327. typeconfirm(e) {
  328. console.log(e)
  329. this.placeholder = '请填写'+ e[0].label + '的具体要求等'
  330. this.citytype = e[0].label
  331. },
  332. bindtype() {
  333. this.typeshow = true
  334. },
  335. tabs(index) {
  336. this.current = index;
  337. },
  338. // switch打开或者关闭时触发,值为true或者false
  339. // 即使不监听此事件,this.checked此时也会相应的变成true或者false
  340. change(status) {
  341. // console.log(status);
  342. },
  343. bindtake() {
  344. uni.navigateTo({
  345. url: '/pages/closeaddress/closeaddress'
  346. })
  347. },
  348. bindclose() {
  349. uni.navigateTo({
  350. url: '/pages/takeaddress/takeaddress'
  351. })
  352. },
  353. // 注意返回值为一个数组,单列时取数组的第一个元素即可(只有一个元素)
  354. confirm(e) {
  355. console.log(e.timestamp)
  356. let curDate = new Date();
  357. this.year = curDate.getFullYear();
  358. this.month = curDate.getMonth();
  359. if (parseInt(curDate) >= parseInt(e.timestamp * 1000)) {
  360. uni.showToast({
  361. title: '请选择正确时间',
  362. icon: 'none'
  363. })
  364. } else {
  365. // this.selTime = e.timestamp
  366. this.buyTime = this.year + '-' + this.month + '-' + e.day + ' ' + e.hour + ':' + e.minute + ':' + '00'
  367. this.forms.data = e.day + '号' + e.hour + ':' + e.minute
  368. }
  369. },
  370. onshowdata() {
  371. this.showdata = true
  372. },
  373. binddata() {
  374. this.showdata = false
  375. },
  376. // 自行配件
  377. confirms(e) {
  378. // console.log(e)
  379. this.forms.peijian = e[0].label
  380. },
  381. onshowm() {
  382. this.menshow = true
  383. },
  384. bindadd(index) {
  385. // console.log(index)
  386. // uni.navigateTo({
  387. // url: '/pages/closeaddress/closeaddress?index=' + index
  388. // })
  389. uni.navigateTo({
  390. url: '/my/address/index?add=1&addressType=' + index
  391. })
  392. },
  393. // 根据订单信息判断用户可用红包
  394. onshowmoney() {
  395. this.showmoney = true
  396. let data = {
  397. indentType: this.indentType, //订单类型
  398. indentBasicsMoney: this.price
  399. }
  400. this.$Request.postJson('/app/tbindent/findRedPacket', data).then(res => {
  401. // console.log(res)
  402. if (res.code === 0) {
  403. this.hongbao = res.data
  404. // console.log(this.hongbao)
  405. }
  406. });
  407. },
  408. // 判断红包使用id
  409. bindhongindex(id, price) {
  410. // console.log(id)
  411. this.redPacketId = id
  412. this.forms.hongbao = price
  413. this.showmoney = false
  414. let price1 = ( Number(this.price) - Number(this.forms.hongbao) ).toFixed(2)
  415. if(price1<=0) {
  416. price1 = 0.01
  417. }
  418. console.log(price1,'价格')
  419. this.totalprice = (Number(price1) + Number(this.forms.tip)).toFixed(2)
  420. console.log(this.totalprice)
  421. // this.totalprice = (Number(this.price || 0) - Number(this.forms.hongbao || 0) + Number(this.forms.tip || 0)).toFixed(2)
  422. if(this.totalprice<=0) {
  423. this.totalprice = 0.01
  424. }
  425. },
  426. //计算订单基础价格
  427. orderjc() {
  428. let data = {
  429. indentType: this.indentType //订单类型
  430. }
  431. this.$Request.postJson('/app/tbindent/basicsMoney', data).then(res => {
  432. // console.log(res)
  433. if (res.code === 0) {
  434. this.price = res.data.indentBasicsMoney
  435. this.cityPrice = res.data
  436. // console.log(this.cityPrice)
  437. }
  438. });
  439. },
  440. // 价格计算
  441. onKeyInput(e) {
  442. console.log(e)
  443. let price = (Number(this.price) - Number(this.forms.hongbao) ).toFixed(2)
  444. if(price<=0) {
  445. price = 0.01
  446. }
  447. this.totalprice = (Number(price) + Number(this.forms.tip)).toFixed(2)
  448. if(this.totalprice<=0) {
  449. this.totalprice = 0.01
  450. }
  451. },
  452. // 提交订单
  453. bindpay() {
  454. // this.totalprice = (Number(this.price || 0) - Number(this.forms.hongbao || 0) + Number(this.forms.tip || 0)).toFixed(2)
  455. console.log(this.totalprice)
  456. if (JSON.stringify(this.citydata) == '{}') {
  457. uni.showToast({
  458. title: '请填写服务地址',
  459. icon: 'none',
  460. duration: 2000
  461. });
  462. return
  463. }
  464. if (this.citytype == '' && this.title) {
  465. uni.showToast({
  466. title: '请选择服务类型',
  467. icon: 'none',
  468. duration: 2000
  469. });
  470. return
  471. }
  472. if (this.values == '') {
  473. uni.showToast({
  474. title: '请填写服务内容',
  475. icon: 'none',
  476. duration: 2000
  477. });
  478. return
  479. }
  480. // if (this.forms.peijian == '') {
  481. // uni.showToast({
  482. // title: '请选取自备配件',
  483. // icon: 'none',
  484. // duration: 2000
  485. // });
  486. // return
  487. // }
  488. if (this.check == false) {
  489. uni.showToast({
  490. title: '请勾选跑腿协议',
  491. icon: 'none',
  492. duration: 2000
  493. });
  494. return
  495. } else {
  496. let data = {
  497. // deliveryUserPhone: this.citydata.userPhone,
  498. // deliveryUserName: this.citydata.userName,
  499. // deliveryAddress: this.citydata.address,
  500. // deilveryAddressDetail: this.citydata.addressDetail,
  501. // deliveryAddressLatitude: this.citydata.addressLatitude,
  502. // deliveryAddressLongitude: this.citydata.addressLongitude,
  503. userName: this.citydata.userName, //收货人姓名
  504. userPhone: this.citydata.userPhone, //收货人电话
  505. userProvince: this.citydata.province, //收货人 省
  506. userCity: this.citydata.city, //收货人 市
  507. userDistrict: this.citydata.district, //收货人 区
  508. userAddressDetail: this.citydata.addressDetail, //收货人详细地址
  509. userLng: this.citydata.lng,
  510. userLat: this.citydata.lat,
  511. indentType: this.indentType,
  512. serviceType: this.citytype,
  513. serviceDetails: this.values,
  514. sendOutTime: this.forms.data,
  515. tool: this.forms.peijian,
  516. warrantyPeriod: this.forms.baoxiu,
  517. itemCode: "",
  518. remarks: "",
  519. tip: this.forms.tip,
  520. redPacketId: this.redPacketId,
  521. indentBasicsMoney: this.totalprice,
  522. modeOfPayment: "",
  523. errandMoney: this.cityPrice.errandMoney
  524. }
  525. this.$Request.postJson('/app/tbindent/addIndent', data).then(res => {
  526. // console.log(res)
  527. if (res.code == 0) {
  528. this.indentNumber = res.data.indentNumber
  529. // #ifdef MP-WEIXIN
  530. this.openWay= 2
  531. this.pay()
  532. // #endif
  533. // #ifndef MP-WEIXIN
  534. this.showpay = true
  535. // #endif
  536. }
  537. });
  538. }
  539. },
  540. selectWay: function(item) {
  541. this.openWay = item.id;
  542. },
  543. pay() {
  544. // let indentNumber = this.indentNumber
  545. // console.log(data)
  546. if (this.openWay == 0) {
  547. this.$queue.showToast('请选择支付方式!')
  548. return;
  549. }
  550. if (this.openWay == 2) {
  551. // #ifdef MP-WEIXIN
  552. uni.showLoading({
  553. title: '支付中...',
  554. mask: true, // 是否显示透明蒙层,防止触摸穿透
  555. });
  556. // 微信小程序支付
  557. this.$Request.postJson("/app/wxErrPay/wxPayJsApiOrder?indentNumber=" + this.indentNumber).then(res => {
  558. console.log(res, '********')
  559. if (res.code == 0) {
  560. console.log(this.openWay, '支付')
  561. uni.requestPayment({
  562. provider: 'wxpay',
  563. timeStamp: res.data.timestamp,
  564. nonceStr: res.data.noncestr,
  565. package: res.data.package,
  566. signType: res.data.signType,
  567. paySign: res.data.sign,
  568. success: function(suc) {
  569. console.log('success:' + JSON.stringify(suc));
  570. uni.showToast({
  571. title: '支付成功',
  572. icon: 'success'
  573. })
  574. uni.setStorageSync('current', 0)
  575. setTimeout(function() {
  576. uni.switchTab({
  577. url: '/pages/order/index',
  578. })
  579. }, 10)
  580. },
  581. fail: function(err) {
  582. console.log('fail:' + JSON.stringify(err));
  583. uni.showToast({
  584. title: '支付失败',
  585. icon: 'none'
  586. })
  587. uni.switchTab({
  588. url: '/pages/order/index'
  589. })
  590. }
  591. });
  592. }
  593. })
  594. // #endif
  595. // #ifdef H5
  596. let ua = navigator.userAgent.toLowerCase();
  597. if (ua.indexOf('micromessenger') !== -1) { //微信里打开
  598. this.$Request.postJson('/app/wxPay/wxPayMpOrder?indentNumber=' + this.indentNumber)
  599. .then(res => {
  600. console.log(res)
  601. if (res.code == 0) {
  602. console.log()
  603. this.callPay(res.data);
  604. } else {
  605. uni.showToast({
  606. icon: 'none',
  607. title: '支付失败!'
  608. });
  609. }
  610. });
  611. } else { //不是微信打开
  612. this.$Request.postJson('/app/wxPay/wxPayMpOrder?indentNumber=' + this.indentNumber)
  613. .then(
  614. res => {
  615. if (res.code == 0) {
  616. console.log('....11111111.....', res.data)
  617. const div = document.createElement('div')
  618. div.innerHTML = res.data //此处form就是后台返回接收到的数据
  619. console.log('....2.....', res.data)
  620. document.body.appendChild(div)
  621. console.log('....33333.....', document.forms[0])
  622. document.forms[0].submit()
  623. } else {
  624. uni.showToast({
  625. icon: 'none',
  626. title: '支付失败!'
  627. });
  628. }
  629. });
  630. }
  631. // #endif
  632. } else {
  633. // APP支付宝支付
  634. this.$Request.postJson("/app/aliPay/payH5Order?indentNumber=" + this.indentNumber)
  635. .then(
  636. ret => {
  637. console.log(ret)
  638. // const div = document.createElement('div')
  639. // div.innerHTML = ret.data //此处form就是后台返回接收到的数据
  640. // document.body.appendChild(div)
  641. // document.forms[0].submit()
  642. this.isCheckPay(ret.code, 'alipay', ret.data);
  643. });
  644. }
  645. },
  646. callPay: function(response) {
  647. if (typeof WeixinJSBridge === "undefined") {
  648. if (document.addEventListener) {
  649. document.addEventListener('WeixinJSBridgeReady', this.onBridgeReady(response), false);
  650. } else if (document.attachEvent) {
  651. document.attachEvent('WeixinJSBridgeReady', this.onBridgeReady(response));
  652. document.attachEvent('onWeixinJSBridgeReady', this.onBridgeReady(response));
  653. }
  654. } else {
  655. this.onBridgeReady(response);
  656. }
  657. },
  658. onBridgeReady: function(response) {
  659. let that = this;
  660. if (!response.package) {
  661. return;
  662. }
  663. WeixinJSBridge.invoke(
  664. 'getBrandWCPayRequest', {
  665. "appId": response.appid, //公众号名称,由商户传入
  666. "timeStamp": response.timestamp, //时间戳,自1970年以来的秒数
  667. "nonceStr": response.noncestr, //随机串
  668. "package": response.package,
  669. "signType": response.signType, //微信签名方式:
  670. "paySign": response.sign //微信签名
  671. },
  672. function(res) {
  673. console.log(res, '/*-/*-/*-')
  674. if (res.err_msg === "get_brand_wcpay_request:ok") {
  675. // 使用以上方式判断前端返回,微信团队郑重提示:
  676. //res.err_msg将在用户支付成功后返回ok,但并不保证它绝对可靠。
  677. uni.showLoading({
  678. title: '支付成功'
  679. });
  680. setTimeout(function() {
  681. uni.hideLoading();
  682. uni.switchTab({
  683. url: '../order/order'
  684. })
  685. }, 1000);
  686. } else {
  687. uni.hideLoading();
  688. }
  689. WeixinJSBridge.log(response.err_msg);
  690. }
  691. );
  692. },
  693. isCheckPay(status, name, order) {
  694. if (status == 0) {
  695. this.setPayment(name, order);
  696. } else {
  697. uni.hideLoading();
  698. uni.showToast({
  699. title: '支付信息有误',
  700. icon: 'none'
  701. });
  702. }
  703. },
  704. setPayment(name, order) {
  705. console.log('*-*-*')
  706. uni.requestPayment({
  707. provider: name,
  708. orderInfo: order, //微信、支付宝订单数据
  709. success: function(res) {
  710. console.log(res)
  711. uni.hideLoading();
  712. uni.showLoading({
  713. title: '支付成功'
  714. });
  715. uni.setStorageSync('current', 0)
  716. setTimeout(function() {
  717. uni.switchTab({
  718. url: '/pages/order/order',
  719. })
  720. }, 10)
  721. },
  722. fail: function(err) {
  723. console.log(err)
  724. uni.hideLoading();
  725. },
  726. complete() {
  727. uni.hideLoading();
  728. }
  729. });
  730. },
  731. }
  732. }
  733. </script>
  734. <style>
  735. body {
  736. background: #F2EDED;
  737. }
  738. /* #ifndef MP-WEIXIN */
  739. page {
  740. background: #F2EDED;
  741. }
  742. /* #endif */
  743. /* 取件时间弹框 */
  744. .popup_data {
  745. height: 600upx;
  746. width: 100%;
  747. position: relative;
  748. }
  749. .data_title {
  750. width: 92%;
  751. margin: 0 auto;
  752. font-size: 34upx;
  753. line-height: 110upx;
  754. font-weight: bold;
  755. letter-spacing: 2upx;
  756. position: relative;
  757. top: 0upx;
  758. z-index: 99991;
  759. }
  760. .data_btn {
  761. position: absolute;
  762. bottom: 30upx;
  763. width: 100%;
  764. z-index: 99992;
  765. }
  766. .btn {
  767. width: 90%;
  768. margin: 0 auto;
  769. height: 45upx;
  770. color: white;
  771. background: #FF7F00;
  772. border-radius: 22upx;
  773. text-align: center;
  774. line-height: 90upx;
  775. letter-spacing: 2upx;
  776. }
  777. .u-close {
  778. position: absolute;
  779. z-index: 999999 !important;
  780. }
  781. .u-picker-body {
  782. height: 355upx !important;
  783. }
  784. /* .u-picker-header {
  785. position: relative !important;
  786. top: 138upx;
  787. z-index: 99992;
  788. } */
  789. /* 物品信息弹框 */
  790. .popup_info {
  791. height: 1140upx;
  792. width: 100%;
  793. position: relative;
  794. }
  795. .data_items {
  796. width: 100%;
  797. }
  798. .item_box {
  799. width: 90%;
  800. margin: 0 auto;
  801. }
  802. .item_btn {
  803. border: 1upx solid #cccccc;
  804. border-radius: 80upx;
  805. width: 200upx;
  806. height: 80upx;
  807. text-align: center;
  808. line-height: 80upx;
  809. font-size: 31rpx;
  810. margin-right: 10upx;
  811. margin-left: 10upx;
  812. margin-bottom: 20upx;
  813. }
  814. .item_btn:active {
  815. background: #ffd9b3;
  816. border: 2upx solid #ff7f00;
  817. }
  818. .item_type {
  819. display: flex;
  820. flex-wrap: wrap;
  821. margin-top: 20upx;
  822. }
  823. /* 物品保价弹框 */
  824. .valua_icon {
  825. width: 90%;
  826. position: absolute;
  827. bottom: 140upx;
  828. left: 42upx;
  829. }
  830. .input {
  831. width: 90%;
  832. margin: 0 auto;
  833. }
  834. .u-input--border {
  835. border-radius: 12rupx;
  836. border: 2upx solid #F2F2F2 !important;
  837. background: #F2F2F2 !important;
  838. }
  839. .input_bg {
  840. width: 90%;
  841. margin: 0 auto;
  842. position: relative;
  843. }
  844. .input_bg image {
  845. width: 100%;
  846. height: 90upx;
  847. }
  848. .input_bg text {
  849. position: absolute;
  850. top: 30upx;
  851. left: 36upx;
  852. color: #FF7F00;
  853. font-size: 31rpx;
  854. }
  855. /* 红包弹框 */
  856. .popup_money {
  857. /* height: 400upx; */
  858. width: 100%;
  859. height: 630rpx;
  860. position: relative;
  861. background: #F2EDED;
  862. padding-bottom: 45rpx;
  863. /* #ifndef MP-WEIXIN */
  864. height: 680rpx;
  865. /* #endif */
  866. }
  867. .uni-scroll-view,
  868. .uni-scroll-view-content {
  869. position: relative;
  870. width: 100%;
  871. height: 100%;
  872. background: #F2EDED;
  873. }
  874. .image_box {
  875. width: 40%;
  876. margin: 0 auto;
  877. margin-bottom: 110rpx;
  878. }
  879. .u-drawer-bottom {
  880. background-color: #FAF7F5 !important;
  881. }
  882. .money_box {
  883. width: 93%;
  884. margin: 0 auto;
  885. background: #ffffff;
  886. border-radius: 16upx;
  887. height: 250upx;
  888. margin-bottom: 20upx;
  889. }
  890. .box_tit {
  891. width: 90%;
  892. margin: 0 auto;
  893. height: 80upx;
  894. display: flex;
  895. }
  896. .money_name {
  897. flex: 1;
  898. display: flex;
  899. justify-content: left;
  900. align-items: center;
  901. font-size: 31rpx;
  902. font-weight: bold;
  903. letter-spacing: 2upx;
  904. }
  905. .money_price {
  906. flex: 1;
  907. display: flex;
  908. justify-content: flex-end;
  909. align-items: center;
  910. font-size: 36upx;
  911. font-weight: bold;
  912. color: red;
  913. }
  914. .money_data {
  915. color: #999999;
  916. font-size: 22upx;
  917. width: 90%;
  918. margin: 0 auto;
  919. margin-top: -10upx;
  920. }
  921. .u-line {
  922. width: 90% !important;
  923. border-bottom-width: 3upx !important;
  924. margin: 0 auto !important;
  925. margin-top: 24upx !important;
  926. margin-bottom: 24upx !important;
  927. }
  928. .box_bottom {
  929. width: 90%;
  930. margin: 0 auto;
  931. display: flex;
  932. height: 40upx;
  933. }
  934. .money_use {
  935. flex: 1;
  936. color: #999999;
  937. font-size: 22upx;
  938. display: flex;
  939. justify-content: left;
  940. align-items: center;
  941. }
  942. .lj_use {
  943. width: 160upx;
  944. border: 1upx solid #FF7F00;
  945. color: #FF7F00;
  946. text-align: center;
  947. line-height: 46upx;
  948. border-radius: 42upx;
  949. font-size: 20upx;
  950. }
  951. .help_send {
  952. width: 100%;
  953. }
  954. .content {
  955. margin-top: -380upx;
  956. position: relative;
  957. z-index: 999;
  958. }
  959. .part_one {
  960. width: 95%;
  961. margin: 0 auto;
  962. height: 225rpx;
  963. background: #ffffff;
  964. border-radius: 20upx;
  965. margin-top: 20upx;
  966. }
  967. .pay_tit {
  968. width: 95%;
  969. margin: 0 auto;
  970. /* height: 200upx; */
  971. position: relative;
  972. }
  973. .pay_name {
  974. font-size: 32rpx;
  975. font-weight: bold;
  976. width: 95%;
  977. margin: 0 auto;
  978. letter-spacing: 2upx;
  979. padding-top: 30upx;
  980. }
  981. .pay_set {
  982. color: #333333;
  983. font-size: 24upx;
  984. width: 95%;
  985. margin: 0 auto;
  986. /* margin-top: 20upx; */
  987. }
  988. .part_two {
  989. width: 95%;
  990. margin: 0 auto;
  991. /* height: 235rpx; */
  992. background: #ffffff;
  993. border-radius: 20upx;
  994. margin-top: 20upx;
  995. }
  996. .u-form {
  997. margin-top: -22rpx;
  998. }
  999. .service_box {
  1000. display: flex;
  1001. justify-content: space-between;
  1002. align-items: center;
  1003. width: 94%;
  1004. margin: 0 auto;
  1005. }
  1006. .service_address {
  1007. flex: 3;
  1008. margin-left: 14upx;
  1009. }
  1010. .service_name {
  1011. width: 100%;
  1012. margin-top: 30upx;
  1013. margin-bottom: 16upx;
  1014. font-size: 32rpx;
  1015. }
  1016. .service_dd {
  1017. font-size: 28rpx;
  1018. }
  1019. .service_dd text {
  1020. margin-left: 20upx;
  1021. }
  1022. .service_icon {
  1023. /* flex: 1; */
  1024. display: flex;
  1025. justify-content: flex-end;
  1026. align-items: center;
  1027. color: #CCCCCC;
  1028. }
  1029. .part_three {
  1030. width: 95%;
  1031. margin: 0 auto;
  1032. /* height: 350rpx; */
  1033. background: #ffffff;
  1034. border-radius: 20upx;
  1035. margin-top: 45rpx;
  1036. }
  1037. .u-form-item__body {
  1038. position: relative !important;
  1039. }
  1040. .u-form-item--left {
  1041. position: absolute !important;
  1042. top: 30upx;
  1043. left: 15rpx;
  1044. font-size: 31upx;
  1045. font-weight: bold;
  1046. letter-spacing: 2upx;
  1047. }
  1048. .u-form-item--right__content {
  1049. margin-right: 20upx !important;
  1050. }
  1051. .u-form-item {
  1052. line-height: 20upx !important;
  1053. }
  1054. .u-form-item {
  1055. padding: 20rpx 0 !important;
  1056. }
  1057. .u-input__input {
  1058. font-size: 44rupx !important;
  1059. }
  1060. .u-input__input {
  1061. font-size: 31rpx !important;
  1062. }
  1063. .part_four {
  1064. width: 95%;
  1065. padding: 20rpx 0rpx;
  1066. background: #ffffff;
  1067. margin: 0 auto;
  1068. border-radius: 20upx;
  1069. display: flex;
  1070. margin-top: 20upx;
  1071. }
  1072. .service_type {
  1073. flex: 1;
  1074. /* display: flex; */
  1075. /* justify-content: left; */
  1076. /* align-items: center; */
  1077. margin-left: 40upx;
  1078. font-size: 31rpx;
  1079. font-weight: bold;
  1080. }
  1081. .service_you {
  1082. /* flex: 1; */
  1083. display: flex;
  1084. justify-content: flex-end;
  1085. align-items: center;
  1086. margin-right: 20upx;
  1087. color: #CCCCCC;
  1088. }
  1089. .content_sure {
  1090. display: flex;
  1091. align-items: center;
  1092. margin-bottom: 160rpx;
  1093. margin-left: 15px;
  1094. margin-top: 10px;
  1095. /* #ifndef MP-WEIXIN */
  1096. /* margin-bottom: 200px; */
  1097. /* #endif */
  1098. }
  1099. .u-checkbox__label {
  1100. font-size: 28rpx !important;
  1101. letter-spacing: 2upx;
  1102. color: #888888 !important;
  1103. }
  1104. .tabbar {
  1105. width: 100%;
  1106. height: 100upx;
  1107. background: #ffffff;
  1108. position: fixed;
  1109. bottom: 0upx;
  1110. left: 0upx;
  1111. right: 0upx;
  1112. display: flex;
  1113. /* #ifndef MP-WEIXIN */
  1114. position: fixed;
  1115. bottom: 0upx;
  1116. left: 0upx;
  1117. right: 0upx;
  1118. /* #endif */
  1119. z-index: 99;
  1120. }
  1121. .tabbar_price {
  1122. flex: 1;
  1123. display: flex;
  1124. justify-content: left;
  1125. align-items: center;
  1126. font-size: 31rpx;
  1127. font-weight: bold;
  1128. margin-left: 40upx;
  1129. }
  1130. .tabbar_price text {
  1131. color: #FF3333;
  1132. font-size: 36upx;
  1133. font-weight: 500;
  1134. }
  1135. .tabbar_btn {
  1136. flex: 1;
  1137. display: flex;
  1138. justify-content: center;
  1139. align-items: center;
  1140. }
  1141. .but {
  1142. background: #FF7F00;
  1143. width: 200rpx;
  1144. height: 70rpx;
  1145. text-align: center;
  1146. line-height: 70rpx;
  1147. border-radius: 60rpx;
  1148. color: white;
  1149. font-size: 24rpx;
  1150. }
  1151. .actclass {
  1152. background-color: #FFD9B3;
  1153. }
  1154. /* 支付弹框 */
  1155. .popup_pay {
  1156. width: 100%;
  1157. }
  1158. .pay_btns {
  1159. width: 90%;
  1160. margin: 20rpx auto 40rpx;
  1161. text-align: center;
  1162. background: #FF7F00;
  1163. height: 80rpx;
  1164. border-radius: 16rpx;
  1165. color: #ffffff;
  1166. line-height: 80rpx;
  1167. }
  1168. </style>