create-order.vue 31 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131
  1. <template>
  2. <view class="container order clearfix" :style="{ paddingBottom: isIphoneX ? '190rpx' : '134rpx' }">
  3. <!-- 地址选择 -->
  4. <cm-address-temp ref="choiceAddress" v-if="isAddress" :addressData="addressData" />
  5. <!-- 商品 -->
  6. <cm-goods-temp
  7. ref="goods"
  8. v-if="isRequest"
  9. :secondflag="secondflag"
  10. :list="goodsData"
  11. @handleGoodList="handChangeInputGoodsList"
  12. />
  13. <!-- 返佣订单 -->
  14. <view class="order-return" v-if="goodsData.length == 1 && secondflag">
  15. <view class="order-return-main" @click="handleRebateFlag">
  16. <view class="label">是否返佣</view>
  17. <view class="label-right">
  18. <text class="text-l">{{ rebateFeeText }}</text> <text class="iconfont icon-xiayibu"></text>
  19. </view>
  20. </view>
  21. <view class="order-return-input" v-if="confirmParam.payInfo.rebateFlag === 2">
  22. <input class="input" v-model="rebateFee" type="number" placeholder="请输入返佣服务费" maxlength="20" />
  23. </view>
  24. </view>
  25. <!-- 返佣订单 -->
  26. <view class="Rebate" @click="handleSecondFlag" v-if="!secondflag">
  27. <text class="rebate-title">二手返佣订单</text>
  28. <text class="iconfont" :class="rebatecheck ? 'icon-yixuanze' : 'icon-weixuanze'"></text>
  29. </view>
  30. <!-- 发票信息 -->
  31. <cm-invice-popup
  32. ref="invoice"
  33. v-if="isRequest"
  34. :invoiceDatas="invoiceData"
  35. @handleChoiceaInvoice="handleChoiceaInvoiceData"
  36. />
  37. <!-- 优惠券选择弹窗 -->
  38. <cm-coupon-popup
  39. ref="coupon"
  40. v-if="isCouponShow"
  41. :couponList="couponList"
  42. @handleChoiceaCoupon="handleChoiceaCouponData"
  43. />
  44. <!-- 兑换优惠券弹窗 -->
  45. <cm-coupon-chang v-if="isExchangePopup" />
  46. <!-- 运费 -->
  47. <cm-freight-popup
  48. ref="freight"
  49. v-if="isFreight"
  50. :freightDatas="freightData"
  51. @handleChoiceaFreight="handleChoiceaFreightData"
  52. @showFreightAlert="handFreightAlertShow"
  53. />
  54. <!-- 余额抵扣 -->
  55. <view class="invoice-balance" v-if="!rechargeGoods">
  56. <view class="balabce-t">
  57. <view class="balabce-t-le">余额抵扣</view>
  58. <view class="balabce-t-ri">
  59. <view class="money">
  60. <text>可用余额:</text> <text>¥{{ userMoney | NumFormat }}</text>
  61. </view>
  62. <view class="checkbox-box">
  63. <button
  64. class="checkbox iconfont"
  65. hover-class="btn-hover"
  66. v-if="userMoney != 0"
  67. @click.stop="checkedBalabce"
  68. :class="[ischecked ? 'icon-yixuanze' : 'icon-weixuanze']"
  69. ></button>
  70. </view>
  71. </view>
  72. </view>
  73. <view class="balabce-b" :class="{ 'balabce-b--hide': !ischecked }">
  74. <view
  75. class="balabce-b-text animation"
  76. :style="{
  77. transform: ischecked ? 'translateY(0)' : 'translateY(-50%)',
  78. '-webkit-transform': ischecked ? 'translateY(0)' : 'translateY(-50%)'
  79. }"
  80. >
  81. <text>当前使用:¥{{ deductMoney | NumFormat }},剩余:¥{{ surplusMoney | NumFormat }}</text>
  82. </view>
  83. </view>
  84. </view>
  85. <!-- 选择对机构是否可见 -->
  86. <cm-club-visible ref="clubVisible" v-if="isRequest" @handleClubVisible="handleClubVisibleData" />
  87. <!-- 售后条例 -->
  88. <cm-regula-popup
  89. ref="regulations"
  90. v-if="isRequest && seconDepositFlg"
  91. :regulaDatas="clauseList"
  92. @handleData="handleClauseData"
  93. />
  94. <!-- 底部 -->
  95. <view class="footer" :style="{ paddingBottom: isIphoneX ? '68rpx' : '0rpx' }">
  96. <view class="footer-le">
  97. <view class="footer-count">
  98. <text>共{{ totalCount }}件商品</text>
  99. </view>
  100. <view class="footer-price">
  101. <view class="sum" :class="totalDiscountAmount == 0 ? 'none' : ''">
  102. 总价:<text class="price">¥{{ orderShouldPayFee | NumFormat }}</text>
  103. </view>
  104. <view class="sum-none" v-if="totalDiscountAmount > 0">
  105. <text class="money-reduced"
  106. >共减<text>¥{{ totalDiscountAmount | NumFormat }}</text></text
  107. >
  108. </view>
  109. </view>
  110. </view>
  111. <view class="footer-submit" @click.stop="orderSubmitMit">
  112. <view class="btn" :class="isSubLoading ? 'disabled' : ''">提交订单</view>
  113. </view>
  114. </view>
  115. <!-- 弹窗提示 -->
  116. <tui-modal
  117. :show="modal"
  118. @click="handleClick"
  119. @cancel="hideMobel"
  120. :content="contentModalText"
  121. :button="modalButton"
  122. color="#333"
  123. :size="32"
  124. shape="circle"
  125. :maskClosable="false"
  126. >
  127. </tui-modal>
  128. </view>
  129. </template>
  130. <script>
  131. import cmAddressTemp from './components/cm-address-temp'
  132. import cmGoodsTemp from './components/cm-goods-temp'
  133. import cmInvicePopup from './components/cm-invice-popup'
  134. import cmFreightPopup from './components/cm-freight-popup'
  135. import cmCouponPopup from './components/cm-coupon-popup'
  136. import cmCouponChang from './components/cm-coupon-chang'
  137. import cmClubVisible from './components/cm-club-visible'
  138. import cmRegulaPopup from './components/cm-regula-popup'
  139. import cmCouponTips from './components/cm-coupon-tips'
  140. export default {
  141. components: {
  142. cmAddressTemp,
  143. cmGoodsTemp,
  144. cmInvicePopup,
  145. cmFreightPopup,
  146. cmCouponPopup,
  147. cmCouponChang,
  148. cmClubVisible,
  149. cmRegulaPopup,
  150. cmCouponTips
  151. },
  152. data() {
  153. return {
  154. isSubLoading: false,
  155. modalButton: [
  156. {
  157. text: '再想一想',
  158. type: 'gray',
  159. plain: true //是否空心
  160. },
  161. {
  162. text: '继续提交',
  163. customStyle: {
  164. color: '#fff',
  165. bgColor: 'linear-gradient(90deg, #F28F31 0%, #FF5B00 100%)'
  166. },
  167. plain: false
  168. }
  169. ],
  170. contentModalText: '', //操作文字提示语句
  171. modal: false,
  172. showModalstauts: 1,
  173. isIphoneX: this.$store.state.isIphoneX,
  174. cartParam: {
  175. // 购物车立即结算确认订单参数
  176. skuIds: 0, // 商品Id(逗号隔开)
  177. serviceProviderId: 0, // 协销Id
  178. clubId: 0 // 机构Id
  179. },
  180. productParam: {
  181. // 商品立即购买确认订单参数
  182. productCount: 0, // 商品数量
  183. productId: 0, // 商品Id
  184. serviceProviderId: 0, // 协销Id
  185. clubId: 0 // 机构Id
  186. },
  187. postageParam: {
  188. // 邮费计算参数
  189. skuIds: 0, // 商品Id(逗号隔开)
  190. userId: 0, // 用户Id
  191. townId: 0 // 地区Id
  192. },
  193. confirmParam: {
  194. // 提交订单参数
  195. cartType: 3, // 购买类型:(1自主下单, 3协销下单)
  196. orderMiniType: 0, // 订单提交状态 0初始提交 1 继续提交
  197. orderSource: 6, // 订单来源 1WWW 6小程序[采美,星范]
  198. addressId: 0, // 收货地址Id
  199. clubCouponId: 0, // 关联优惠券Id
  200. clubId: 0, // 机构Id
  201. orderInfo: [], // 订单商品数据
  202. orderInvoice: { type: 0 }, // 订单发票信息
  203. orderSeen: 1, // 订单对机构可见度 1可见 2不可见
  204. payInfo: {
  205. // 订单金额数据
  206. isColdChina: 0, //是否勾选冷链费
  207. orderShouldPayFee: 0, // 订单最终支付金额
  208. balancePayFlag: 0, // 勾选余额的状态(1使用,0不使用)
  209. clauseId: 0, // 条款Id
  210. postage: 0, // 运费金额
  211. postageFlag: 0, // 运费类型
  212. userBeans: 0, // 抵扣采美豆数量
  213. rebateFee: 0, // 返佣服务费
  214. rebateFlag: 0 // 是否返佣订单
  215. },
  216. unionId: uni.getStorageSync('unionId') // 用户unionId
  217. },
  218. rebateFee: '',
  219. rebateFeeText: '否',
  220. confirmType: 1,
  221. submitState: '', // 提交状态
  222. totalCount: 0, // 订单提交总数量
  223. reducedPrice: 0, // 满减金额
  224. couponAmount: 0, // 优惠券金额
  225. totalDiscountAmount: 0, // 共减金额
  226. orderShouldPayFee: 0.0, // 订单提交总金额
  227. allPrice: 0.0, // 订单总金额
  228. surplusMoney: 0.0, // 显示勾选后的剩余抵扣
  229. userMoney: 0.0, // 显示可使用余额
  230. deductMoney: 0.0, // 显示已使用的余额
  231. isRequest: false, // 是否加载完成渲染子组件
  232. isFreight: false, // 是否加载完成渲染子组件
  233. isAddress: false, // 是否加载完成地址
  234. isExchangePopup: false, // 控制兑换优惠券弹窗
  235. isfreightTip: false, // 控制邮费弹窗
  236. ischecked: false, // 是否勾选余额
  237. addressData: {}, // 初始化地址信息
  238. goodsData: [], // 初始化商品信息
  239. couponList: [], // 初始化优惠券信息
  240. invoiceData: { type: 0 }, // 初始化发票信息
  241. freightData: {}, // 邮费数据
  242. handleFreightData: {}, // 监听邮费数据
  243. orderInfo: [], // 提交的商品信息
  244. payInfo: {}, // 订单信息
  245. rechargeGoods: false,
  246. clauseList: [],
  247. seconDepositFlg: true,
  248. rebatecheck: false,
  249. isCouponShow: false, // 是否显示可选优惠券
  250. secondflag: true,
  251. isCouponModel: false, // 兑换优惠券成功提示
  252. ExchangeCouponData: {} // 兑换优惠券信息
  253. }
  254. },
  255. onLoad(option) {
  256. //商品数据
  257. this.initStorage(option)
  258. },
  259. filters: {
  260. NumFormat(value) {
  261. //处理金额
  262. return Number(value).toFixed(2)
  263. }
  264. },
  265. methods: {
  266. async initStorage(option) {
  267. const data = JSON.parse(option.data)
  268. const clubInfo = await this.$api.getComStorage('orderUserInfo')
  269. const userInfo = await this.$api.getStorage()
  270. this.productParam.clubId = this.cartParam.clubId = this.confirmParam.clubId = clubInfo.clubId
  271. this.postageParam.userId = clubInfo.userId
  272. this.productParam.serviceProviderId = userInfo.serviceProviderId
  273. this.cartParam.serviceProviderId = userInfo.serviceProviderId
  274. this.confirmParam.serviceProviderId = userInfo.serviceProviderId
  275. if (option.type == 'prodcut') {
  276. this.confirmType = 1
  277. this.productParam.productCount = data.data.productCount
  278. this.productParam.productId = data.data.productIds
  279. this.getInitProdcutCrearOrder()
  280. } else {
  281. this.confirmType = 2
  282. this.cartParam.skuIds = data.data.skuIds
  283. this.getInitCrearOrder()
  284. }
  285. },
  286. //协销购物车跳转确认订单初始化信息
  287. async getInitCrearOrder() {
  288. try{
  289. const res = await this.SellerService.SellerSettlement(this.cartParam)
  290. const data = res.data
  291. this.goodsData = data.list
  292. this.userMoney = data.userMoney
  293. this.couponList = data.couponList
  294. this.reducedPrice = data.reducedPrice
  295. this.totalCount = data.totalCount
  296. this.allPrice = data.totalPrice
  297. this.rechargeGoods = data.includeRecharge
  298. this.clauseList = data.clauseList
  299. this.postageParam.skuIds = this.getProductIds(data.list)
  300. this.isCouponShow = true
  301. if (this.couponList.length > 0) {
  302. this.couponAmount = data.couponList[0].couponAmount
  303. this.confirmParam.clubCouponId = data.couponList[0].clubCouponId
  304. }
  305. this.orderShouldPayFee = this.allPrice - this.couponAmount
  306. this.totalDiscountAmount = this.reducedPrice + this.couponAmount
  307. this.isRequest = true
  308. this.getAddressData()
  309. }catch(error){
  310. console.log('获取订单信息异常')
  311. }
  312. },
  313. //二手下单初始化查询
  314. async getInitProdcutCrearOrder() {
  315. try{
  316. this.seconDepositFlg = false
  317. const res = await this.SellerService.GetSettlementBySencondProduct(this.productParam)
  318. const data = res.data
  319. this.goodsData = data.list
  320. this.userMoney = data.userMoney
  321. this.totalCount = data.totalCount
  322. this.allPrice = data.totalPrice
  323. this.orderShouldPayFee = this.allPrice
  324. this.isCouponShow = false
  325. this.secondflag = false
  326. this.isRequest = true
  327. this.getAddressData()
  328. }catch(error){
  329. console.log('获取订单信息异常')
  330. }
  331. },
  332. // 获取订单商品id列表
  333. getProductIds(list) {
  334. let skuId = []
  335. list.forEach(function(supplier) {
  336. supplier.cartList.forEach(function(product) {
  337. skuId.push(product.skuId)
  338. })
  339. })
  340. return skuId.join(',')
  341. },
  342. //获取邮费信息
  343. async getFreightData() {
  344. try{
  345. const res = await this.OrderService.GetOrderPostage(this.postageParam)
  346. const data = res.data
  347. this.freightData = data
  348. this.handleFreightData = data
  349. this.isFreight = true
  350. if (data.postageFlag == 1) {
  351. this.orderShouldPayFee = this.allPrice + data.postage
  352. this.attributePallPrice()
  353. } else {
  354. this.orderShouldPayFee = this.allPrice
  355. this.attributePallPrice()
  356. }
  357. }catch(error){
  358. console.log('获取运费信息异常')
  359. }
  360. },
  361. async getAddressData() {
  362. //获取地址信息
  363. const clubInfo = await this.$api.getComStorage('orderUserInfo')
  364. this.UserService.QueryAddressList({
  365. pageNum: 1,
  366. pageSize: 1,
  367. userId: clubInfo.userId
  368. }).then(response => {
  369. let data = response.data
  370. this.isAddress = true
  371. this.addressData = {}
  372. if (response.data.results != '') {
  373. this.confirmParam.addressId = data.list[0].addressId
  374. this.postageParam.townId = data.list[0].townId
  375. this.addressData = data.list[0]
  376. this.getFreightData()
  377. } else {
  378. this.addressData = this.addressData
  379. }
  380. })
  381. },
  382. handChangeInputGoodsList(data) {
  383. //对应供应商的留言信息
  384. this.goodsData = data
  385. },
  386. handleChoiceaInvoiceData(data) {
  387. //获取发票信息
  388. this.confirmParam.orderInvoice = data
  389. },
  390. handleChoiceaFreightData(data) {
  391. //获取运费信息
  392. console.log('编辑运费信息', data)
  393. if (data.postageFlag == 1) {
  394. this.handleFreightData = data
  395. this.orderShouldPayFee = this.allPrice + parseInt(data.postage)
  396. this.attributePallPrice()
  397. } else {
  398. this.handleFreightData = data
  399. this.orderShouldPayFee = this.allPrice
  400. this.attributePallPrice()
  401. }
  402. },
  403. handleClauseData(clauseId) {
  404. // 条款Id
  405. this.confirmParam.payInfo.clauseId = parseInt(clauseId)
  406. },
  407. handleChoiceaCouponData(data) {
  408. // 勾选使用优惠券
  409. console.log('优惠券信息', data)
  410. this.couponAmount = data.couponAmount
  411. this.totalDiscountAmount = this.reducedPrice + this.couponAmount
  412. this.confirmParam.clubCouponId = data.clubCouponId
  413. this.attributePallPrice()
  414. },
  415. handleClubVisibleData(data) {
  416. // 订单对机构是否可见
  417. console.log('对机构是否可见', data)
  418. this.confirmParam.orderSeen = Number(data)
  419. },
  420. checkedBalabce() {
  421. //勾选使用余额
  422. if (this.rebatecheck) {
  423. this.$util.msg('返佣订单不能使用余额抵扣', 2000)
  424. } else {
  425. if (this.userMoney > 0) {
  426. this.ischecked = !this.ischecked
  427. if (this.ischecked) {
  428. this.confirmParam.payInfo.balancePayFlag = 1
  429. this.attributePallPrice()
  430. } else {
  431. this.confirmParam.payInfo.balancePayFlag = 0
  432. if (this.handleFreightData.postageFlag == 1) {
  433. this.orderShouldPayFee =
  434. this.allPrice + parseInt(this.handleFreightData.postage) - this.couponAmount
  435. } else {
  436. this.orderShouldPayFee = this.allPrice - this.couponAmount
  437. }
  438. }
  439. console.log('最终订单支付金额', this.orderShouldPayFee)
  440. console.log('优惠券金额', this.couponAmount)
  441. } else {
  442. return
  443. }
  444. }
  445. },
  446. attributePallPrice() {
  447. //计算价格
  448. if (this.handleFreightData.postageFlag == 1) {
  449. this.attributeHashfreight(this.handleFreightData.postage)
  450. } else {
  451. this.attributeNofreight()
  452. }
  453. },
  454. attributeNofreight() {
  455. //计算没有邮费的支付价格
  456. if (this.ischecked) {
  457. let totalAmount = this.allPrice - this.couponAmount //计算不包邮的价格 总价等于商品价格+邮费
  458. if (this.userMoney > totalAmount) {
  459. this.orderShouldPayFee = 0.0
  460. this.deductMoney = this.allPrice - this.couponAmount // 勾选后使用抵余额
  461. this.surplusMoney = this.userMoney - this.deductMoney // 勾选后的剩余抵扣
  462. } else {
  463. this.orderShouldPayFee = this.allPrice - this.userMoney - this.couponAmount //勾选后的总价
  464. this.deductMoney = this.userMoney // 勾选后使用抵余额
  465. this.surplusMoney = this.userMoney - this.deductMoney // 勾选后的剩余抵扣
  466. }
  467. } else {
  468. this.orderShouldPayFee = this.allPrice - this.couponAmount
  469. this.deductMoney = 0.0
  470. this.surplusMoney = this.userMoney
  471. }
  472. console.log('最终订单支付金额', this.orderShouldPayFee)
  473. console.log('优惠券金额', this.couponAmount)
  474. },
  475. attributeHashfreight(postage) {
  476. //计算需要邮费的支付价格
  477. let totalAmount = this.allPrice + parseInt(postage) - this.couponAmount //计算不包邮的价格 总价等于商品价格+邮费
  478. if (this.ischecked) {
  479. if (this.userMoney > totalAmount) {
  480. //余额大于支付金额
  481. this.orderShouldPayFee = 0.0
  482. this.deductMoney = this.allPrice + parseInt(postage) - this.couponAmount //勾选后使用抵余额
  483. this.surplusMoney = this.userMoney - this.deductMoney //勾选后的剩余抵扣
  484. } else {
  485. this.orderShouldPayFee = this.allPrice + parseInt(postage) - this.userMoney - this.couponAmount //勾选后的总价
  486. this.deductMoney = this.userMoney //勾选后使用抵余额
  487. this.surplusMoney = this.userMoney - this.deductMoney //勾选后的剩余抵扣
  488. }
  489. } else {
  490. this.orderShouldPayFee = this.allPrice + parseInt(postage) - this.couponAmount
  491. this.deductMoney = 0.0
  492. this.surplusMoney = this.userMoney
  493. }
  494. console.log('最终订单支付金额', this.orderShouldPayFee)
  495. console.log('优惠券金额', this.couponAmount)
  496. },
  497. orderSubmitMit() {
  498. //提交订单
  499. if (this.confirmParam.addressId == '') {
  500. this.$util.msg('请先添加收货地址~', 2000)
  501. return
  502. }
  503. if (this.confirmParam.payInfo.rebateFlag === 2) {
  504. if (this.rebateFee == 0) {
  505. this.$util.msg('请输入返佣服务费', 2000)
  506. return
  507. }
  508. this.confirmParam.payInfo.rebateFee = Number(this.rebateFee).toFixed(2)
  509. }
  510. this.modal = true
  511. this.contentModalText = '请仔细确认订单是否为返佣订单后再提交订单'
  512. },
  513. SellerCreateOrderSubmit() {
  514. //提交订单
  515. if (this.isSubLoading) {
  516. return
  517. }
  518. this.confirmParam.orderInfo = this.goodsData.map(el => {
  519. let productInfo = []
  520. el.cartList.forEach(pros => {
  521. productInfo.push({
  522. skuId: pros.skuId,
  523. productNum: pros.number,
  524. presentNum: 0,
  525. productType: pros.giftType
  526. })
  527. })
  528. return {
  529. splitCode: el.splitCode,
  530. shopId: el.shopId,
  531. note: el.note ? el.note : '',
  532. productInfo: productInfo
  533. }
  534. })
  535. this.confirmParam.payInfo.postage = parseInt(this.handleFreightData.postage).toFixed(2)
  536. this.confirmParam.payInfo.postageFlag = parseInt(this.handleFreightData.postageFlag)
  537. this.confirmParam.payInfo.orderShouldPayFee = this.orderShouldPayFee.toFixed(2)
  538. this.confirmParam.payInfo = JSON.stringify(this.confirmParam.payInfo)
  539. this.confirmParam.orderInfo = JSON.stringify(this.confirmParam.orderInfo)
  540. this.confirmParam.orderInvoice = JSON.stringify(this.confirmParam.orderInvoice)
  541. this.isSubLoading = true
  542. this.hanldeOrderSubmit(this.confirmParam)
  543. },
  544. hanldeOrderSubmit(params) {
  545. // 提交订单
  546. this.SellerService.SellerCreateOrderSubmit(params)
  547. .then(response => {
  548. const data = response.data
  549. if (data.code === 1) {
  550. this.$util.msg('支付成功', 2000, true, 'success')
  551. setTimeout(() => {
  552. this.isSubLoading = false
  553. this.$api.redirectTo(
  554. `/pages/seller/order/order-details?type=cash&orderId=${data.orderId}&userId=${
  555. this.postageParam.userId
  556. }`
  557. )
  558. }, 2000)
  559. } else {
  560. this.$util.msg('订单提交成功', 2000, true, 'success')
  561. setTimeout(() => {
  562. this.isSubLoading = false
  563. this.$api.redirectTo(
  564. `/pages/seller/order/order-details?type=cash&orderId=${data.orderId}&userId=${
  565. this.postageParam.userId
  566. }`
  567. )
  568. }, 2000)
  569. }
  570. })
  571. .catch(error => {
  572. this.isSubLoading = false
  573. this.handleError(error)
  574. })
  575. },
  576. handleError(data) {
  577. // 提交订单异常处理
  578. this.formatConfirmParam()
  579. const buttonMap = {
  580. 1: {
  581. contentModalText:
  582. '订单内存在械字号三类商品,需要拥有医疗执业许可证的医美机构才能购买。建议升级医美机构后再下单,否则会导致订单退款或影响发货。',
  583. modalButton: [
  584. { text: '取消', type: 'gray', plain: true },
  585. {
  586. text: '继续提交',
  587. customStyle: { color: '#fff', bgColor: 'linear-gradient(90deg, #F28F31 0%, #FF5B00 100%)' },
  588. plain: false
  589. }
  590. ]
  591. }
  592. }
  593. if (data.code === -6) {
  594. // 非医美机构下三类商品订单
  595. this.modal = true
  596. this.showModalstauts = 2
  597. this.contentModalText = buttonMap[1].contentModalText
  598. this.modalButton = buttonMap[1].modalButton
  599. } else {
  600. this.$util.msg(error.msg, 3000)
  601. }
  602. },
  603. formatConfirmParam() {
  604. // 还原提交订单参数格式
  605. this.confirmParam.payInfo = JSON.parse(this.confirmParam.payInfo)
  606. this.confirmParam.orderInfo = JSON.parse(this.confirmParam.orderInfo)
  607. this.confirmParam.orderInvoice = JSON.parse(this.confirmParam.orderInvoice)
  608. },
  609. handleRebateFlag() {
  610. // 普通订单返佣
  611. let self = this
  612. uni.showActionSheet({
  613. itemList: ['返佣订单', '普通订单,存在返佣服务费', '否'],
  614. success: e => {
  615. switch (e.tapIndex) {
  616. case 0:
  617. self.confirmParam.payInfo.rebateFlag = 1
  618. self.rebateFeeText = '返佣订单'
  619. break
  620. case 1:
  621. self.confirmParam.payInfo.rebateFlag = 2
  622. self.rebateFeeText = '普通订单,存在返佣服务费'
  623. break
  624. case 2:
  625. self.confirmParam.payInfo.rebateFlag = 0
  626. self.rebateFeeText = '否'
  627. break
  628. }
  629. }
  630. })
  631. if (this.confirmParam.payInfo.rebateFlag === 1) {
  632. this.confirmParam.payInfo.balancePayFlag = 0
  633. this.couponAmount = 0
  634. this.confirmParam.clubCouponId = 0
  635. this.confirmParam.orderSeen = 2
  636. this.$refs.clubVisible.orderVisibleText = '不可见'
  637. this.$refs.clubVisible.current = 1
  638. this.orderShouldPayFee = this.allPrice + parseInt(this.freightData.postage) - this.couponAmount
  639. this.totalDiscountAmount = this.reducedPrice + this.couponAmount
  640. this.$refs.coupon.coupon.couponAmount = 0
  641. this.$refs.freight.infoData(this.freightData)
  642. this.$refs.freight.freightData = this.freightData
  643. this.handleFreightData = this.freightData
  644. } else {
  645. this.confirmParam.orderSeen = 1
  646. this.$refs.clubVisible.orderVisibleText = '可见'
  647. if (this.couponList.length > 0) {
  648. this.confirmParam.clubCouponId = this.couponList[0].clubCouponId
  649. this.$refs.coupon.coupon.couponAmount = this.couponAmount = this.couponList[0].couponAmount
  650. }
  651. this.totalDiscountAmount = this.reducedPrice + this.couponAmount
  652. this.orderShouldPayFee = this.allPrice + parseInt(this.freightData.postage) - this.couponAmount
  653. }
  654. },
  655. handleClick(e) {
  656. //确认提交
  657. if (e.index == 1) {
  658. if (this.showModalstauts == 2) {
  659. this.confirmParam.orderMiniType = 2
  660. this.SellerCreateOrderSubmit()
  661. } else {
  662. this.SellerCreateOrderSubmit()
  663. }
  664. }
  665. this.confirmParam.orderMiniType = 0
  666. this.modal = false
  667. },
  668. handleSecondFlag() {
  669. // 二手订单勾选返佣
  670. this.rebatecheck = !this.rebatecheck
  671. if (this.rebatecheck) {
  672. this.ischecked = false
  673. this.confirmParam.payInfo.rebateFlag = 1
  674. this.confirmParam.payInfo.balancePayFlag = 0
  675. this.confirmParam.clubCouponId = 0
  676. this.confirmParam.orderSeen = 2
  677. this.$refs.clubVisible.orderVisibleText = '不可见'
  678. this.$refs.clubVisible.current = 1
  679. this.orderShouldPayFee = this.allPrice + parseInt(this.freightData.postage)
  680. this.$refs.freight.infoData(this.freightData)
  681. this.$refs.freight.freightData = this.freightData
  682. this.handleFreightData = this.freightData
  683. } else {
  684. this.confirmParam.orderSeen = 1
  685. this.$refs.clubVisible.orderVisibleText = '可见'
  686. this.confirmParam.payInfo.rebateFlag = 0
  687. this.orderShouldPayFee = this.allPrice + parseInt(this.freightData.postage)
  688. }
  689. },
  690. handFreightAlertShow() {
  691. //显示邮费弹窗
  692. this.isfreightTip = true
  693. },
  694. handleClickCancel() {
  695. // 关闭优惠券弹窗
  696. this.isCouponModel = false
  697. this.getInitCrearOrder()
  698. },
  699. hideFreight() {
  700. //关闭邮费弹窗
  701. this.isfreightTip = false
  702. },
  703. hideMobel() {
  704. this.modal = false
  705. }
  706. },
  707. onShow() {
  708. let pages = getCurrentPages()
  709. let currPage = pages[pages.length - 1]
  710. if (currPage.data.select == 'select') {
  711. this.isAddress = true
  712. let SelectData = uni.getStorageSync('selectAddress')
  713. this.confirmParam.addressId = SelectData.addressId
  714. this.postageParam.townId = SelectData.townId
  715. this.addressData = SelectData
  716. this.getFreightData()
  717. } else {
  718. this.getAddressData()
  719. }
  720. }
  721. }
  722. </script>
  723. <style lang="scss">
  724. page {
  725. height: auto;
  726. background: #f7f7f7;
  727. }
  728. .btn-hover {
  729. background: #ffffff;
  730. }
  731. .animation {
  732. /* transition: transform 0.3s ease;*/
  733. transition-property: transform;
  734. transition-duration: 0.3s;
  735. transition-timing-function: ease;
  736. }
  737. .invoice-freight {
  738. width: 702rpx;
  739. padding: 0 24rpx;
  740. height: 86rpx;
  741. line-height: 86rpx;
  742. font-size: $font-size-28;
  743. color: $text-color;
  744. background: #ffffff;
  745. float: left;
  746. font-weight: bold;
  747. .freight-left {
  748. float: left;
  749. .icon-yunfeishuoming {
  750. height: 100%;
  751. padding: 0 15rpx;
  752. color: $color-system;
  753. font-weight: normal;
  754. }
  755. }
  756. .freight-right {
  757. float: right;
  758. color: #2a81ff;
  759. }
  760. }
  761. .invoice-balance {
  762. width: 702rpx;
  763. height: auto;
  764. padding: 0 24rpx;
  765. background: #ffffff;
  766. float: left;
  767. margin-top: 24rpx;
  768. margin-bottom: 24rpx;
  769. .balabce-t {
  770. width: 100%;
  771. height: 86rpx;
  772. line-height: 86rpx;
  773. font-size: $font-size-28;
  774. color: $text-color;
  775. float: left;
  776. .balabce-t-le {
  777. float: left;
  778. font-weight: bold;
  779. }
  780. .balabce-t-ri {
  781. float: right;
  782. display: flex;
  783. align-items: center;
  784. .money {
  785. display: flex;
  786. float: left;
  787. }
  788. .checkbox-box {
  789. display: flex;
  790. width: 60rpx;
  791. float: left;
  792. height: 100%;
  793. font-size: $font-size-24;
  794. .checkbox {
  795. width: 40rpx;
  796. text-align: right;
  797. box-sizing: border-box;
  798. text-align: center;
  799. text-decoration: none;
  800. border-radius: 0;
  801. -webkit-tap-highlight-color: transparent;
  802. overflow: hidden;
  803. color: $color-system;
  804. padding: 5rpx;
  805. }
  806. }
  807. }
  808. }
  809. .balabce-b {
  810. width: 100%;
  811. float: left;
  812. overflow: hidden;
  813. .balabce-b-text {
  814. width: 100%;
  815. line-height: 58rpx;
  816. font-size: $font-size-24;
  817. color: #ff2a2a;
  818. text-align: right;
  819. float: right;
  820. }
  821. &.balabce-b--hide {
  822. padding: 0 0;
  823. height: 0px;
  824. line-height: 0px;
  825. }
  826. }
  827. }
  828. .footer {
  829. position: fixed;
  830. left: 0;
  831. bottom: 0;
  832. display: flex;
  833. align-items: center;
  834. width: 100%;
  835. height: 110rpx;
  836. line-height: 110rpx;
  837. justify-content: space-between;
  838. font-size: $font-size-28;
  839. background-color: #ffffff;
  840. z-index: 990;
  841. color: $text-color;
  842. .footer-le {
  843. width: 570rpx;
  844. height: 100%;
  845. float: left;
  846. }
  847. .footer-count {
  848. float: left;
  849. padding-left: 24rpx;
  850. width: 190rpx;
  851. box-sizing: border-box;
  852. font-size: $font-size-26;
  853. }
  854. .footer-price {
  855. width: 370rpx;
  856. float: right;
  857. text-align: right;
  858. color: $text-color;
  859. padding: 10rpx 20rpx 10rpx 0;
  860. box-sizing: border-box;
  861. .sum-none {
  862. width: 100%;
  863. height: 45rpx;
  864. line-height: 45rpx;
  865. color: $text-color;
  866. float: left;
  867. text-align: right;
  868. .money {
  869. font-size: $font-size-26;
  870. color: #999999;
  871. text-decoration: line-through;
  872. }
  873. .money-sign {
  874. font-size: $font-size-26;
  875. color: #999999;
  876. text-decoration: line-through;
  877. }
  878. .money-reduced {
  879. margin-left: 10rpx;
  880. font-size: $font-size-26;
  881. color: $color-system;
  882. }
  883. }
  884. .sum {
  885. width: 100%;
  886. height: 45rpx;
  887. line-height: 45rpx;
  888. float: left;
  889. &.none {
  890. height: 90rpx;
  891. line-height: 90rpx;
  892. }
  893. .price {
  894. font-size: $font-size-32;
  895. color: #ff2a2a;
  896. }
  897. }
  898. }
  899. .footer-submit {
  900. display: flex;
  901. align-items: center;
  902. justify-content: center;
  903. width: 180rpx;
  904. height: 100%;
  905. box-sizing: border-box;
  906. padding: 15rpx 5rpx;
  907. .btn {
  908. width: 100%;
  909. height: 100%;
  910. color: #ffffff;
  911. background: linear-gradient(90deg, #ff9300 0%, #ff5b00 100%);
  912. font-size: $font-size-26;
  913. text-align: center;
  914. line-height: 80rpx;
  915. border-radius: 40rpx;
  916. &.disabled {
  917. background: #e4e8eb;
  918. color: #999999;
  919. }
  920. }
  921. }
  922. }
  923. .order-return {
  924. width: 100%;
  925. height: auto;
  926. box-sizing: border-box;
  927. padding: 0 24rpx;
  928. background: #ffffff;
  929. float: left;
  930. margin: 24rpx 0;
  931. .order-return-main {
  932. width: 100%;
  933. height: 86rpx;
  934. line-height: 86rpx;
  935. .label {
  936. float: left;
  937. font-weight: bold;
  938. color: #333333;
  939. font-size: $font-size-28;
  940. }
  941. .label-right {
  942. float: right;
  943. color: #2a81ff;
  944. .text-l {
  945. font-size: 28rpx;
  946. font-weight: bold;
  947. margin-right: 20rpx;
  948. }
  949. .icon-xiayibu {
  950. line-height: 88rpx;
  951. color: #999999;
  952. font-weight: normal;
  953. }
  954. }
  955. }
  956. .order-return-input {
  957. width: 100%;
  958. height: 86rpx;
  959. padding-bottom: 20rpx;
  960. box-sizing: border-box;
  961. .input {
  962. width: 100%;
  963. height: 66rpx;
  964. font-size: $font-size-26;
  965. border: 1px solid #e1e1e1;
  966. line-height: 66rpx;
  967. color: #333333;
  968. border-radius: 4rpx;
  969. box-sizing: border-box;
  970. padding: 0 20rpx;
  971. }
  972. }
  973. }
  974. .Rebate {
  975. width: 702rpx;
  976. height: auto;
  977. padding: 0 24rpx;
  978. background: #ffffff;
  979. float: left;
  980. margin-bottom: 24rpx;
  981. margin-top: 24rpx;
  982. line-height: 86rpx;
  983. .rebate-title {
  984. float: left;
  985. font-weight: bold;
  986. color: #333333;
  987. font-size: $font-size-28;
  988. }
  989. .iconfont {
  990. float: right;
  991. color: #b2b2b2;
  992. font-size: 40rpx;
  993. &.icon-yixuanze {
  994. color: $color-system;
  995. }
  996. }
  997. }
  998. .coupon-content-model {
  999. width: 100%;
  1000. height: 100%;
  1001. background: rgba(0, 0, 0, 0.5);
  1002. position: fixed;
  1003. top: 0;
  1004. left: 0;
  1005. z-index: 8888;
  1006. transition: all 0.4s;
  1007. .coupon-alert-content {
  1008. width: 600rpx;
  1009. height: 612rpx;
  1010. position: absolute;
  1011. top: 0;
  1012. left: 0;
  1013. bottom: 0;
  1014. right: 0;
  1015. margin: auto;
  1016. box-sizing: border-box;
  1017. padding-top: 92rpx;
  1018. .coupon {
  1019. width: 600rpx;
  1020. height: 522rpx;
  1021. background: url(https://static.caimei365.com/app/img/icon/icon-coupon-alertbg@2x.png);
  1022. background-size: cover;
  1023. box-sizing: border-box;
  1024. padding: 230rpx 40rpx 0 40rpx;
  1025. .coupon-list {
  1026. width: 100%;
  1027. height: 147rpx;
  1028. margin-bottom: 32rpx;
  1029. box-sizing: border-box;
  1030. background: url(https://static.caimei365.com/app/img/icon/icon-coupon-bg@2x.png);
  1031. background-size: cover;
  1032. position: relative;
  1033. .list-cell-tags {
  1034. display: inline-block;
  1035. padding: 0 10rpx;
  1036. height: 32rpx;
  1037. line-height: 32rpx;
  1038. background-color: #f94b4b;
  1039. color: #ffffff;
  1040. font-size: 18rpx;
  1041. border-radius: 16rpx 0 16rpx 0;
  1042. text-align: center;
  1043. position: absolute;
  1044. top: 0;
  1045. left: 0;
  1046. }
  1047. .list-cell-le {
  1048. width: 154rpx;
  1049. height: 100%;
  1050. box-sizing: border-box;
  1051. padding: 30rpx 0;
  1052. float: left;
  1053. .coupon-maxMoney {
  1054. width: 100%;
  1055. height: 54rpx;
  1056. line-height: 54rpx;
  1057. font-size: 42rpx;
  1058. color: #f94b4b;
  1059. text-align: center;
  1060. margin-top: 10rpx;
  1061. .small {
  1062. font-size: $font-size-20;
  1063. }
  1064. }
  1065. .coupon-minMoney {
  1066. width: 100%;
  1067. height: 28rpx;
  1068. float: left;
  1069. box-sizing: border-box;
  1070. padding-left: 24rpx;
  1071. .txt {
  1072. display: block;
  1073. height: 28rpx;
  1074. line-height: 28rpx;
  1075. font-size: 16rpx;
  1076. color: #f94b4b;
  1077. text-align: center;
  1078. padding: 0 5rpx;
  1079. background-color: #fff1eb;
  1080. border-radius: 4rpx;
  1081. float: left;
  1082. }
  1083. }
  1084. }
  1085. .list-cell-ri {
  1086. width: 366rpx;
  1087. height: 100%;
  1088. box-sizing: border-box;
  1089. padding: 30rpx 20rpx;
  1090. float: left;
  1091. .list-cell-top {
  1092. width: 100%;
  1093. height: 64rpx;
  1094. line-height: 64rpx;
  1095. font-size: $font-size-26;
  1096. color: #333333;
  1097. float: left;
  1098. text-overflow: ellipsis;
  1099. display: -webkit-box;
  1100. word-break: break-all;
  1101. -webkit-box-orient: vertical;
  1102. -webkit-line-clamp: 1;
  1103. overflow: hidden;
  1104. }
  1105. .list-cell-time {
  1106. width: 100%;
  1107. height: 28rpx;
  1108. line-height: 28rpx;
  1109. text-align: left;
  1110. font-size: $font-size-20;
  1111. color: #999999;
  1112. }
  1113. }
  1114. }
  1115. .coupon-btn {
  1116. width: 100%;
  1117. height: 78rpx;
  1118. background: url(https://static.caimei365.com/app/img/icon/icon-coupon-alertbtnbg@2x.png);
  1119. background-size: cover;
  1120. line-height: 78rpx;
  1121. text-align: center;
  1122. color: #ffffff;
  1123. font-size: $font-size-36;
  1124. }
  1125. }
  1126. }
  1127. }
  1128. </style>