createOrderT.vue 25 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014
  1. <template>
  2. <view class="padding-t-30">
  3. <view class="qrimg">
  4. <tki-qrcode :cid="ciddk" ref="qrcodet" :val="valdk" :size="size" :unit="unit" :background="background"
  5. :foreground="foreground" :pdground="pdground" :icon="icon" :iconSize="iconSize" :lv="lv" :onval="onval"
  6. :showLoading="showLoading" :loadMake="loadMake" :usingComponents="usingComponents" @result="qrRdk" />
  7. <canvas :style="{ width:cw + 'rpx', height: ch+'rpx',}" canvas-id="myCanvass" id="myCanvass"
  8. class="hb"></canvas>
  9. </view>
  10. <!-- 地址 -->
  11. <navigator url="" class="address-section">
  12. <view class="order-content" v-if="userInfo.store_id">
  13. <view class="addAddress">
  14. <text class="iconfont iconaddition"></text>
  15. <text>推荐渠道</text>
  16. </view>
  17. </view>
  18. <view class="order-content" v-else>
  19. <view class="cen">
  20. <view class="top">
  21. <text class="name">{{ shopDetail.name }}</text>
  22. <text class="mobile">{{ shopDetail.phone }}</text>
  23. </view>
  24. <text
  25. class="address flex">{{ shopDetail.address.split(',')[0] + shopDetail.address.split(',')[1] }}{{ shopDetail.name }}</text>
  26. </view>
  27. <text class="iconfont iconenter"></text>
  28. </view>
  29. </navigator>
  30. <view class="goodsList">
  31. <view class="goods-section" v-for="(ls, ind) in shopList" :key="ind">
  32. <!-- 商品列表 -->
  33. <view class="g-item">
  34. <image :src="ls.productInfo.image"></image>
  35. <view class="right">
  36. <text class="title clamp">{{ ls.productInfo.store_name }}</text>
  37. <text class="spec">{{ ls.productInfo.attrInfo ? ls.productInfo.attrInfo.suk : '默认' }}</text>
  38. <view class="price-box">
  39. <text
  40. class="price">¥{{ ls.productInfo.attrInfo ? ls.productInfo.attrInfo.price : ls.productInfo.price }}</text>
  41. <text class="number">{{ 'x ' + ls.cart_num + (ls.productInfo.unit_name || '') }}</text>
  42. <!-- <view class="number">
  43. <uni-number-box class="step" :value="lss.number" :index="indx" @eventChange="numberChange"></uni-number-box>
  44. </view> -->
  45. </view>
  46. <view class="serverSet" v-if="ls.day>0">
  47. (<text>服务费:{{ls.day_deducted}}</text>
  48. <text class="margin-l-10">服务天数:{{ls.day}}天</text>)
  49. </view>
  50. </view>
  51. </view>
  52. </view>
  53. </view>
  54. <!-- 金额明细 -->
  55. <view class="yt-list">
  56. <!-- <view class="yt-list-cell b-b">
  57. <text class="cell-tit clamp">运费</text>
  58. <text class="cell-tip disabled">{{ Postage }}</text>
  59. </view> -->
  60. <view class="yt-list-cell b-b" v-if="deposit">
  61. <text class="cell-tit clamp">押金</text>
  62. <text class="cell-tip disabled">{{ deposit }}</text>
  63. </view>
  64. <view class="yt-list-cell b-b">
  65. <text class="cell-tit clamp">备注</text>
  66. <input class="desc" type="text" v-model="desc" placeholder="请填写备注信息" placeholder-class="placeholder" />
  67. </view>
  68. <view class="yt-list-cell b-b" @click="userQxq()" >
  69. <view class="cell-tit flex" >
  70. <image class="orderIcon" src="../../static/icon/qxq.png" mode="widthFix"></image>
  71. <text class="margin-l-10">使用骑行券抵扣(可用骑行券({{userInfo.certificate}})</text>
  72. </view>
  73. <image class="checked" v-if="isqxq" src="../../static/icon/addressIconXz.png" mode="widthFix">
  74. </image>
  75. <view v-else class="noChecked"></view>
  76. </view>
  77. </view>
  78. <view class="yt-list">
  79. <view class="yt-list-cell b-b" @click="choosePayType('pxz')">
  80. <view class="cell-tit flex">
  81. <image class="orderIcon" src="../../static/icon/zqdk.png" mode="widthFix"></image>
  82. <text class="margin-l-10">使用代扣</text>
  83. </view>
  84. <image class="checked" v-if="payType=='pxz'" src="../../static/icon/addressIconXz.png"
  85. mode="widthFix"></image>
  86. <view v-else class="noChecked"></view>
  87. </view>
  88. <view class="yt-list-cell b-b" v-if="fx" @click="choosePayType('weixin')">
  89. <view class="cell-tit flex">
  90. <image class="orderIcon" src="../../static/icon/orderWx.png" mode="widthFix"></image>
  91. <text class="margin-l-10">微信支付</text>
  92. </view>
  93. <image class="checked" v-if="payType=='weixin'" src="../../static/icon/addressIconXz.png"
  94. mode="widthFix"></image>
  95. <view v-else class="noChecked"></view>
  96. </view>
  97. <!-- #ifdef APP-PLUS -->
  98. <view class="yt-list-cell b-b" @click="choosePayType('ali')">
  99. <view class="cell-tit flex">
  100. <image class="orderIcon" src="../../static/icon/orderAli.png" mode="widthFix"></image>
  101. <text class="margin-l-10">支付宝</text>
  102. </view>
  103. <image class="checked" v-if="payType=='ali'" src="../../static/icon/addressIconXz.png" mode="widthFix">
  104. </image>
  105. <view v-else class="noChecked"></view>
  106. </view>
  107. <!-- #endif -->
  108. <view class="yt-list-cell b-b" @click="choosePayType('yue')">
  109. <view class="cell-tit flex">
  110. <image class="orderIcon" src="../../static/icon/ye.png" mode="widthFix"></image>
  111. <text class="margin-l-10">余额({{now_money}})</text>
  112. </view>
  113. <image class="checked" v-if="payType=='yue'" src="../../static/icon/addressIconXz.png" mode="widthFix">
  114. </image>
  115. <view v-else class="noChecked"></view>
  116. </view>
  117. </view>
  118. <view class="myj-wrap" v-if="dkQrcodeUrl">
  119. <view class="ewm-wrap">
  120. <!-- <canvas :style="{ width:cw + 'rpx', height: ch+'rpx',}" canvas-id="myCanvass" id="myCanvass"
  121. class="hb"></canvas> -->
  122. <image :src="dkQrcodeUrl" mode="" :style="{ width:cw + 'rpx', height: ch+'rpx',}"></image>
  123. </view>
  124. <view class="bcewm" @click="saveShareQrcode('dkQrcodeUrl')">
  125. 保存二维码
  126. </view>
  127. </view>
  128. <!-- 底部 -->
  129. <view class="footer" v-show="!dkQrcodeUrl">
  130. <view class="price-content">
  131. <text>实付款</text>
  132. <text class="price-tip">¥</text>
  133. <text class="price">{{ payPrice }}</text>
  134. </view>
  135. <text class="submit" :class="{submitNo:payLoding}" @click="payLoding?'':submit()">{{payType == 'pxz'? '生成二维码': '提交订单'}}</text>
  136. </view>
  137. </view>
  138. </template>
  139. <script>
  140. import {loadIndexs,createSignFLow} from '@/api/index.js'
  141. import {
  142. mapState
  143. } from 'vuex';
  144. import {
  145. confirm,
  146. computedOrderkey,
  147. createOrderkey,
  148. orderPay
  149. } from '@/api/order.js';
  150. import {
  151. getUserInfo
  152. } from '@/api/user.js';
  153. // #ifdef H5
  154. import weixinObj from "@/plugin/jweixin-module/index.js";
  155. // #endif
  156. export default {
  157. data() {
  158. return {
  159. isqxq: false,//是否使用骑行券
  160. ewmw: 300, //二维码相对宽度
  161. cw: 702, //画布相对宽度
  162. ch: 600, //画布相对高度
  163. dkQrcodeUrl: '',
  164. canvasW: '', //画布宽度
  165. canvasH: '', //画布高度
  166. ewmImg: '', //二维码图片信息
  167. erweimasrc: '', //生成的二维码图片
  168. dkerweima: '',
  169. ciddk: 'dk-qrcode-canvas', //canvasId,页面存在多个二维码组件时需设置不同的ID
  170. size: 300, //生成的二维码大小
  171. unit: 'upx', //大小单位尺寸
  172. // show: true,//默认使用组件中的image标签显示二维码
  173. val: '', //要生成的内容
  174. valdk: '',
  175. background: '#ffffff', //二维码背景色
  176. foreground: '#333333', //二维码前景色
  177. pdground: '#333333', //二维码角标色
  178. icon: '', //二维码图标URL(必须是本地图片,网络图需要先下载至本地)
  179. iconSize: 40, //二维码图标大小
  180. lv: 3, //容错级别
  181. onval: true, //监听val值变化自动重新生成二维码
  182. loadMake: true, //组件初始化完成后自动生成二维码,val需要有值
  183. usingComponents: false, //是否使用了自定义组件模式(主要是为了修复非自定义组件模式时 v-if 无法生成二维码的问题)
  184. showLoading: false, //是否显示loading
  185. is_battery: 0,
  186. is_booster: 0,
  187. battery_deposit: 0,//押金
  188. userInfo: {},
  189. deposit_waiver: false,//是否免押
  190. payType: '',
  191. desc: '', //备注
  192. // 收货地址
  193. addressData: {},
  194. // 商品列表
  195. shopList: [],
  196. // 购物车id
  197. cartId: '',
  198. //购物金额详情
  199. moneyAll: {
  200. storeFreePostage: 0, //邮费优惠
  201. storePostage: 0, //邮费
  202. totalPrice: 0, //总支付金额
  203. vipPrice: 0 //vip优惠价
  204. },
  205. payPrice: 0, //总支付金额
  206. orderKey: '', //订单id
  207. payLoding: true, //判断是否支付中
  208. orderId: '', //订单id
  209. now_money: 0, //余额
  210. onShopId: -1, //默认-1为不存在商家id
  211. deposit: 0,//押金
  212. };
  213. },
  214. onLoad(option) {
  215. // 保存当前商品在购物车中的id
  216. this.cartId = option.id;
  217. // 判断是否要读取商家id
  218. if (option.shopId) {
  219. this.onShopId = option.shopId;
  220. }
  221. if(option.is_battery) {
  222. this.is_battery = option.is_battery
  223. }
  224. if(option.is_booster) {
  225. this.is_booster = option.is_booster
  226. }
  227. this.loadData();
  228. this.userinfo();
  229. this.loadIndexs()
  230. console.log('shopDetail',this.shopDetail);
  231. },
  232. watch:{
  233. isqxq(n,o) {
  234. this.payMoneyNub()
  235. }
  236. },
  237. computed: {
  238. Postage() {
  239. let money = +this.moneyAll.storePostage;
  240. if (money == 0) {
  241. return '免运费';
  242. } else {
  243. return '¥' + money;
  244. }
  245. },
  246. payAllMoney() {
  247. return +this.moneyAll.totalPrice + +this.moneyAll.vipPrice;
  248. },
  249. ...mapState('shop', ['shopDetail']),
  250. ...mapState(['fx'])
  251. },
  252. methods: {
  253. userQxq() {
  254. if(this.payType == 'pxz') {
  255. return this.$api.msg('周期代扣无法使用骑行券')
  256. }
  257. this.isqxq = !this.isqxq
  258. },
  259. choosePayType(payType) {
  260. if(payType == this.payType) {
  261. return
  262. }
  263. this.dkQrcodeUrl = ''
  264. if(payType == 'pxz' && this.userInfo.battery_deposit == 0) {
  265. return uni.showModal({
  266. title: '提示',
  267. content: '您未支付押金,暂无法使用代扣服务。',
  268. showCancel: false,
  269. });
  270. }
  271. this.payType = payType
  272. if(this.payType == 'pxz') {
  273. this.isqxq = false
  274. }
  275. },
  276. // 获取图片信息
  277. getImageInfo(image) {
  278. return new Promise((req, rej) => {
  279. uni.getImageInfo({
  280. src: image,
  281. success: function(res) {
  282. req(res)
  283. },
  284. });
  285. })
  286. },
  287. // 获取设备信息
  288. getSystemInfo() {
  289. return new Promise((req, rej) => {
  290. uni.getSystemInfo({
  291. success: function(res) {
  292. req(res)
  293. }
  294. });
  295. })
  296. },
  297. async createPoster(imgname, ewmimg, cavid, tit = '') {
  298. let that = this
  299. // 获取设备信息,主要获取宽度,赋值给canvasW 也就是宽度:100%
  300. that.SystemInfo = await that.getSystemInfo();
  301. that.ewmImg = await that.getImageInfo(ewmimg);
  302. // this.canvasW = this.SystemInfo.windowWidth; // 画布宽度
  303. that.ratio = that.SystemInfo.windowWidth / 750;
  304. that.canvasW = that.cw * that.ratio;
  305. this.canvasH = that.ch * that.ratio;
  306. that.ewmW = that.ewmw * that.ratio;
  307. // 如果主图,二维码图片,设备信息都获取成功,开始绘制海报,这里需要用setTimeout延时绘制,否则可能会出现图片不显示。
  308. if (that.ewmImg.errMsg == 'getImageInfo:ok' && that.SystemInfo.errMsg == 'getSystemInfo:ok') {
  309. console.log('二维码和屏幕信息加载完成')
  310. setTimeout(() => {
  311. var ctx = uni.createCanvasContext(cavid, that);
  312. // 填充背景色,白色
  313. ctx.setFillStyle('#fff'); // 默认白色
  314. ctx.fillRect(0, 0, this.canvasW, this.canvasH) // fillRect(x,y,宽度,高度)
  315. // drawImage(图片路径,x,y,绘制图像的宽度,绘制图像的高度)
  316. ctx.drawImage(this.ewmImg.path, (this.canvasW / 2 - this.ewmW / 2), 100 * that.ratio,
  317. this.ewmW, this.ewmW) // drawImage(图片路径,x,y,绘制图像的宽度,绘制图像的高度,二维码的宽,高)
  318. // 3、绘制商品标题,多余文字自动换行
  319. ctx.setFontSize(16); // setFontSize() 设置字体字号
  320. ctx.setFillStyle('#333'); // setFillStyle() 设置字体颜色
  321. ctx.setTextAlign('center')
  322. ctx.fillText('请使用支付宝扫描上方二维码', this.canvasW / 2, 200 * that.ratio + that.ewmW)
  323. ctx.fillText(tit, this.canvasW / 2, 260 * that.ratio + that.ewmW)
  324. ctx.draw(false, (ret) => { // draw方法 把以上内容画到 canvas 中。
  325. that.fina = true
  326. uni.canvasToTempFilePath({ // 保存canvas为图片
  327. canvasId: cavid,
  328. quality: 1,
  329. fileType: 'jpg',
  330. complete: function(res) {
  331. // 在H5平台下,tempFilePath 为 base64, // 图片提示跨域 H5保存base64失败,APP端正常输出临时路径
  332. console.log(res)
  333. // that.canvasShow = false
  334. that[imgname] = res.tempFilePath
  335. that.$forceUpdate()
  336. uni.hideLoading()
  337. that.payLoding = false;
  338. // setTimeout(function() {
  339. // console.log(that.shareQrcodeUrl, that
  340. // .canvasShow)
  341. // }, 2000)
  342. },
  343. })
  344. });
  345. }, 1500)
  346. } else {
  347. console.log('err')
  348. }
  349. },
  350. qrRdk(res) {
  351. this.dkerweima = res
  352. this.createPoster('dkQrcodeUrl', this.dkerweima, 'myCanvass', '完成代扣服务')
  353. },
  354. loadIndexs() {
  355. loadIndexs().then(res => {
  356. console.log(res);
  357. this.battery_deposit = (res.data.battery_deposit*1).toFixed(2)
  358. })
  359. },
  360. // 加载用户基础信息
  361. userinfo() {
  362. getUserInfo({}).then(({
  363. data
  364. }) => {
  365. this.userInfo = data
  366. this.now_money = data.now_money;
  367. });
  368. },
  369. // 计算支付金额
  370. payMoneyNub() {
  371. computedOrderkey({
  372. is_certificate: this.isqxq,
  373. orderkey: this.orderKey,
  374. useIntegral: 0, //是否积分抵扣
  375. addressId: this.addressData.id //地址编号
  376. })
  377. .then(({
  378. data
  379. }) => {
  380. this.integralShow = true;
  381. // 获取支付金额
  382. this.payPrice = +data.result.pay_price;
  383. this.integralMoney = data.result.deduction_price;
  384. this.payLoding = false
  385. this.deposit = +data.result.deposit
  386. })
  387. .catch(e => {
  388. console.log(e);
  389. this.payLoding = true
  390. this.integralShow = false;
  391. });
  392. },
  393. // 加载基础数据
  394. loadData() {
  395. let obj = this;
  396. confirm({
  397. cartId: obj.cartId + '',
  398. // store_id:obj.shopDetail.id
  399. }).then(({
  400. data
  401. }) => {
  402. obj.addressData = data.addressInfo || {};
  403. obj.shopList = data.cartInfo; //商品列表
  404. obj.moneyAll = data.priceGroup; //金额数据
  405. obj.orderKey = data.orderKey; //订单key
  406. // 计算金额
  407. this.payMoneyNub();
  408. });
  409. },
  410. // 提交订单
  411. submit() {
  412. let obj = this;
  413. // if (!this.addressData.real_name) {
  414. // this.$api.msg('请选择收货地址');
  415. // return false;
  416. // }
  417. if(!obj.payType) {
  418. return obj.$api.msg('请选择支付方式')
  419. }
  420. // 判断是否余额不足
  421. if (obj.payType == 'yue' && +obj.now_money < obj.payPrice) {
  422. uni.showModal({
  423. title: '提示',
  424. content: '账户余额不足!',
  425. showCancel: false,
  426. });
  427. return;
  428. }
  429. if(obj.payType == 'pxz') {
  430. uni.showLoading({
  431. title: '二维码生成中',
  432. mask: true
  433. })
  434. }else {
  435. uni.showLoading({
  436. title: '支付中',
  437. mask: true
  438. })
  439. }
  440. // 支付中
  441. obj.payLoding = true;
  442. // 判断是否为未支付订单中跳转进入
  443. obj.firstCreateOrder();
  444. },
  445. // 订单金额支付
  446. orderMoneyPay() {
  447. let obj = this;
  448. orderPay({
  449. uni: obj.orderId,
  450. // #ifdef H5
  451. from: 'weixin', //来源
  452. // #endif
  453. // #ifdef MP-WEIXIN
  454. from: 'routine', //来源
  455. // #endif
  456. // #ifdef APP-PLUS
  457. from: 'app', //来源
  458. // #endif
  459. paytype: obj.payType //支付类型 weixin-微信 yue-余额
  460. })
  461. .then(e => {
  462. // 判断是否微信小程序支付
  463. if (obj.payType == 'weixin') {
  464. // #ifdef H5 || MP
  465. let da = e.data.result.jsConfig;
  466. let data = {
  467. nonceStr: da.nonceStr,
  468. package: da.package,
  469. signType: da.signType,
  470. paySign: da.paySign,
  471. success: function(res) {
  472. obj.paySuccessTo();
  473. },
  474. fail: () => {
  475. uni.navigateTo({
  476. url: '/pages/order/order?state=0'
  477. });
  478. }
  479. };
  480. // #endif
  481. // #ifdef H5
  482. data.timestamp = da.timestamp;
  483. weixinObj.chooseWXPay(data);
  484. // #endif
  485. // #ifdef MP-WEIXIN
  486. data.timeStamp = da.timestamp;
  487. wx.requestPayment(data);
  488. // #endif
  489. // #ifdef APP
  490. console.log( e.data.result.jsConfig,'返回数值');
  491. uni.requestPayment({
  492. provider: 'wxpay',
  493. orderInfo: e.data.result.jsConfig,
  494. success(e) {
  495. obj.paySuccessTo();
  496. },
  497. fail: (e) => {
  498. console.log(e,'支付失败');
  499. uni.navigateTo({
  500. url: '/pages/order/order?state=0'
  501. });
  502. }
  503. })
  504. // #endif
  505. }
  506. // #ifdef APP
  507. if(obj.payType == 'ali'){
  508. uni.requestPayment({
  509. provider: 'alipay',
  510. orderInfo: e.data.result.jsConfig,
  511. success(e) {
  512. obj.paySuccessTo();
  513. },
  514. fail: (e) => {
  515. console.log(e,'支付失败');
  516. uni.navigateTo({
  517. url: '/pages/order/order?state=0'
  518. });
  519. }
  520. })
  521. }
  522. // #endif
  523. uni.hideLoading();
  524. obj.payLoding = false;
  525. })
  526. .catch(e => {
  527. // 支付完成
  528. uni.hideLoading();
  529. obj.payLoding = false;
  530. console.log(e);
  531. });
  532. },
  533. // 支付成功跳转
  534. paySuccessTo() {
  535. uni.hideLoading();
  536. uni.redirectTo({
  537. url: '/pages/user/money/paySuccess?orderid=' + this.orderId,
  538. });
  539. },
  540. // 初次订单创建
  541. firstCreateOrder() {
  542. let obj = this;
  543. // 获取下单页面数据
  544. let prepage = obj;
  545. let data = {
  546. is_car: 0,
  547. is_certificate: obj.isqxq,
  548. is_booster: obj.is_booster,
  549. is_battery: obj.is_battery,
  550. real_name: prepage.addressData.real_name, //联系人名称
  551. phone: prepage.addressData.phone, //联系人号码
  552. addressId: prepage.addressData.id, //支付地址id
  553. useIntegral: 0, //是否积分抵扣1为是0为否
  554. payType: obj.payType, //支付类型 weixin-微信 yue-余额
  555. mark: prepage.desc, //备注
  556. // #ifdef H5
  557. from: 'weixin', //来源
  558. // #endif
  559. // #ifdef MP-WEIXIN
  560. from: 'routine', //来源
  561. // #endif
  562. // #ifdef APP-PLUS
  563. from: 'app', //来源
  564. // #endif
  565. shipping_type: 2, //提货方式 1 快递 2自提
  566. };
  567. // 判断是否需要读取非默认商家id
  568. if (obj.onShopId != -1) {
  569. data.store_id = obj.onShopId;
  570. } else {
  571. if(obj.userInfo.store_id) {
  572. data.store_id = obj.userInfo.store_id
  573. }else {
  574. data.store_id = obj.shopDetail.id;
  575. }
  576. }
  577. // 生成订单
  578. createOrderkey(data, obj.orderKey)
  579. .then(({
  580. data,
  581. status,
  582. msg
  583. }) => {
  584. // 判断是否支付失败
  585. if (data.status == 'ORDER_EXIST') {
  586. uni.showModal({
  587. title: '提示',
  588. content: msg,
  589. showCancel: false
  590. });
  591. uni.hideLoading();
  592. obj.payLoding = false;
  593. return;
  594. }
  595. // 保存订单号
  596. obj.orderId = data.result.orderId;
  597. // 判断是否为余额支付
  598. if (obj.payType == 'yue') {
  599. console.log('余额支付', status == 200 && data.status == 'SUCCESS');
  600. if (status == 200 && data.status == 'SUCCESS') {
  601. obj.paySuccessTo();
  602. } else {
  603. obj.$api.msg(msg);
  604. }
  605. } else if( obj.payType == 'pxz'){
  606. createSignFLow().then(res => {
  607. obj.valdk = res.data.result.link
  608. })
  609. }else {
  610. // 立即支付
  611. obj.orderMoneyPay();
  612. }
  613. })
  614. .catch(e => {
  615. uni.hideLoading();
  616. obj.payLoding = false;
  617. console.log(e);
  618. });
  619. }
  620. }
  621. };
  622. </script>
  623. <style lang="scss">
  624. page {
  625. background: $page-color-base;
  626. padding-bottom: 100rpx;
  627. }
  628. .address-section {
  629. border-radius: 20rpx;
  630. padding: 30rpx;
  631. margin: 0 $page-row-spacing;
  632. background: #fff;
  633. position: relative;
  634. .order-content {
  635. min-height: 100rpx;
  636. display: flex;
  637. align-items: center;
  638. .leftIcon {
  639. width: 36rpx;
  640. margin: 0 30rpx;
  641. }
  642. .addAddress {
  643. text-align: center;
  644. width: 100%;
  645. display: flex;
  646. justify-content: center;
  647. align-items: center;
  648. .iconaddition {
  649. font-size: 55rpx;
  650. line-height: 1;
  651. border-radius: 100rpx;
  652. margin-right: 20rpx;
  653. }
  654. }
  655. }
  656. .iconlocation {
  657. flex-shrink: 0;
  658. display: flex;
  659. align-items: center;
  660. justify-content: center;
  661. width: 90rpx;
  662. color: #888;
  663. font-size: 44rpx;
  664. }
  665. .cen {
  666. display: flex;
  667. flex-direction: column;
  668. flex: 1;
  669. font-size: 28rpx;
  670. color: $font-color-dark;
  671. }
  672. .name {
  673. font-size: 34rpx;
  674. margin-right: 24rpx;
  675. }
  676. .address {
  677. margin-top: 16rpx;
  678. margin-right: 20rpx;
  679. color: $font-color-light;
  680. }
  681. .icon-you {
  682. font-size: 32rpx;
  683. color: $font-color-light;
  684. margin-right: 30rpx;
  685. }
  686. .a-bg {
  687. position: absolute;
  688. left: 0;
  689. bottom: 0;
  690. display: block;
  691. width: 100%;
  692. height: 5rpx;
  693. }
  694. }
  695. .goodsList {
  696. margin: 0 $page-row-spacing;
  697. padding: 30rpx;
  698. background: #fff;
  699. border-radius: 20rpx;
  700. margin-top: 30rpx;
  701. }
  702. .goods-section {
  703. .logo {
  704. display: block;
  705. width: 50rpx;
  706. height: 50rpx;
  707. border-radius: 100px;
  708. }
  709. .name {
  710. font-size: 30rpx;
  711. color: $font-color-base;
  712. margin-left: 24rpx;
  713. }
  714. .g-item {
  715. display: flex;
  716. image {
  717. flex-shrink: 0;
  718. display: block;
  719. width: 170rpx;
  720. height: 170rpx;
  721. border-radius: 4rpx;
  722. }
  723. .right {
  724. flex: 1;
  725. padding-left: 24rpx;
  726. overflow: hidden;
  727. .serverSet {
  728. font-size: 22rpx;
  729. color: $font-color-light;
  730. }
  731. }
  732. .title {
  733. font-size: 30rpx;
  734. color: $font-color-dark;
  735. }
  736. .spec {
  737. font-size: 26rpx;
  738. color: $font-color-light;
  739. }
  740. .price-box {
  741. display: flex;
  742. align-items: center;
  743. font-size: 32rpx;
  744. padding-top: 10rpx;
  745. color: $font-color-light;
  746. .price {
  747. margin-bottom: 4rpx;
  748. }
  749. .number {
  750. font-size: 26rpx;
  751. margin-left: 20rpx;
  752. }
  753. }
  754. .step-box {
  755. position: relative;
  756. }
  757. }
  758. }
  759. .yt-list {
  760. background: #fff;
  761. margin: 0 $page-row-spacing;
  762. margin-top: 30rpx;
  763. border-radius: 20rpx;
  764. }
  765. .yt-list-cell {
  766. display: flex;
  767. align-items: center;
  768. justify-content: space-between;
  769. padding: 10rpx 30rpx 10rpx 40rpx;
  770. line-height: 70rpx;
  771. position: relative;
  772. .checked,
  773. .noChecked {
  774. width: 36rpx;
  775. height: 36rpx;
  776. }
  777. .noChecked {
  778. border: 1px solid $font-color-light;
  779. border-radius: 100rpx;
  780. }
  781. &.cell-hover {
  782. background: #fafafa;
  783. }
  784. &.b-b:after {
  785. left: 30rpx;
  786. }
  787. .cell-icon {
  788. height: 32rpx;
  789. width: 32rpx;
  790. font-size: 22rpx;
  791. color: #fff;
  792. text-align: center;
  793. line-height: 32rpx;
  794. background: #f85e52;
  795. border-radius: 4rpx;
  796. margin-right: 12rpx;
  797. &.hb {
  798. background: #ffaa0e;
  799. }
  800. &.lpk {
  801. background: #3ab54a;
  802. }
  803. }
  804. .cell-more {
  805. align-self: center;
  806. font-size: 24rpx;
  807. color: $font-color-light;
  808. margin-left: 8rpx;
  809. margin-right: -10rpx;
  810. }
  811. .cell-tit {
  812. font-size: 26rpx;
  813. color: $font-color-light;
  814. margin-right: 10rpx;
  815. .orderIcon {
  816. width: 48rpx;
  817. }
  818. }
  819. .cell-tip {
  820. font-size: 26rpx;
  821. color: $font-color-dark;
  822. &.disabled {
  823. color: $font-color-light;
  824. }
  825. &.active {
  826. color: $base-color;
  827. }
  828. &.red {
  829. color: $base-color;
  830. }
  831. }
  832. &.desc-cell {
  833. .cell-tit {
  834. max-width: 90rpx;
  835. }
  836. }
  837. .desc {
  838. text-align: right;
  839. font-size: $font-base;
  840. color: $font-color-light;
  841. }
  842. }
  843. /* 支付列表 */
  844. .pay-list {
  845. padding-left: 40rpx;
  846. margin-top: 16rpx;
  847. background: #fff;
  848. .pay-item {
  849. display: flex;
  850. align-items: center;
  851. padding-right: 20rpx;
  852. line-height: 1;
  853. height: 110rpx;
  854. position: relative;
  855. }
  856. .icon-weixinzhifu {
  857. width: 80rpx;
  858. font-size: 40rpx;
  859. color: #6bcc03;
  860. }
  861. .icon-alipay {
  862. width: 80rpx;
  863. font-size: 40rpx;
  864. color: #06b4fd;
  865. }
  866. .icon-xuanzhong2 {
  867. display: flex;
  868. align-items: center;
  869. justify-content: center;
  870. width: 60rpx;
  871. height: 60rpx;
  872. font-size: 40rpx;
  873. color: $base-color;
  874. }
  875. .tit {
  876. font-size: 32rpx;
  877. color: $font-color-dark;
  878. flex: 1;
  879. }
  880. }
  881. .footer {
  882. position: fixed;
  883. left: 0;
  884. bottom: 0;
  885. z-index: 995;
  886. display: flex;
  887. align-items: center;
  888. width: 100%;
  889. height: 90rpx;
  890. justify-content: space-between;
  891. font-size: 30rpx;
  892. background-color: #fff;
  893. z-index: 998;
  894. color: $font-color-base;
  895. box-shadow: 0 -1px 5px rgba(0, 0, 0, 0.1);
  896. .price-content {
  897. padding-left: 30rpx;
  898. }
  899. .price-tip {
  900. color: $font-color-base;
  901. margin-left: 8rpx;
  902. }
  903. .price {
  904. font-size: 36rpx;
  905. color: $font-color-base;
  906. }
  907. .submit {
  908. display: flex;
  909. align-items: center;
  910. justify-content: center;
  911. width: 280rpx;
  912. height: 100%;
  913. color: #fff;
  914. font-size: 32rpx;
  915. background-color: $base-color;
  916. &.submitNo {
  917. background-color: $font-color-disabled;
  918. }
  919. }
  920. }
  921. .qrimg {
  922. position: absolute;
  923. left: -9999rpx;
  924. top: -9999rpx;
  925. }
  926. .ewm-wrap {
  927. border-radius: 20rpx;
  928. overflow: hidden;
  929. }
  930. .bcewm {
  931. background-color: $base-color;
  932. color: #fff;
  933. text-align: center;
  934. height: 80rpx;
  935. width: 702rpx;
  936. border-radius: 40rpx;
  937. margin: auto;
  938. margin-top: 30rpx;
  939. display: flex;
  940. justify-content: center;
  941. align-items: center;
  942. // margin-left: 75rpx;
  943. }
  944. .myj-wrap {
  945. width: 702rpx;
  946. margin: auto;
  947. margin-top: 20rpx;
  948. }
  949. </style>