order.vue 31 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256
  1. <template>
  2. <view class="app-container" :class="isNoticebar ? 'hasNoticebar' : ''">
  3. <view class="noticebar" v-if="isNoticebar">
  4. <uni-notice-bar v-if="noticeContent" scrollable="true" single="true" showClose="true" :text="noticeContent"
  5. background-color="#f6e6e7" color="#de3749" @close="closeNoticebar"></uni-notice-bar>
  6. </view>
  7. <view class="address-container" @tap="chooseAddress">
  8. <view class="left">
  9. <view class="icon">
  10. <image src="../../static/icon/address.png"></image>
  11. </view>
  12. <view class="nodata" v-if="!hasAddress">选择收货地址</view>
  13. <view class="hasdata" v-else>
  14. <view class="name">{{ addressInfo.name }}<text>{{ addressInfo.phone }}</text></view>
  15. <view class="address ellipsis-2">{{ addressInfo.province }}{{ addressInfo.city
  16. }}{{ addressInfo.area }}{{ addressInfo.street
  17. }}{{ addressInfo.address }}{{ addressInfo.houseNo }}</view>
  18. </view>
  19. </view>
  20. <image class="right" src="../../static/icon/right.png"></image>
  21. </view>
  22. <view class="card goods-container">
  23. <view class="title">商品信息</view>
  24. <block v-for="(item, index) in goodsList" :key="index">
  25. <view>
  26. <view class="item">
  27. <image v-if="
  28. item.logo &&
  29. $compareTime(item.logoStartTime, item.logoEndTime) && item.mergeImage
  30. " :src="item.mergeImage"></image>
  31. <image v-else :src="item.imgUrl"></image>
  32. <view class="right">
  33. <view class="name ellipsis-2">{{ item.goodsName }}</view>
  34. <view class="des">{{ item.specValue }}</view>
  35. <view class="bottom">
  36. <view class="price">
  37. <view class="price-1">¥{{ item.price | numToFixed }}</view>
  38. <view class="price-2">¥{{ item.orgPrice | numToFixed }}</view>
  39. </view>
  40. <u-number-box @tap.stop v-model="item.num" :min="1" :buttonSize="26"
  41. iconStyle="font-size: 12px;" :disabled="!hasAddress"
  42. @change="changeCount($event, index)">
  43. </u-number-box>
  44. </view>
  45. </view>
  46. </view>
  47. <view style="box-sizing: border-box; padding: 10rpx 0">
  48. <view class="guobutishi" v-if="
  49. goodsList.length == 1 &&
  50. item.num == 1 &&
  51. [
  52. 'GDYJKT',
  53. 'GDYJBX',
  54. 'GDYJXYJ',
  55. 'GDYJXYYJ',
  56. 'GDYJDZ',
  57. 'GDYJRSQ',
  58. ].includes(item.umsDiscountCode)
  59. ">
  60. <view class="guobutishi1">云闪付</view>
  61. <view class="guobutishi2">用券新机补贴预估{{ (item.price * 0.2).toFixed(2) }}元</view>
  62. </view>
  63. <view class="guobutishi" v-if="
  64. goodsList.length == 1 &&
  65. item.num == 1 &&
  66. [
  67. 'GDEJKT',
  68. 'GDEJBX',
  69. 'GDEJXYJ',
  70. 'GDEJXYYJ',
  71. 'GDEJDZ',
  72. 'GDEJRSQ',
  73. ].includes(item.umsDiscountCode)
  74. ">
  75. <view class="guobutishi1">云闪付</view>
  76. <view class="guobutishi2">用券新机补贴预估{{ (item.price * 0.15).toFixed(2) }}元</view>
  77. </view>
  78. </view>
  79. </view>
  80. </block>
  81. </view>
  82. <view class="card row-container">
  83. <view class="item">
  84. <view class="title">优惠券</view>
  85. <view class="coupon" @tap="chooseCoupon">
  86. <text v-if="hasCoupon">{{ couponInfo.couponName }}</text>
  87. <text v-else style="color: #666666">未使用优惠券</text>
  88. <image src="../../static/icon/right.png"></image>
  89. </view>
  90. </view>
  91. <view class="item">
  92. <view class="title">配送方式</view>
  93. <view class="right" v-if="freight == 0">快递包邮</view>
  94. <view class="right" v-if="freight != 0">快递自费</view>
  95. </view>
  96. <!-- <view class="item" v-if="isServiceUser">
  97. <view class="title">工单派单方式</view>
  98. <view class="radio-group">
  99. <view class="radio" @tap="dispatchType = 1">
  100. <text
  101. class="iconfont"
  102. :class="
  103. dispatchType === 1 ? 'icon-danxuan2 active' : 'icon-danxuan'
  104. "
  105. ></text>
  106. 自卖自装
  107. </view>
  108. <view class="radio" @tap="dispatchType = 2">
  109. <text
  110. class="iconfont"
  111. :class="
  112. dispatchType === 2 ? 'icon-danxuan2 active' : 'icon-danxuan'
  113. "
  114. ></text>
  115. 当地安装
  116. </view>
  117. </view>
  118. </view> -->
  119. <view class="item">
  120. <view class="title">买家留言</view>
  121. <view class="remark">
  122. <textarea auto-height :placeholder="isApplyDialog ? '' : '选填,留言建议50字内'" v-model="remark"></textarea>
  123. </view>
  124. </view>
  125. </view>
  126. <view class="card row-container">
  127. <view class="item">
  128. <view class="title">商品金额</view>
  129. <view class="orange">¥{{ orderInfo.totalAmount | numToFixed }}</view>
  130. </view>
  131. <view class="item">
  132. <view class="title">运费</view>
  133. <view class="orange">¥{{ freight | numToFixed }}</view>
  134. </view>
  135. <view class="item">
  136. <view class="title">优惠</view>
  137. <view class="orange">-¥{{
  138. (couponInfo.couponValue
  139. ? couponInfo.couponValue
  140. : orderInfo.exchangeAmount || 0) | numToFixed
  141. }}</view>
  142. </view>
  143. <view class="item" v-if="orderInfo.promotionDiscountRate">
  144. <view class="title">折扣优惠</view>
  145. <view class="orange">-¥{{ orderInfo.discountAmount | numToFixed }}({{
  146. orderInfo.promotionDiscountRate * 10
  147. }}折)</view>
  148. </view>
  149. </view>
  150. <view class="card row-container">
  151. <view class="item">
  152. <view class="title">优惠码</view>
  153. <view class="input"><input placeholder="请输入优惠码" v-model="exchangeCode" @blur="exchangeCodeBlur()" />
  154. </view>
  155. </view>
  156. </view>
  157. <view class="card row-container">
  158. <view class="item">
  159. <view class="title">订单总金额</view>
  160. <view class="orange">¥{{ orderInfo.payAmount | numToFixed }}</view>
  161. </view>
  162. <!-- <view class="item">
  163. <view class="title">减免金额申请</view>
  164. <view class="orange">-¥0.00</view>
  165. </view>
  166. <view class="item">
  167. <view class="title">应付总金额</view>
  168. <view class="orange">¥{{orderInfo.payAmount | numToFixed}}</view>
  169. </view> -->
  170. </view>
  171. <view class="bottom-container">
  172. <!-- <view class="left">共{{orderInfo.totalNum}}件,合计:<text>¥{{orderInfo.payAmount | numToFixed}}</text></view> -->
  173. <view class="btn-group">
  174. <view class="button3" @tap="toApply" v-if="isServiceUser && isInnerrUser && !isGiftGoods">申请减免金额</view>
  175. <view class="button2" @tap="replaceOrder" v-if="(isServiceUser || isHeadUser) && !isGiftGoods">代客下单
  176. </view>
  177. <view class="button" @tap="submitOrder">提交订单</view>
  178. </view>
  179. </view>
  180. <!-- 代客下单 -->
  181. <view class="global-mask" v-show="isCodeDialog"></view>
  182. <view class="codeDialog" v-show="isCodeDialog">
  183. <view class="close">
  184. <image src="@/static/icon/close.png" @tap="isCodeDialog = false"></image>
  185. </view>
  186. <!-- <view class="code"><image :src="'data:image/jpeg;base64,' + codeUrl" mode="aspectFill"></image></view> -->
  187. <view class="code">
  188. <image :src="codeUrl" mode="aspectFill"></image>
  189. </view>
  190. <view class="tips">请让客户扫码下单</view>
  191. </view>
  192. <modal-dialog showTitle="提示" showText="优惠券和优惠码只能使用其中一个" :isShowDialog="isBothDialog"
  193. @cancel="chooseDiscountWay(1)" @confirm="chooseDiscountWay(2)" cancelText="使用优惠券"
  194. confirmText="使用优惠码"></modal-dialog>
  195. <modal-dialog showTitle="提示" :showText="errorMsg" :isShowDialog="isErrorDialog" :isShowCancel="false"
  196. @confirm="isErrorDialog = false"></modal-dialog>
  197. <view class="apply-dialog" v-show="isApplyDialog">
  198. <view class="dialog">
  199. <view class="title">减免金额申请</view>
  200. <view class="content">
  201. <view class="row">
  202. <text>订单金额:¥{{ orderInfo.payAmount | numToFixed }}</text>
  203. </view>
  204. <view class="row">
  205. <text>减免金额:</text><input type="digit" v-model="applyForm.amount" /><text></text>
  206. </view>
  207. <view class="row">
  208. <text>应付金额:¥{{
  209. ((orderInfo.payAmount * 100 - applyForm.amount * 100) / 100)
  210. | numToFixed
  211. }}</text>
  212. </view>
  213. <view class="row">
  214. <text>申请备注:</text><input type="text" v-model="applyForm.remark" /><text></text>
  215. </view>
  216. </view>
  217. <view class="btn">
  218. <view class="left" @tap="cancelApplyForm">取消</view>
  219. <view class="right" @tap="confirmApplyForm">提交</view>
  220. </view>
  221. </view>
  222. </view>
  223. <zhifutanchuan v-if="detail_" :orderInfo="orderInfo" @PAY_TYPE_STR="PAY_TYPE_STR" />
  224. </view>
  225. </template>
  226. <script>
  227. import {
  228. mapState
  229. } from 'vuex';
  230. import EventBus from '@/utils/eventbus.js';
  231. import modalDialog from '@/components/modalDialog.vue';
  232. import zhifutanchuan from '@/components/zhifutanchuan.vue';
  233. export default {
  234. components: {
  235. modalDialog,
  236. zhifutanchuan,
  237. },
  238. data() {
  239. return {
  240. detail_: null,
  241. configInfo: uni.getStorageSync('configInfo'),
  242. hasAddress: false, // 是否有收货地址
  243. addressInfo: {}, // 收货地址信息
  244. hasCoupon: false, // 是否有优惠券
  245. couponInfo: {}, // 优惠券信息
  246. buyList: [], // 商品列表(从商品详情带入,用于请求订单信息接口)
  247. orderInfo: {}, // 订单信息
  248. goodsList: [], // 商品列表(从订单信息接口获取,用于渲染)
  249. freight: 0, // 运费
  250. remark: '', // 买家留言
  251. isCodeDialog: false, // 代客下单弹窗
  252. codeUrl: '', // 代客下单二维码
  253. isSeckill: false, // 是否秒杀订单
  254. secKillId: null, // 秒杀id
  255. secKillSpecId: null,
  256. secToken: null,
  257. orderId: null, // 订单id
  258. isGiftGoods: false, // 是否福利商品
  259. exchangeCode: '', // 优惠码
  260. isNoticebar: false, // 是否显示公告栏
  261. noticeContent: '', // 公告内容
  262. groupbuyId: null, // 团购id
  263. isBothDialog: false, // 优惠券和优惠码都选择的提示
  264. packageId: null, // 套购id
  265. isErrorDialog: false,
  266. errorMsg: '',
  267. dispatchType: 1,
  268. isApplyDialog: false,
  269. applyForm: {
  270. amount: '',
  271. remark: '',
  272. },
  273. };
  274. },
  275. computed: {
  276. ...mapState(['userInfo', 'isLogin', 'userId']),
  277. isServiceUser() {
  278. // 是否业务员
  279. return this.userInfo.type === 'SERVICE';
  280. },
  281. isHeadUser() {
  282. // 是否团长
  283. return this.userInfo.promotionGroupLeader;
  284. },
  285. isInnerrUser() {
  286. // 是否内部人员
  287. return this.userInfo.innerr;
  288. },
  289. total() {
  290. let price = Number(this.orderInfo.totalAmount); // 商品金额
  291. let freight = Number(this.freight); // 运费
  292. let coupon = this.couponInfo.couponValue ?
  293. Number(this.couponInfo.couponValue) :
  294. Number(this.orderInfo.exchangeAmount || 0); // 优惠金额
  295. let total = price + freight - coupon; // 合计
  296. return total < 0 ? 0 : total;
  297. },
  298. },
  299. async onLoad({
  300. buyList,
  301. secKillId,
  302. secKillSpecId,
  303. secToken,
  304. groupbuyId,
  305. packageId,
  306. }) {
  307. this.getNoticebar();
  308. this.buyList = JSON.parse(buyList);
  309. console.log(this.buyList);
  310. this.secKillId = secKillId;
  311. this.secKillSpecId = secKillSpecId;
  312. this.secToken = secToken;
  313. this.groupbuyId = groupbuyId;
  314. this.packageId = packageId;
  315. // 进入页面先获取默认地址
  316. await this.getAddress();
  317. // 获取订单信息
  318. this.getOrderInfo();
  319. // 接收地址信息
  320. EventBus.$on('chooseAddress', (result) => {
  321. this.hasAddress = true;
  322. this.addressInfo = result;
  323. this.getOrderInfo();
  324. });
  325. // 接收优惠券信息
  326. EventBus.$on('chooseCoupon', (result) => {
  327. if (result) {
  328. this.hasCoupon = true;
  329. this.couponInfo = result;
  330. } else {
  331. this.hasCoupon = false;
  332. this.couponInfo = {};
  333. }
  334. this.getOrderInfo();
  335. });
  336. },
  337. destroyed() {
  338. EventBus.$off(['chooseAddress', 'chooseCoupon']);
  339. },
  340. methods: {
  341. findElem(array, attr, val) {
  342. for (var i = 0; i < array.length; i++) {
  343. if (array[i][attr] == val) {
  344. return i; //返回当前索引值
  345. }
  346. }
  347. return -1;
  348. },
  349. // 获取公告栏
  350. getNoticebar() {
  351. this.$axios({
  352. url: '/shpping/cart/notice',
  353. method: 'get',
  354. params: {
  355. userId: this.userId,
  356. },
  357. }).then((res) => {
  358. this.noticeContent = res.data;
  359. this.isNoticebar = res.data ? true : false;
  360. });
  361. },
  362. // 关闭通告栏
  363. closeNoticebar() {
  364. this.isNoticebar = false;
  365. },
  366. // 获取订单信息
  367. getOrderInfo(type) {
  368. this.$axios({
  369. url: '/order/ackdata',
  370. type: 'application/json',
  371. params: {
  372. buyGoods: this.buyList,
  373. userAddressId: this.addressInfo.userAddressId,
  374. userCouponId: this.hasCoupon ? this.couponInfo.id : '',
  375. exchangeCode: this.exchangeCode,
  376. promotionGroupId: this.groupbuyId || '',
  377. goodsPackageId: this.packageId || '',
  378. },
  379. })
  380. .then((res) => {
  381. if (res.code == 1100) {
  382. this.errorMsg = res.message;
  383. this.isErrorDialog = true;
  384. uni.hideLoading();
  385. setTimeout(() => {
  386. uni.showToast({
  387. title: res.message,
  388. icon: 'none'
  389. });
  390. }, 500)
  391. return false;
  392. // return this.$toast(res.message);
  393. } else if (res.code !== 200) {
  394. setTimeout(() => {
  395. uni.navigateBack({
  396. delta: 1,
  397. });
  398. }, 1000);
  399. }
  400. this.orderInfo = res.data;
  401. this.goodsList = res.data.goods;
  402. this.isSeckill = res.data.isSecKill;
  403. this.freight = res.data.freight;
  404. this.isGiftGoods = this.findElem(res.data.goods, 'isGift', true) >= 0;
  405. })
  406. .catch((res) => {
  407. setTimeout(() => {
  408. uni.navigateBack({
  409. delta: 1,
  410. });
  411. }, 1000);
  412. });
  413. },
  414. // 获取地址信息
  415. async getAddress() {
  416. const result = new Promise((resolve, reject) => {
  417. this.$axios({
  418. url: '/user/address/list',
  419. method: 'get',
  420. params: {
  421. pageNum: 1,
  422. pageSize: 100,
  423. userId: this.userId,
  424. },
  425. }).then((res) => {
  426. let hasDefault = this.findElem(res.data.records, 'defaultAddr', true);
  427. if (hasDefault >= 0) {
  428. this.hasAddress = true;
  429. this.addressInfo = res.data.records[hasDefault];
  430. } else {
  431. this.hasAddress = false;
  432. }
  433. resolve();
  434. });
  435. });
  436. return result;
  437. },
  438. findElem(array, attr, val) {
  439. for (var i = 0; i < array.length; i++) {
  440. if (array[i][attr] == val) {
  441. return i; //返回当前索引值
  442. }
  443. }
  444. return -1;
  445. },
  446. // 去选择优惠券
  447. chooseCoupon() {
  448. // if(this.isSeckill) {
  449. // return this.$toast('秒杀商品不可使用优惠券');
  450. // }
  451. let goodsIds = [];
  452. this.goodsList.forEach((item) => {
  453. goodsIds.push(item.goodsId);
  454. });
  455. let amount = Number(this.orderInfo.totalAmount) + Number(this.freight);
  456. uni.navigateTo({
  457. url: '/packageGoods/pages/coupon?orderAmount=' +
  458. amount +
  459. '&goodsIds=' +
  460. JSON.stringify(goodsIds),
  461. });
  462. },
  463. // 去选择地址
  464. chooseAddress() {
  465. uni.navigateTo({
  466. url: '/pages/mine/address/list?isChoose=' + true,
  467. });
  468. },
  469. // 更改数量
  470. changeCount(e, index) {
  471. this.buyList[index].num = e.value;
  472. this.getOrderInfo();
  473. },
  474. // 礼品卡密码失去光标
  475. exchangeCodeBlur() {
  476. if (this.exchangeCode.length >= 8) {
  477. this.getOrderInfo('psw');
  478. }
  479. },
  480. // 选择优惠方式
  481. chooseDiscountWay(type) {
  482. if (type === 1) {
  483. this.exchangeCode = '';
  484. } else {
  485. this.hasCoupon = false;
  486. this.couponInfo = {};
  487. }
  488. this.isBothDialog = false;
  489. this.getOrderInfo();
  490. this.orderPay();
  491. },
  492. PAY_TYPE_STR(ewPam) {
  493. this.orderPay(ewPam);
  494. },
  495. // 提交订单
  496. submitOrder() {
  497. let that = this;
  498. if (!this.hasAddress) {
  499. return this.$toast('请先选择收货地址');
  500. }
  501. if (!this.orderInfo.openId) {
  502. return uni.redirectTo({
  503. url: '/pages/login/index?isNotOpenid=' + true,
  504. });
  505. }
  506. if (this.exchangeCode && this.hasCoupon) {
  507. return (this.isBothDialog = true);
  508. }
  509. this.detail_ = true;
  510. },
  511. // 下单支付
  512. orderPay(ewPam = {}) {
  513. let that = this;
  514. this.$axios({
  515. url: '/order/buy',
  516. type: 'application/json',
  517. params: {
  518. ...ewPam,
  519. userId: this.userId,
  520. buyGoods: this.buyList,
  521. buyerMsg: this.remark,
  522. userAddressId: this.addressInfo.userAddressId,
  523. userCouponId: this.hasCoupon ? this.couponInfo.id : '',
  524. exchangeCode: this.exchangeCode,
  525. promotionGroupId: this.groupbuyId || '',
  526. goodsPackageId: this.packageId || '',
  527. // dispatchType: this.isServiceUser
  528. // ? this.dispatchType === 1
  529. // ? '自卖自装'
  530. // : '当地安装'
  531. // : '',
  532. },
  533. isLoading: 1,
  534. }).then((res) => {
  535. that.orderId = res.data.id;
  536. if (res.code === 1100) {
  537. this.detail_ = false;
  538. this.errorMsg = res.message;
  539. this.isErrorDialog = true;
  540. uni.hideLoading();
  541. setTimeout(() => {
  542. uni.showToast({
  543. title: res.message,
  544. icon: 'none'
  545. });
  546. }, 500)
  547. return false;
  548. }
  549. if (res.data.isPay === false) {
  550. this.detail_ = false;
  551. this.$successToast('购买成功');
  552. this.requestMessage();
  553. } else {
  554. if (ewPam.payType == '微信支付') {
  555. uni.getProvider({
  556. service: 'payment',
  557. success: (e) => {
  558. uni.requestPayment({
  559. provider: e.provider[0],
  560. orderInfo: res.data,
  561. timeStamp: res.data.timeStamp,
  562. nonceStr: res.data.nonceStr,
  563. package: res.data.payPackage,
  564. signType: 'MD5',
  565. paySign: res.data.paySign,
  566. success: (payRes) => {
  567. this.detail_ = false;
  568. that.$successToast('购买成功');
  569. that.requestMessage();
  570. uni.reLaunch({
  571. url: '/pages/mine/order/detail?orderId=' +
  572. that.orderId,
  573. });
  574. },
  575. fail: (err) => {
  576. this.detail_ = false;
  577. that.$toast('支付失败');
  578. uni.reLaunch({
  579. url: '/pages/mine/order/detail?orderId=' +
  580. that.orderId,
  581. });
  582. },
  583. });
  584. },
  585. });
  586. } else if (
  587. ewPam.payType == '云闪付' &&
  588. res?.data?.umsMiniRep?.miniPayRequest?.cqpMpAppId
  589. ) {
  590. uni.navigateToMiniProgram({
  591. appId: res.data?.umsMiniRep?.miniPayRequest?.cqpMpAppId,
  592. path: res.data?.umsMiniRep?.miniPayRequest?.cqpMpPath,
  593. success(res) {
  594. uni.onAppShow(({
  595. scene
  596. }) => {
  597. // if (scene == 1038) {
  598. // }
  599. this.detail_ = false;
  600. uni.reLaunch({
  601. url: '/pages/mine/order/detail?orderId=' + that
  602. .orderId,
  603. });
  604. uni.offAppShow();
  605. });
  606. },
  607. });
  608. }
  609. }
  610. });
  611. },
  612. // 消息推送
  613. requestMessage() {
  614. let that = this;
  615. uni.showModal({
  616. title: '温馨提示',
  617. content: '为更好的促进您与买家的交流,需要在您的订单成交时向您发送消息',
  618. confirmText: '同意',
  619. cancelText: '拒绝',
  620. success: function(res) {
  621. if (res.confirm) {
  622. let tmplIds = [that.configInfo.template];
  623. uni.requestSubscribeMessage({
  624. tmplIds: tmplIds,
  625. success(res) {
  626. let status = null;
  627. tmplIds.map((item, index) => {
  628. if (res[item] == 'accept') {
  629. status = 'accept';
  630. }
  631. });
  632. if (status == 'accept') {
  633. that.$successToast('订阅成功');
  634. } else {
  635. that.$toast('订阅取消');
  636. }
  637. setTimeout(() => {
  638. uni.reLaunch({
  639. url: '/pages/mine/order/list?tab=DFH' +
  640. '&orderId=' +
  641. that.orderId,
  642. });
  643. }, 1000);
  644. },
  645. fail(res) {
  646. console.log(res);
  647. that.$toast('订阅失败');
  648. setTimeout(() => {
  649. uni.reLaunch({
  650. url: '/pages/mine/order/list?tab=DFH' +
  651. '&orderId=' +
  652. that.orderId,
  653. });
  654. }, 1000);
  655. },
  656. });
  657. } else if (res.cancel) {
  658. uni.showModal({
  659. title: '温馨提示',
  660. content: '拒绝后您将无法获取实时的与卖家(买家)的交易消息',
  661. confirmText: '知道了',
  662. showCancel: false,
  663. success: function(res) {
  664. uni.reLaunch({
  665. url: '/pages/mine/order/list?tab=DFH' +
  666. '&orderId=' +
  667. that.orderId,
  668. });
  669. },
  670. });
  671. }
  672. },
  673. });
  674. },
  675. // 代客下单
  676. replaceOrder() {
  677. if (!this.hasAddress) {
  678. return this.$toast('请先选择收货地址');
  679. }
  680. this.$axios({
  681. url: '/order/buy',
  682. type: 'application/json',
  683. params: {
  684. userId: this.userId,
  685. buyGoods: this.buyList,
  686. buyerMsg: this.remark,
  687. userAddressId: this.addressInfo.userAddressId,
  688. userCouponId: this.hasCoupon ? this.couponInfo.id : '',
  689. exchangeCode: this.exchangeCode,
  690. proxyUser: true,
  691. // dispatchType: this.isServiceUser
  692. // ? this.dispatchType === 1
  693. // ? '自卖自装'
  694. // : '当地安装'
  695. // : '',
  696. },
  697. isLoading: 1,
  698. }).then((res) => {
  699. if (res.code === 1100) {
  700. this.errorMsg = res.message;
  701. this.isErrorDialog = true;
  702. uni.hideLoading();
  703. setTimeout(() => {
  704. uni.showToast({
  705. title: res.message,
  706. icon: 'none'
  707. });
  708. }, 500)
  709. return false;
  710. // return this.$toast(res.message);
  711. }
  712. this.codeUrl = res.data.codeUrl.replace(/[\r\n]/g, '');
  713. this.isCodeDialog = true;
  714. });
  715. },
  716. // 打开申请减免金额表单
  717. toApply(id) {
  718. this.isApplyDialog = true;
  719. },
  720. // 取消申请减免金额表单
  721. cancelApplyForm() {
  722. this.applyForm.amount = '';
  723. this.isApplyDialog = false;
  724. },
  725. // 提交申请减免金额表单
  726. confirmApplyForm() {
  727. if (!this.applyForm.amount) {
  728. return this.$toast('请填写优惠金额');
  729. }
  730. if (this.applyForm.amount > this.orderInfo.payAmount) {
  731. return this.$toast('优惠金额不能大于订单总金额');
  732. }
  733. this.$axios({
  734. url: '/promotion/apply/apply',
  735. method: 'post',
  736. type: 'application/json',
  737. params: {
  738. userId: this.userId,
  739. buyGoods: this.buyList,
  740. buyerMsg: this.remark,
  741. userAddressId: this.addressInfo.userAddressId,
  742. userCouponId: this.hasCoupon ? this.couponInfo.id : '',
  743. exchangeCode: this.exchangeCode,
  744. promotionGroupId: this.groupbuyId || '',
  745. goodsPackageId: this.packageId || '',
  746. applyAmount: this.applyForm.amount,
  747. applyRemark: this.applyForm.remark,
  748. },
  749. isLoading: 1,
  750. }).then((res) => {
  751. this.cancelApplyForm();
  752. this.$successToast('提交成功');
  753. setTimeout(() => {
  754. uni.redirectTo({
  755. url: '/pages/mine/discount/list',
  756. });
  757. }, 500);
  758. });
  759. },
  760. },
  761. };
  762. </script>
  763. <style lang="scss">
  764. .guobutishi {
  765. width: 65%;
  766. display: inline-block;
  767. height: 100%;
  768. z-index: 100;
  769. display: flex;
  770. border: 1px solid #fe781f;
  771. box-sizing: border-box;
  772. padding: 10rpx;
  773. border-radius: 10rpx;
  774. .guobutishi1 {
  775. font-size: 22rpx;
  776. border-radius: 10rpx;
  777. background: red;
  778. box-sizing: border-box;
  779. padding: 0 10rpx;
  780. color: #e5e5e5;
  781. margin-right: 10rpx;
  782. }
  783. .guobutishi2 {
  784. font-size: 24rpx;
  785. color: #fe781f;
  786. }
  787. }
  788. .app-container {
  789. background: #f4f2f2;
  790. padding: 20rpx 20rpx 160rpx;
  791. box-sizing: border-box;
  792. &.hasNoticebar {
  793. padding-top: 84rpx;
  794. }
  795. .noticebar {
  796. position: fixed;
  797. top: 0;
  798. left: 0;
  799. width: 100%;
  800. z-index: 100;
  801. }
  802. }
  803. .card {
  804. background: #ffffff;
  805. border-radius: 20rpx;
  806. margin-top: 20rpx;
  807. padding: 0 20rpx;
  808. }
  809. .address-container {
  810. background: #ffffff;
  811. border-radius: 20rpx;
  812. display: flex;
  813. justify-content: space-between;
  814. align-items: center;
  815. height: 150rpx;
  816. padding: 0 20rpx;
  817. .right {
  818. width: 16rpx;
  819. height: 28rpx;
  820. flex-shrink: 0;
  821. }
  822. .left {
  823. display: flex;
  824. align-items: center;
  825. margin-right: 20rpx;
  826. .icon {
  827. width: 52rpx;
  828. height: 52rpx;
  829. border-radius: 50%;
  830. background: linear-gradient(-90deg, #ff4042 0%, #fe781f 100%);
  831. display: flex;
  832. flex-shrink: 0;
  833. justify-content: center;
  834. align-items: center;
  835. margin-right: 20rpx;
  836. image {
  837. width: 28rpx;
  838. height: 36rpx;
  839. }
  840. }
  841. .nodata {
  842. font-size: 28rpx;
  843. color: #999999;
  844. }
  845. .hasdata {
  846. .name {
  847. font-size: 32rpx;
  848. color: #333333;
  849. text {
  850. color: #999999;
  851. font-size: 28rpx;
  852. margin-left: 16rpx;
  853. }
  854. }
  855. .address {
  856. font-size: 28rpx;
  857. color: #666666;
  858. line-height: 34rpx;
  859. margin-top: 10rpx;
  860. }
  861. }
  862. }
  863. }
  864. .goods-container {
  865. .title {
  866. font-size: 32rpx;
  867. color: #333333;
  868. line-height: 32rpx;
  869. padding-top: 20rpx;
  870. }
  871. .item {
  872. padding: 20rpx 0;
  873. display: flex;
  874. align-items: center;
  875. background: #ffffff;
  876. border-bottom: 1px solid #eaeaea;
  877. &:last-child {
  878. border: none;
  879. }
  880. image {
  881. width: 180rpx;
  882. height: 180rpx;
  883. display: block;
  884. margin-right: 20rpx;
  885. flex-shrink: 0;
  886. }
  887. .right {
  888. width: 470rpx;
  889. height: 190rpx;
  890. display: flex;
  891. justify-content: space-between;
  892. flex-direction: column;
  893. .name {
  894. font-size: 28rpx;
  895. color: #333333;
  896. line-height: 36rpx;
  897. height: 72rpx;
  898. }
  899. .des {
  900. font-size: 24rpx;
  901. color: #999999;
  902. line-height: 36rpx;
  903. }
  904. .bottom {
  905. display: flex;
  906. justify-content: space-between;
  907. align-items: center;
  908. .price {
  909. display: flex;
  910. flex-direction: column;
  911. }
  912. .price-1 {
  913. font-size: 32rpx;
  914. color: #ff3f42;
  915. line-height: 36rpx;
  916. }
  917. .price-2 {
  918. font-size: 26rpx;
  919. color: #666666;
  920. line-height: 30rpx;
  921. text-decoration: line-through;
  922. }
  923. }
  924. }
  925. }
  926. }
  927. .row-container {
  928. .item {
  929. display: flex;
  930. justify-content: space-between;
  931. align-items: center;
  932. min-height: 88rpx;
  933. border-bottom: 1px solid #eaeaea;
  934. &:last-child {
  935. border: none;
  936. }
  937. .title {
  938. font-size: 28rpx;
  939. color: #333333;
  940. }
  941. .coupon {
  942. display: flex;
  943. align-items: center;
  944. image {
  945. width: 16rpx;
  946. height: 28rpx;
  947. margin-left: 15rpx;
  948. }
  949. }
  950. .input {
  951. width: 500rpx;
  952. input {
  953. width: 500rpx;
  954. height: 88rpx;
  955. text-align: right;
  956. }
  957. }
  958. .radio-group {
  959. display: flex;
  960. height: 48rpx;
  961. align-items: center;
  962. .radio {
  963. display: flex;
  964. align-items: center;
  965. margin-left: 30rpx;
  966. .iconfont {
  967. font-size: 36rpx;
  968. color: #999999;
  969. margin-right: 10rpx;
  970. &.active {
  971. color: #ff3f42;
  972. }
  973. }
  974. }
  975. }
  976. .remark {
  977. width: 500rpx;
  978. textarea {
  979. width: 500rpx;
  980. padding: 20rpx 0;
  981. }
  982. }
  983. .orange {
  984. font-size: 28rpx;
  985. color: #fe781f;
  986. }
  987. }
  988. }
  989. .bottom-container {
  990. position: fixed;
  991. bottom: 0;
  992. left: 0;
  993. z-index: 99;
  994. width: 100%;
  995. box-sizing: border-box;
  996. background: #ffffff;
  997. padding: 0 20rpx;
  998. display: flex;
  999. justify-content: flex-end;
  1000. align-items: center;
  1001. height: 100rpx;
  1002. .left {
  1003. font-size: 28rpx;
  1004. color: #333333;
  1005. text {
  1006. color: #ff3f42;
  1007. }
  1008. }
  1009. .btn-group {
  1010. display: flex;
  1011. }
  1012. .button {
  1013. width: 190rpx;
  1014. height: 80rpx;
  1015. border-radius: 80rpx;
  1016. background: linear-gradient(-90deg, #ff3f42 0%, #fe781f 100%);
  1017. font-size: 28rpx;
  1018. color: #ffffff;
  1019. text-align: center;
  1020. line-height: 80rpx;
  1021. }
  1022. .button2 {
  1023. width: 190rpx;
  1024. height: 80rpx;
  1025. border-radius: 80rpx;
  1026. font-size: 28rpx;
  1027. color: #ff3f42;
  1028. text-align: center;
  1029. line-height: 80rpx;
  1030. margin-right: 10rpx;
  1031. border: 1px solid #ff3f42;
  1032. box-sizing: border-box;
  1033. }
  1034. .button3 {
  1035. width: 220rpx;
  1036. height: 80rpx;
  1037. border-radius: 80rpx;
  1038. font-size: 28rpx;
  1039. color: #ffffff;
  1040. text-align: center;
  1041. line-height: 80rpx;
  1042. margin-right: 10rpx;
  1043. border: 1px solid #ff3f42;
  1044. background: #ff3f42;
  1045. box-sizing: border-box;
  1046. }
  1047. }
  1048. .codeDialog {
  1049. position: fixed;
  1050. top: 40%;
  1051. left: 150rpx;
  1052. z-index: 999;
  1053. width: 400rpx;
  1054. background: #ffffff;
  1055. border-radius: 10rpx;
  1056. box-sizing: border-box;
  1057. padding: 20rpx 20rpx 40rpx;
  1058. display: flex;
  1059. flex-direction: column;
  1060. align-items: center;
  1061. .close {
  1062. width: 100%;
  1063. display: flex;
  1064. justify-content: flex-end;
  1065. image {
  1066. width: 32rpx;
  1067. height: 32rpx;
  1068. display: block;
  1069. }
  1070. }
  1071. .code {
  1072. margin-top: 10rpx;
  1073. image {
  1074. width: 280rpx;
  1075. height: 280rpx;
  1076. display: block;
  1077. }
  1078. }
  1079. .tips {
  1080. font-size: 28rpx;
  1081. color: #666666;
  1082. margin-top: 20rpx;
  1083. }
  1084. }
  1085. .apply-dialog {
  1086. position: fixed;
  1087. top: 0;
  1088. left: 0;
  1089. z-index: 9999;
  1090. width: 100%;
  1091. height: 100%;
  1092. background: rgba(0, 0, 0, 0.3);
  1093. display: flex;
  1094. align-items: center;
  1095. justify-content: center;
  1096. .dialog {
  1097. width: 600rpx;
  1098. background: #ffffff;
  1099. border-radius: 20rpx;
  1100. overflow: hidden;
  1101. .title {
  1102. font-size: 36rpx;
  1103. font-weight: 500;
  1104. text-align: center;
  1105. line-height: 100rpx;
  1106. padding-bottom: 10rpx;
  1107. }
  1108. .content {
  1109. padding: 0 40rpx 30rpx;
  1110. .row {
  1111. height: 50rpx;
  1112. display: flex;
  1113. align-items: center;
  1114. margin-bottom: 10rpx;
  1115. font-size: 28rpx;
  1116. color: #333333;
  1117. input {
  1118. flex: 1;
  1119. height: 50rpx;
  1120. border: 1px solid #e5e5e5;
  1121. margin-right: 16rpx;
  1122. padding: 0 12rpx;
  1123. font-size: 28rpx;
  1124. }
  1125. }
  1126. }
  1127. .btn {
  1128. border-top: 1px solid #eaeaea;
  1129. display: flex;
  1130. &>view {
  1131. flex: 1;
  1132. text-align: center;
  1133. line-height: 100rpx;
  1134. font-size: 32rpx;
  1135. &.left {
  1136. color: #666666;
  1137. }
  1138. &.right {
  1139. color: #ffffff;
  1140. background: #ff3f42;
  1141. }
  1142. }
  1143. }
  1144. }
  1145. }
  1146. </style>