create-order.vue 28 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883
  1. <template>
  2. <view class="container order clearfix" :style="{paddingBottom :isIphoneX ? '170rpx' : '134rpx'}">
  3. <!-- 地址选择 -->
  4. <choice-address ref="choiceAddress" v-if="isAddress" :addressData="addressData"></choice-address>
  5. <!-- 商品 -->
  6. <goods-list ref='goods' v-if="isRequest" :goodsData="goodsData" @handleGoodList="handChangeInputGoodsList"></goods-list>
  7. <!-- 发票信息 -->
  8. <invoice-tent ref="invoice"
  9. v-if="isRequest"
  10. :invoiceDatas="invoiceData"
  11. @handleChoiceaInvoice="handleChoiceaInvoiceData">
  12. </invoice-tent>
  13. <!-- 优惠券选择弹窗 -->
  14. <coupon ref="coupon"
  15. v-if="isCouponShow"
  16. :couponList="couponList"
  17. @handleChoiceaCoupon="handleChoiceaCouponData">
  18. </coupon>
  19. <!-- 兑换优惠券弹窗 -->
  20. <exchangeCoupon v-if="isExchangePopup"></exchangeCoupon>
  21. <!-- 运费 -->
  22. <freight ref="freight"
  23. v-if="isFreight"
  24. :freightData="freightData"
  25. @confirmFreight="hanldFreightFn"
  26. @confirmFreightBeans = "hanldFreightBeans"
  27. >
  28. </freight>
  29. <freight-alert v-if="isfreightTip" ref="csPhone"></freight-alert>
  30. <!-- 余额抵扣 -->
  31. <view class="invoice-balance" v-show="!rechargeGoods">
  32. <view class="balabce-t">
  33. <view class="balabce-t-le">余额抵扣</view>
  34. <view class="balabce-t-ri">
  35. <view class="money">
  36. <text>可用余额:</text>
  37. <text>¥{{userMoney | NumFormat}}</text>
  38. </view>
  39. <view class="checkbox-box">
  40. <button class="checkbox iconfont"
  41. hover-class="btn-hover"
  42. v-if="userMoney!=0"
  43. @click.stop="checkedBalabce"
  44. :class="[ischecked ?'icon-yixuanze':'icon-weixuanze']"
  45. >
  46. </button>
  47. </view>
  48. </view>
  49. </view>
  50. <view class="balabce-b" :class="{'balabce-b--hide':!ischecked}">
  51. <view class="balabce-b-text animation" :style="{'transform':ischecked?'translateY(0)':'translateY(-50%)','-webkit-transform':ischecked?'translateY(0)':'translateY(-50%)'}">
  52. <text>当前使用:¥{{deductMoney | NumFormat}},剩余:¥{{surplusMoney | NumFormat}}</text>
  53. </view>
  54. </view>
  55. </view>
  56. <!-- 底部 -->
  57. <view class="footer" :style="{paddingBottom :isIphoneX ? '68rpx' : '0rpx'}">
  58. <view class="footer-le">
  59. <view class="footer-count">
  60. <text>共{{allCount}}件商品</text>
  61. </view>
  62. <view class="footer-price">
  63. <view class="sum" :class="totalDiscountAmount == 0 ? 'none' : ''">
  64. 总价:<text class="price">¥{{payAllPrice | NumFormat}}</text>
  65. </view>
  66. <view class="sum-none" v-if="totalDiscountAmount > 0">
  67. <text class="money-reduced">共减<text>¥{{ totalDiscountAmount | NumFormat}}</text></text>
  68. </view>
  69. </view>
  70. </view>
  71. <view class="footer-submit" @click.stop="orderSubmitMit">
  72. <view class="btn" :class="isSubLoading ? 'disabled' : ''" >提交订单</view>
  73. </view>
  74. </view>
  75. <!-- 优惠券 -->
  76. <view class="coupon-content-model" v-if="isCouponModel">
  77. <view class="coupon-alert-content">
  78. <view class="coupon">
  79. <view class="coupon-list">
  80. <view class="list-cell-tags">{{ ExchangeCouponData.couponType | TypeFormat }}</text></view>
  81. <view class="list-cell-le">
  82. <view class="coupon-maxMoney">
  83. <text class="small">¥</text>
  84. {{ ExchangeCouponData.couponAmount }}
  85. </view>
  86. <view class="coupon-minMoney">
  87. <text class="txt">满{{ ExchangeCouponData.touchPrice }}可用</text>
  88. </view>
  89. </view>
  90. <view class="list-cell-ri">
  91. <view class="list-cell-top">
  92. <text v-if="ExchangeCouponData.couponType == 0">
  93. {{ ExchangeCouponData.productType && ExchangeCouponData.productType == 1 ? '全商城商品通用' : '仅可购买指定商品' }}
  94. </text>
  95. <text v-if="ExchangeCouponData.couponType == 1">
  96. {{ ExchangeCouponData.categoryType == 1 ? '仅限购买产品类商品' : '仅限购买仪器类商品' }}
  97. </text>
  98. <text v-if="ExchangeCouponData.couponType == 3">仅限购买店铺【{{ ExchangeCouponData.shopName }}】的商品</text>
  99. <text v-if="ExchangeCouponData.couponType == 4 || ExchangeCouponData.couponType == 2">全商城商品通用</text>
  100. </view>
  101. <view class="list-cell-time">{{ ExchangeCouponData.startDate }} - {{ ExchangeCouponData.endDate }}</view>
  102. </view>
  103. </view>
  104. <view class="coupon-btn" @click.stop="handleClickCancel">立即收下</view>
  105. </view>
  106. </view>
  107. </view>
  108. </view>
  109. </template>
  110. <script>
  111. import choiceAddress from '@/components/cm-module/creatOrder/choiceAddress'
  112. import goodsList from '@/components/cm-module/creatOrder/goodsList'
  113. import invoiceTent from '@/components/cm-module/creatOrder/invoiceTent'
  114. import coupon from '@/components/cm-module/creatOrder/coupon'
  115. import exchangeCoupon from '@/components/cm-module/creatOrder/exchangeCoupon'
  116. import freight from '@/components/cm-module/creatOrder/freight'
  117. import freightAlert from '@/components/cm-module/modelAlert/freightAlert'
  118. const defaultProductParam = {
  119. productCount:0,
  120. productId:0,
  121. source:2,
  122. userId:0
  123. };
  124. const defaultCartParam = {
  125. productIds:0,
  126. source:2,
  127. userId:0
  128. };
  129. const defaultPostageParam = {
  130. productIds:0,
  131. userId:0,
  132. townId:0
  133. };
  134. export default {
  135. components:{
  136. choiceAddress,
  137. goodsList,
  138. invoiceTent,
  139. coupon,
  140. exchangeCoupon,
  141. freight,
  142. freightAlert
  143. },
  144. data() {
  145. return {
  146. isIphoneX:this.$store.state.isIphoneX,
  147. isSubLoading:false,
  148. confirmType:1,
  149. orderID:0,
  150. cartParam: Object.assign({}, defaultCartParam), // 购物车立即结算确认订单参数
  151. productParam: Object.assign({}, defaultProductParam), // 商品立即购买确认订单参数
  152. postageParam: Object.assign({}, defaultPostageParam), // 邮费计算参数
  153. productIds:'', // 获取上一级页面商品信息
  154. classifyIDS:'', // 获取上一级页面商品分类
  155. clubId:'', // 用户ID
  156. submitState:'', // 提交状态
  157. balanceDeductionFlag:2, // 勾选余额的状态(1使用,2不使用)
  158. allCount:1, // 订单提交总数量
  159. reducedPrice:0, // 满减金额
  160. couponAmount:0, // 优惠券金额
  161. totalDiscountAmount:0, // 共减金额
  162. payAllPrice:0.00, // 订单提交总金额
  163. allPrice:0.00, // 订单总金额
  164. surplusMoney:0.00, // 显示勾选后的剩余抵扣
  165. userMoney:0.00, // 显示可使用余额
  166. deductMoney:0.00, // 显示已使用的余额
  167. addressId:'', // 地址ID
  168. isRequest:false, // 是否加载完成渲染子组件
  169. isFreight:false, // 是否加载完成渲染子组件
  170. isAddress:false, // 是否加载完成地址
  171. isExchangePopup:false, // 控制兑换优惠券弹窗
  172. isfreightTip:false, // 控制邮费弹窗
  173. ischecked:false, // 是否勾选余额
  174. hanldFreePostFlag:'', // 邮费状态
  175. hanldFreight:'', // 邮费
  176. addressData:{}, // 初始化地址信息
  177. goodsData:[], // 初始化商品信息
  178. couponList:[], // 初始化优惠券信息
  179. invoiceData:{type:0}, // 初始化发票信息
  180. freightData:{}, // 邮费数据
  181. orderInfo:[], // 提交的商品信息
  182. payInfo:{}, // 订单信息
  183. clubCouponId:0, // 用户关联优惠Id
  184. rechargeGoods:null, // 判断订单里有定金商品或者充值商品时,余额抵扣部分不显示
  185. freightBeansMoney:0, // 存储采美豆抵扣金额
  186. hanldUserBeans:0, // 抵扣的采美豆数
  187. isCouponShow:false, // 是否显示可选优惠券
  188. isCheckedBeans:false, // 是否抵扣采美豆
  189. isCouponModel:false, // 兑换优惠券成功提示
  190. ExchangeCouponData:{} // 兑换优惠券信息
  191. }
  192. },
  193. onLoad(option){//商品数据
  194. let data = JSON.parse(option.data);
  195. console.log('infodata',data)
  196. this.$api.getStorage().then((resolve) =>{
  197. this.productParam.userId = this.cartParam.userId = this.postageParam.userId = resolve.userId ? resolve.userId : 0
  198. this.clubId = resolve.clubId ? resolve.clubId : 0
  199. if(option.type =='prodcut'){
  200. this.confirmType = 1
  201. this.productParam.productCount = data.data.productCount
  202. this.productParam.productId = data.data.productIds
  203. this.productIds = this.postageParam.productIds = data.data.productIds
  204. this.getProductCreateOrderInfo()
  205. }else{
  206. this.confirmType = 2
  207. this.productIds = this.cartParam.productIds = this.postageParam.productIds = data.data.productIds
  208. this.CartCreateOrderInfo()
  209. }
  210. })
  211. },
  212. filters:{
  213. NumFormat(value) {//处理金额
  214. return Number(value).toFixed(2);
  215. },
  216. },
  217. methods: {
  218. getProductCreateOrderInfo(){// 商品立即购买确认订单数据初始化
  219. this.OrderService.ProductCreateOrderInfo(this.productParam).then(response =>{
  220. let data = response.data
  221. this.isRequest = true
  222. this.goodsData = data.list
  223. this.couponList = data.couponList
  224. this.userMoney = data.userMoney
  225. this.reducedPrice = data.reducedPrice
  226. this.allPrice = data.totalPrice
  227. this.rechargeGoods = data.rechargeGoods
  228. if(this.couponList.length>0){
  229. this.isCouponShow = true
  230. this.couponAmount = data.couponList[0].couponAmount
  231. this.clubCouponId = data.couponList[0].clubCouponId
  232. this.payAllPrice = this.allPrice - this.couponAmount
  233. }
  234. this.totalDiscountAmount = this.reducedPrice + this.couponAmount
  235. })
  236. .catch(error =>{
  237. this.$util.msg(error.msg,2000)
  238. })
  239. },
  240. CartCreateOrderInfo(){// 购物车去结算确认订单数据初始化
  241. this.OrderService.CartCreateOrderInfo(this.cartParam).then(response =>{
  242. let data = response.data
  243. this.isRequest = true
  244. this.goodsData = data.list
  245. this.couponList = data.couponList
  246. this.userMoney = data.userMoney
  247. this.reducedPrice = data.reducedPrice
  248. this.allPrice = data.totalPrice
  249. this.rechargeGoods = data.rechargeGoods
  250. if(this.couponList.length>0){
  251. this.isCouponShow = true
  252. this.couponAmount = data.couponList[0].couponAmount
  253. this.clubCouponId = data.couponList[0].clubCouponId
  254. this.payAllPrice = this.allPrice - this.couponAmount
  255. }
  256. this.totalDiscountAmount = this.reducedPrice + this.couponAmount
  257. })
  258. .catch(error =>{
  259. this.$util.msg(error.msg,2000)
  260. })
  261. },
  262. getFreightData(){// 获取邮费信息
  263. this.isFreight = false
  264. this.OrderService.GetOrderPostage(this.postageParam).then(response =>{
  265. this.isFreight = true
  266. this.isCheckedBeans = false
  267. this.freightData = response.data
  268. this.hanldFreePostFlag = response.data.postageFlag
  269. this.hanldFreight = response.data.freight
  270. if(this.hanldFreePostFlag == 1){
  271. if( this.freightData.userBeans > 0 ){
  272. this.freightBeansMoney = this.hanldFreight
  273. }else{
  274. this.freightBeansMoney = 0
  275. }
  276. this.payAllPrice = this.allPrice + response.data.freight
  277. this.attributePallPrice()
  278. this.hanldFreightBeans(this.isCheckedBeans)
  279. }else{
  280. if( this.freightData.userBeans > 0 ){
  281. this.freightBeansMoney = 30
  282. }else{
  283. this.freightBeansMoney = 0
  284. }
  285. this.payAllPrice = this.allPrice
  286. this.attributePallPrice()
  287. this.hanldFreightBeans(this.isCheckedBeans)
  288. }
  289. })
  290. },
  291. getAddressData(){//获取地址信息
  292. this.$api.getStorage().then((resolve) => {
  293. this.UserService.QueryAddressList({pageNum:1,pageSize:1,userId:resolve.userId}).then(response =>{
  294. let data = response.data
  295. this.isAddress = true
  296. this.addressData = {}
  297. if( data.list && data.list.length > 0 ){
  298. this.addressId = data.list[0].addressId;
  299. this.postageParam.townId = data.list[0].townId;
  300. this.addressData = data.list[0];
  301. this.getFreightData()
  302. }else{
  303. this.addressData = this.addressData;
  304. }
  305. })
  306. })
  307. },
  308. handChangeInputGoodsList(data){//对应供应商的留言信息
  309. this.goodsData = data;
  310. },
  311. handleChoiceaInvoiceData(data){//获取发票信息
  312. this.invoiceData = data
  313. },
  314. hanldFreightFn(data){//显示邮费弹窗
  315. console.log(data)
  316. switch(data.freePostFlag){
  317. case 1:
  318. this.hanldFreight = this.freightData.freight
  319. this.hanldFreePostFlag = data.freePostFlag
  320. this.freightBeansMoney = data.freightBeansMoney
  321. this.payAllPrice =this.allPrice + this.hanldFreight
  322. this.attributePallPrice()
  323. this.hanldFreightBeans(this.isCheckedBeans)
  324. break
  325. case -1:
  326. this.hanldFreight = 0
  327. this.hanldFreePostFlag = data.freePostFlag
  328. this.freightBeansMoney = data.freightBeansMoney
  329. this.payAllPrice = this.allPrice
  330. this.attributePallPrice()
  331. this.hanldFreightBeans(this.isCheckedBeans)
  332. break
  333. }
  334. },
  335. hanldFreightBeans(data){//是否勾选采美豆抵扣
  336. this.isCheckedBeans = data;
  337. if(this.isCheckedBeans){
  338. // 判断如果采美豆大于等于运费*100
  339. if( this.freightData.userBeans > 0 ){
  340. this.hanldUserBeans = this.freightBeansMoney*100
  341. }else{
  342. this.hanldUserBeans = 0
  343. }
  344. // 计算抵扣后的总价
  345. if(this.hanldFreePostFlag == 1){
  346. // 如果使用了余额 最终价格
  347. if(this.ischecked){
  348. let totalAmount = this.allPrice - this.couponAmount
  349. if(this.userMoney >= totalAmount){
  350. this.payAllPrice = 0.00
  351. this.deductMoney = this.allPrice - this.couponAmount // 当前使用金额等于订单金额
  352. this.surplusMoney = this.userMoney - this.deductMoney // 剩余金额等于余额-当前使用金额
  353. }else{
  354. this.payAllPrice = this.allPrice - this.userMoney - this.couponAmount // 订单最终支付金额等于订单金额-账户余额
  355. this.deductMoney = this.userMoney // 当前使用金额等于总余额
  356. this.surplusMoney = this.userMoney - this.deductMoney // 剩余余额等于总余额-当前使用金额
  357. }
  358. }else{
  359. this.payAllPrice = this.allPrice + this.hanldFreight - this.freightBeansMoney - this.couponAmount
  360. }
  361. console.log('抵扣',this.payAllPrice)
  362. }
  363. }else{// 采美豆不抵扣运费
  364. this.hanldUserBeans = 0
  365. // 不抵扣时计算总价
  366. if(this.hanldFreePostFlag == 1){
  367. this.attributeHashfreight(this.hanldFreight)
  368. }
  369. }
  370. },
  371. handleChoiceaCouponData(data){// 勾选使用优惠券
  372. console.log('优惠券信息',data)
  373. this.couponAmount = data.couponAmount
  374. this.totalDiscountAmount = this.reducedPrice + this.couponAmount;
  375. this.clubCouponId = data.clubCouponId
  376. this.attributePallPrice()
  377. this.hanldFreightBeans(this.isCheckedBeans)
  378. },
  379. checkedBalabce(){//勾选使用余额
  380. if(this.userMoney > 0){
  381. this.ischecked = !this.ischecked
  382. if(this.ischecked){
  383. this.balanceDeductionFlag =1
  384. this.attributePallPrice()
  385. }else{
  386. if(this.hanldFreePostFlag == 1 || this.hanldFreePostFlag == '1'){ //如果是有运费时
  387. if(this.isCheckedBeans){
  388. this.payAllPrice = this.allPrice - this.couponAmount
  389. }else{
  390. this.payAllPrice = this.allPrice+parseInt(this.freightData.freight) - this.couponAmount
  391. }
  392. }else{
  393. this.payAllPrice = this.allPrice - this.couponAmount
  394. }
  395. this.balanceDeductionFlag = 2
  396. }
  397. console.log('最终订单支付金额',this.payAllPrice)
  398. console.log('优惠券金额',this.couponAmount)
  399. }else{
  400. return
  401. }
  402. },
  403. attributePallPrice(){// 计算价格
  404. if(this.hanldFreePostFlag == 1 || this.hanldFreePostFlag == '1'){
  405. this.attributeHashfreight(this.freightData.freight)
  406. }else{
  407. this.attributeNofreight()
  408. }
  409. },
  410. attributeNofreight(){// 计算没有邮费的支付价格
  411. if(this.ischecked){
  412. let totalAmount = this.allPrice - this.couponAmount
  413. if(this.userMoney >= totalAmount){
  414. this.payAllPrice = 0.00
  415. this.deductMoney = this.allPrice - this.couponAmount // 当前使用金额等于订单金额
  416. this.surplusMoney = this.userMoney - this.deductMoney // 剩余金额等于余额-当前使用金额
  417. }else{
  418. this.payAllPrice = this.allPrice - this.userMoney - this.couponAmount // 订单最终支付金额等于订单金额-账户余额
  419. this.deductMoney = this.userMoney // 当前使用金额等于总余额
  420. this.surplusMoney = this.userMoney - this.deductMoney // 剩余余额等于总余额-当前使用金额
  421. }
  422. }else{
  423. this.payAllPrice = this.allPrice - this.couponAmount;
  424. this.deductMoney = 0.00; // 当前使用
  425. this.surplusMoney = this.userMoney; // 剩余余额
  426. }
  427. console.log('最终订单支付金额',this.payAllPrice)
  428. console.log('优惠券金额',this.couponAmount)
  429. },
  430. attributeHashfreight(freight){// 计算需要邮费的支付价格
  431. let totalAmount = this.allPrice + parseInt(freight) - this.couponAmount//计算不包邮的价格 总价等于商品价格+邮费
  432. if(this.ischecked){
  433. if(this.userMoney >= totalAmount){// 全部抵扣
  434. this.payAllPrice =0.00
  435. if(this.isCheckedBeans){// 抵扣运费了
  436. this.deductMoney = this.allPrice - this.couponAmount // 当前使用金额等于订单金额
  437. this.surplusMoney = this.userMoney - this.deductMoney // 剩余金额等于余额减去当前使用金额
  438. }else{
  439. this.deductMoney = this.allPrice + parseInt(freight)- this.couponAmount // 当前使用金额等于订单金额+运费金额
  440. this.surplusMoney = this.userMoney - this.deductMoney // 剩余余额等于总余额-当前使用金额
  441. }
  442. }else{// 部分抵扣
  443. if(this.isCheckedBeans){// 抵扣运费了
  444. this.payAllPrice = this.allPrice - this.userMoney - this.couponAmount // 订单最终支付金额等于总订单金额-账户余额-优惠券金额
  445. this.deductMoney = this.userMoney // 当前使用金额等于账户余额
  446. this.surplusMoney = this.userMoney - this.deductMoney // 剩余余额等于账户余额-当前使用金额
  447. }else{
  448. this.payAllPrice = this.allPrice + parseInt(freight) - this.userMoney - this.couponAmount//订单支付金额等于订单金额+运费-账户余额-优惠券
  449. this.deductMoney = this.userMoney // 当前使用金额等于账户余额
  450. this.surplusMoney = this.userMoney - this.deductMoney // 剩余余额等于账户余额-当前使用金额
  451. }
  452. }
  453. }else{
  454. this.payAllPrice = this.allPrice + parseInt(freight) - this.couponAmount
  455. this.deductMoney = 0.00 // 当前使用金额
  456. this.surplusMoney = this.userMoney // 剩余余额
  457. }
  458. console.log('最终订单支付金额',this.payAllPrice)
  459. console.log('优惠券金额',this.couponAmount)
  460. },
  461. orderSubmitMit(){// 提交订单
  462. if(this.isSubLoading){ return; }
  463. if(this.addressId == ''){
  464. this.$util.msg('请先添加收货地址~',2000)
  465. return
  466. }
  467. this.orderInfo = this.goodsData.map(el => {
  468. let productInfo = [];
  469. el.cartList.forEach(item => {
  470. productInfo.push({
  471. productId:item.productId,
  472. productNum:item.number,
  473. presentNum:0,
  474. productType:item.productType
  475. })
  476. })
  477. return {shopId:el.id,note:el.note?el.note:'',productInfo:productInfo}
  478. })
  479. //订单信息
  480. this.payInfo = {
  481. clauseId:0,//条款(暂时保留)
  482. orderShouldPayFee:this.payAllPrice.toFixed(2),//提交的总价
  483. balancePayFlag:this.balanceDeductionFlag,//余额抵扣的状态
  484. freight:parseInt(this.hanldFreight).toFixed(2),//邮费
  485. freePostFlag:parseInt(this.hanldFreePostFlag),//运费形式
  486. userBeans:this.hanldUserBeans
  487. }
  488. let param = {
  489. clubCouponId:this.clubCouponId,
  490. orderSource:6,
  491. clubUserId:this.userID,
  492. addressId:this.addressId,
  493. orderInfo:this.orderInfo,
  494. payInfo:this.payInfo, //订单信息
  495. orderInvoice:this.invoiceData
  496. }
  497. console.log(param)
  498. this.isSubLoading = true;
  499. this.OrderService.CreatedOrderSubmit({'params':JSON.stringify(param)}).then(response =>{
  500. const data = response.data;
  501. // 友盟埋点收集机构自主提交订单
  502. if(process.env.NODE_ENV != 'development'){
  503. this.$uma.trackEvent('Um_Event_ConfirmOrder', {
  504. Um_Key_PageName: '机构提交订单',
  505. Um_Key_SourcePage: '确认订单',
  506. Um_Key_OrderID:`${data.orderID}`
  507. })
  508. }
  509. if(data.code === '1'){
  510. this.submitState ='success'
  511. setTimeout(()=>{
  512. this.isSubLoading = false;
  513. },2000)
  514. let data = {orderID:response.data.orderID}
  515. this.$api.navigateTo(`/pages/user/order/success?data=${JSON.stringify({data:data})}`)
  516. }else{
  517. this.submitState ='confirm'
  518. this.$util.msg('订单提交成功',3000,true,'success')
  519. setTimeout(()=>{
  520. this.isSubLoading = false;
  521. },2000)
  522. setTimeout(()=>{
  523. this.$api.redirectTo(`/pages/user/order/order-payment?type=${this.submitState}&orderID=${response.data.orderID}`)
  524. },3000)
  525. }
  526. }).catch(error =>{
  527. this.$util.msg(error.msg,3000);
  528. })
  529. },
  530. handFreightAlertShow(){//显示邮费弹窗
  531. this.isfreightTip = true;
  532. },
  533. handleClickCancel(){// 关闭优惠券弹窗
  534. this.isCouponModel = false;
  535. if(this.confirmType == 1){
  536. }else{
  537. }
  538. this.getInitCrearOrder();
  539. },
  540. hideFreight(){//关闭邮费弹窗
  541. this.isfreightTip = false;
  542. },
  543. },
  544. onShow() {
  545. // this.addressID = ''
  546. let pages = getCurrentPages();
  547. let currPage = pages[pages.length-1];
  548. if(currPage.data.select =='select'){
  549. this.isAddress = true
  550. let SelectData = uni.getStorageSync('selectAddress');
  551. this.addressId = SelectData.addressId;
  552. this.postageParam.townId = SelectData.townId
  553. this.addressData = SelectData
  554. this.getFreightData()
  555. }else{
  556. this.getAddressData()
  557. }
  558. }
  559. }
  560. </script>
  561. <style lang="scss">
  562. page {
  563. height: auto;
  564. background:#F7F7F7;
  565. }
  566. .btn-hover{
  567. background: #FFFFFF;
  568. }
  569. .animation{
  570. /* transition: transform 0.3s ease;*/
  571. transition-property: transform;
  572. transition-duration: 0.3s;
  573. transition-timing-function: ease;
  574. }
  575. .order{
  576. padding-bottom: 134rpx;
  577. }
  578. .invoice-freight{
  579. width: 702rpx;
  580. padding: 0 24rpx;
  581. height: auto;
  582. font-size: $font-size-28;
  583. color: $text-color;
  584. background: #FFFFFF;
  585. float: left;
  586. font-weight: bold;
  587. }
  588. .invoice-balance{
  589. width: 702rpx;
  590. height: auto;
  591. padding:0 24rpx;
  592. background: #FFFFFF;
  593. float: left;
  594. margin-top: 24rpx;
  595. margin-bottom: 24rpx;
  596. .balabce-t{
  597. width: 100%;
  598. height: 86rpx;
  599. line-height: 86rpx;
  600. font-size: $font-size-28;
  601. color: $text-color;
  602. float: left;
  603. .balabce-t-le{
  604. float: left;
  605. font-weight: bold;
  606. }
  607. .balabce-t-ri{
  608. float: right;
  609. display: flex;
  610. align-items: center;
  611. .money{
  612. display: flex;
  613. float: left;
  614. }
  615. .checkbox-box{
  616. display: flex;
  617. width: 60rpx;
  618. float: left;
  619. height: 100%;
  620. font-size: $font-size-24;
  621. .checkbox{
  622. width: 40rpx;
  623. text-align: right;
  624. box-sizing: border-box;
  625. text-align: center;
  626. text-decoration: none;
  627. border-radius: 0;
  628. -webkit-tap-highlight-color: transparent;
  629. overflow: hidden;
  630. color: $color-system;
  631. }
  632. }
  633. }
  634. }
  635. .balabce-b{
  636. width: 100%;
  637. float: left;
  638. overflow: hidden;
  639. .balabce-b-text{
  640. width: 100%;
  641. line-height: 58rpx;
  642. font-size: $font-size-24;
  643. color: #FF2A2A;
  644. text-align: right;
  645. float: right;
  646. }
  647. &.balabce-b--hide {
  648. padding: 0 0;
  649. height: 0px;
  650. line-height: 0px;
  651. }
  652. }
  653. }
  654. .footer{
  655. position: fixed;
  656. left: 0;
  657. bottom: 0;
  658. display: flex;
  659. align-items: center;
  660. width: 100%;
  661. height: 110rpx;
  662. line-height: 110rpx;
  663. justify-content: space-between;
  664. font-size: $font-size-28;
  665. background-color: #FFFFFF;
  666. z-index: 990;
  667. color: $text-color;
  668. .footer-le{
  669. width:570rpx;
  670. height:100%;
  671. float: left;
  672. }
  673. .footer-count{
  674. float: left;
  675. padding-left: 24rpx;
  676. width:180rpx;
  677. box-sizing: border-box;
  678. }
  679. .footer-price{
  680. width:370rpx;
  681. float: right;
  682. text-align: right;
  683. color: $text-color;
  684. padding: 10rpx 20rpx 10rpx 0;
  685. box-sizing: border-box;
  686. .sum-none{
  687. width: 100%;
  688. height: 45rpx;
  689. line-height: 45rpx;
  690. color: $text-color;
  691. float: left;
  692. text-align: right;
  693. .money{
  694. font-size: $font-size-26;
  695. color: #999999;
  696. text-decoration: line-through;
  697. }
  698. .money-sign{
  699. font-size: $font-size-26;
  700. color: #999999;
  701. text-decoration: line-through;
  702. }
  703. .money-reduced{
  704. margin-left: 10rpx;
  705. font-size: $font-size-26;
  706. color:#FF2A2A;
  707. }
  708. }
  709. .sum{
  710. width: 100%;
  711. height: 45rpx;
  712. line-height: 45rpx;
  713. float: left;
  714. &.none{
  715. height: 90rpx;
  716. line-height: 90rpx;
  717. }
  718. .price{
  719. font-size: $font-size-32;
  720. color: #FF2A2A;
  721. }
  722. }
  723. }
  724. .footer-submit{
  725. display:flex;
  726. align-items:center;
  727. justify-content: center;
  728. width: 180rpx;
  729. height: 100%;
  730. box-sizing: border-box;
  731. padding: 15rpx 5rpx;
  732. .btn{
  733. width: 100%;
  734. height: 100%;
  735. color: #FFFFFF;
  736. background:linear-gradient(135deg,rgba(242,143,49,1) 0%,rgba(225,86,22,1) 100%);
  737. font-size: $font-size-26;
  738. text-align: center;
  739. line-height: 80rpx;
  740. border-radius: 40rpx;
  741. &.disabled{
  742. background: #e4e8eb;
  743. color: #999999;
  744. }
  745. }
  746. }
  747. }
  748. .coupon-content-model{
  749. width: 100%;
  750. height: 100%;
  751. background: rgba(0,0,0,.5);
  752. position: fixed;
  753. top: 0;
  754. left: 0;
  755. z-index: 8888;
  756. transition: all 0.4s;
  757. .coupon-alert-content{
  758. width: 600rpx;
  759. height: 612rpx;
  760. position: absolute;
  761. top: 0;
  762. left: 0;
  763. bottom: 0;
  764. right: 0;
  765. margin: auto;
  766. box-sizing: border-box;
  767. padding-top: 92rpx;
  768. .coupon{
  769. width: 600rpx;
  770. height: 522rpx;
  771. background: url(https://static.caimei365.com/app/img/icon/icon-coupon-alertbg@2x.png);
  772. background-size: cover;
  773. box-sizing: border-box;
  774. padding: 230rpx 40rpx 0 40rpx;
  775. .coupon-list{
  776. width: 100%;
  777. height: 147rpx;
  778. margin-bottom: 32rpx;
  779. box-sizing: border-box;
  780. background: url(https://static.caimei365.com/app/img/icon/icon-coupon-bg@2x.png);
  781. background-size: cover;
  782. position: relative;
  783. .list-cell-tags{
  784. display: inline-block;
  785. padding: 0 10rpx;
  786. height: 32rpx;
  787. line-height: 32rpx;
  788. background-color: #f94b4b;
  789. color: #FFFFFF;
  790. font-size: 18rpx;
  791. border-radius: 16rpx 0 16rpx 0;
  792. text-align: center;
  793. position: absolute;
  794. top: 0;
  795. left: 0;
  796. }
  797. .list-cell-le{
  798. width: 154rpx;
  799. height: 100%;
  800. box-sizing: border-box;
  801. padding: 30rpx 0;
  802. float: left;
  803. .coupon-maxMoney{
  804. width: 100%;
  805. height: 54rpx;
  806. line-height: 54rpx;
  807. font-size: 42rpx;
  808. color: #f94b4b;
  809. text-align: center;
  810. margin-top: 10rpx;
  811. .small{
  812. font-size: $font-size-20;
  813. }
  814. }
  815. .coupon-minMoney{
  816. width: 100%;
  817. height: 28rpx;
  818. float: left;
  819. box-sizing: border-box;
  820. padding-left: 24rpx;
  821. .txt{
  822. display: block;
  823. height: 28rpx;
  824. line-height: 28rpx;
  825. font-size: 16rpx;
  826. color: #f94b4b;
  827. text-align: center;
  828. padding: 0 5rpx;
  829. background-color: #fff1eb;
  830. border-radius: 4rpx;
  831. float: left;
  832. }
  833. }
  834. }
  835. .list-cell-ri{
  836. width: 366rpx;
  837. height: 100%;
  838. box-sizing: border-box;
  839. padding:30rpx 20rpx;
  840. float: left;
  841. .list-cell-top{
  842. width: 100%;
  843. height: 64rpx;
  844. line-height: 64rpx;
  845. font-size: $font-size-26;
  846. color: #333333;
  847. float: left;
  848. text-overflow:ellipsis;
  849. display: -webkit-box;
  850. word-break: break-all;
  851. -webkit-box-orient: vertical;
  852. -webkit-line-clamp: 1;
  853. overflow: hidden;
  854. }
  855. .list-cell-time{
  856. width: 100%;
  857. height: 28rpx;
  858. line-height: 28rpx;
  859. text-align: left;
  860. font-size: $font-size-20;
  861. color: #999999;
  862. }
  863. }
  864. }
  865. .coupon-btn{
  866. width: 100%;
  867. height: 78rpx;
  868. background: url(https://static.caimei365.com/app/img/icon/icon-coupon-alertbtnbg@2x.png);
  869. background-size: cover;
  870. line-height: 78rpx;
  871. text-align: center;
  872. color: #FFFFFF;
  873. font-size: $font-size-36;
  874. }
  875. }
  876. }
  877. }
  878. </style>