order_confirm.vue 31 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190
  1. <template>
  2. <view class="pageBg">
  3. <block v-if="emptyType == 0">
  4. <view class="top">
  5. <view class="tip" v-if="false">
  6. <image src="http://139.9.103.171:1888/img/image/tip_icon.png"></image>
  7. <text class="one_line_ellipsis">温馨提示:营业点营业时间 (08:00-22:00) 内3公里有货门店30内3公里有货门店30内3公里有货门店30</text>
  8. </view>
  9. <view class="switch_methods" v-if="false">
  10. <view class="switch_methods_box">
  11. <view :class="['item', methodsIndex == 0 ? 'active' : '']" @tap="methodsIndex = 0">送货上门</view>
  12. <view :class="['item', methodsIndex == 1 ? 'active' : '']" @tap="methodsIndex = 1">门店自提</view>
  13. </view>
  14. </view>
  15. <view class="address_Info">
  16. <!--
  17. <view class="mention_address_box" v-if="methodsIndex == 1">
  18. <image class="store_icon" src="http://139.9.103.171:1888/img/image/store_icon.png"></image>
  19. <view class="info_list">
  20. <view class="item">
  21. <text class="store_text">自提点:</text>
  22. <text class="store_name">
  23. 广州店
  24. <text class="store_distance">距离40.5km</text>
  25. </text>
  26. </view>
  27. <view class="item">
  28. <text class="contact_phone_text">联系电话:</text>
  29. <text class="contact_phone">
  30. 123333333
  31. <text class="contact">(有货)拨打电话</text>
  32. </text>
  33. </view>
  34. <view class="item">
  35. <text class="address_text">具体地址:</text>
  36. <text class="address">广东省广州市天河区车陂660号河区车陂660号河区车陂660号</text>
  37. </view>
  38. <view class="item">
  39. <text class="open_time_text">营业时间:</text>
  40. <text class="opten_time">08:00-22:00 请在营业时间内上门退货</text>
  41. </view>
  42. </view>
  43. <image class="arrow" src="http://139.9.103.171:1888/img/image/arrow.png"></image>
  44. </view>
  45. -->
  46. <block v-if="methodsIndex == 0">
  47. <view class="address_info_box" v-if="receiverAddress && receiverAddress.consignee" @tap="selectAddress">
  48. <image class="member_icon" src="http://139.9.103.171:1888/img/image/member_icon.png"></image>
  49. <view class="info_list">
  50. <view class="item">
  51. <text class="contact_text">联系人:</text>
  52. <text class="contact_name">{{ receiverAddress.consignee }}</text>
  53. </view>
  54. <view class="item">
  55. <text class="contact_phone_text">联系电话:</text>
  56. <text class="contact_phone">{{ receiverAddress.phone }}</text>
  57. </view>
  58. <view class="item">
  59. <text class="address_text">收货地址:</text>
  60. <text class="address">{{ receiverAddress.areaName + receiverAddress.address }}</text>
  61. </view>
  62. </view>
  63. <image class="arrow" src="http://139.9.103.171:1888/img/image/arrow.png"></image>
  64. </view>
  65. <view class="no_address" v-else @tap="selectAddress">
  66. <view class="no_address_box">
  67. <image src="http://139.9.103.171:1888/img/image/addr_add.png"></image>
  68. <text>暂无地址,去添加</text>
  69. </view>
  70. <image class="arrow" src="http://139.9.103.171:1888/img/image/arrow.png"></image>
  71. </view>
  72. </block>
  73. <view class="address_line"><image src="http://139.9.103.171:1888/img/image/address_line.png"></image></view>
  74. <view class="mention_info" v-if="methodsIndex == 1">
  75. <view class="input_box">
  76. <text class="input_text">提货人</text>
  77. <input
  78. :value="mentionMember"
  79. @input="inputMentionMember"
  80. placeholder="请输入提货人的姓名(必填)"
  81. placeholder-class="placeholder_class"
  82. class="input_value"
  83. />
  84. </view>
  85. <view class="input_box">
  86. <text class="input_text">手机号</text>
  87. <input
  88. :value="mentionMobilephone"
  89. type="number"
  90. maxlength="11"
  91. @input="inputMentionMobilePhone"
  92. placeholder="请输入提货人的手机号码(必填)"
  93. placeholder-class="placeholder_class"
  94. class="input_value"
  95. />
  96. </view>
  97. </view>
  98. </view>
  99. </view>
  100. <!--
  101. <view class="order_goods_list">
  102. <view class="goods_item" v-for="(item, index) in orderGoodsList" :key="index">
  103. <image class="goods_image" mode="aspectFill" :src="item.thumbnail"></image>
  104. <view class="goods_info">
  105. <text class="goods_name">{{ item.name }}</text>
  106. <text class="goods_sku_str">{{ item.specificationsDesc }}</text>
  107. <text class="goods_price">¥{{ item.skus[0].price }}</text>
  108. </view>
  109. <text class="goods_count">x {{ item.skus[0].quantity }}</text>
  110. </view>
  111. </view>
  112. -->
  113. <view v-if="orders != null" class="order_goods_list" v-for="(order, i) in orders" :key="i">
  114. <view class="businessLayout" v-if="orders.length > 1">
  115. <image class="logo" mode="aspectFill" :src="order.logo"></image>
  116. <text class="name">{{ order.name }}</text>
  117. </view>
  118. <view class="goods_item" v-for="(item, j) in order.orderItemGroups" :key="j">
  119. <image class="goods_image" mode="aspectFill" :src="item.thumbnail"></image>
  120. <view class="goods_info">
  121. <text class="goods_name">{{ item.name }}</text>
  122. <text class="goods_sku_str">{{ item.specificationsDesc }}</text>
  123. <text class="goods_price">¥{{ item.skus[0].price }}</text>
  124. </view>
  125. <text class="goods_count">x {{ item.skus[0].quantity }}</text>
  126. </view>
  127. <view class="item_info_box" v-if="order.promotionDiscount > 0">
  128. <text class="type_name2">{{order.promotionNames}}</text>
  129. <text class="amt">¥{{order.promotionDiscount}}</text>
  130. </view>
  131. <view class="item_info_box" v-if="order.shippingMethods.length > 0">
  132. <text class="type_name">物流方式</text>
  133. <block v-if="order.shippingMethods.length > 0" v-for="(shippingMethod, k) in order.shippingMethods" :key="k">
  134. <view class="shippingMethod" @tap="selectShippingMethod(i, k)" v-if="shippingMethod.isSelected">
  135. <text class="name">{{ shippingMethod.name }}</text>
  136. <!-- <text class="amt" v-if="shippingMethod.freight == 0">包邮</text>
  137. <text class="amt" v-else>¥{{ shippingMethod.freight }}</text> -->
  138. </view>
  139. </block>
  140. <text v-else class="type_value">该区域不支持发货</text>
  141. <image src="http://139.9.103.171:1888/img/image/arrow.png"></image>
  142. </view>
  143. <view v-if="isAgent" class="item_info_box">
  144. <view style="display: flex;align-items: center;">
  145. <view class="type_name">自提点</view>
  146. <view v-if="organizationInfo" style="font-size: 28upx;margin-left: 20upx;">
  147. <view>{{organizationInfo.organizeName}}-{{organizationInfo.receiver.areaName}}{{organizationInfo.receiver.address}}</view>
  148. <view style="font-size: 20upx;color: #999999;margin-top: 10upx;">商品到货时需在首页的快速取货处查看取件码</view>
  149. </view>
  150. <view v-if="!organizationInfo" @tap="jumpNearby" style="font-size: 28upx;margin-left: 20upx;">
  151. 前往加入附近团
  152. </view>
  153. </view>
  154. <switch :checked="selectAgent" :disabled="disabled" color="#E42F2F" style="transform:scale(0.7)" @tap="tapSwitch" @change="switchChange" />
  155. </view>
  156. </view>
  157. <view class="msg_box">
  158. <view class="input_box">
  159. <text class="input_text">留言</text>
  160. <input :value="msgValue" @input="inputMsg" placeholder="点击给商家留言" placeholder-class="placeholder_class" class="input_value" />
  161. </view>
  162. </view>
  163. <view class="order_pay_info">
  164. <view class="item_info_box">
  165. <text class="type_name">商品总额</text>
  166. <text class="type_value">¥{{ price }}</text>
  167. </view>
  168. <view class="item_info_box" v-if="false">
  169. <view class="type_name">
  170. <text>会员折扣</text>
  171. <view class="member_level">铂金卡</view>
  172. </view>
  173. <text class="type_value">-¥{{ couponDiscount }}</text>
  174. </view>
  175. <view class="item_info_box" v-if="false">
  176. <view class="type_name"><text>促销折扣</text></view>
  177. <text class="type_value">-¥{{ couponDiscount }}</text>
  178. </view>
  179. <view class="item_info_box" @tap="selectCoupon">
  180. <text class="type_name">优惠券</text>
  181. <text v-if="couponDiscount > 0" class="type_value">已优惠¥{{ couponDiscount }}</text>
  182. <text v-else class="type_value">无优惠</text>
  183. <image src="http://139.9.103.171:1888/img/image/arrow.png"></image>
  184. </view>
  185. <view v-if="promotionDiscountTotal > 0" class="item_info_box">
  186. <!-- <view v-if="promotionDiscountTotal > 0" class="item_info_box" @tap="selectCoupon"> -->
  187. <text class="type_name">促销优惠</text>
  188. <text class="type_value">已优惠¥{{ promotionDiscountTotal }}</text>
  189. <!-- <image src="http://139.9.103.171:1888/img/image/arrow.png"></image> -->
  190. </view>
  191. <view class="item_info_box">
  192. <text class="type_name">运费</text>
  193. <text v-if="preOrderInfo.freight > 0" class="type_value">¥{{ preOrderInfo.freight }}</text>
  194. <text v-else class="type_red_value">包邮</text>
  195. </view>
  196. </view>
  197. <view class="pay_money">
  198. <view class="item_info_box">
  199. <text class="type_name">实付金额</text>
  200. <text class="type_value">¥{{ amountPayableCount }}</text>
  201. </view>
  202. </view>
  203. <view class="bottomHeight" :style="footSafe"></view>
  204. <view class="bottom" :style="footSafe">
  205. <view class="bottomLeft">
  206. <text class="money_text">
  207. 合计:
  208. <text class="money">
  209. <text class="unit">¥</text>
  210. {{ amountPayableCount }}
  211. </text>
  212. </text>
  213. </view>
  214. <view class="bottomRight"><view class="orderConfirm" @tap="orderConfirm">提交订单</view></view>
  215. </view>
  216. <uni-popup ref="popup" type="bottom">
  217. <view class="methods_box" v-if="orderIndex >= 0 && shippingMethodIndex >= 0">
  218. <view class="methods">
  219. <view class="titleLayout">
  220. <text class="title">选择物流方式</text>
  221. <icon class="cancel" size="20" type="cancel" @tap="shippingMethod"></icon>
  222. </view>
  223. <view class="methods_list">
  224. <view class="methods_item" v-for="(shippingMethod, index) in orders[orderIndex].shippingMethods" :key="index" @tap="selectShippingMethod2(orderIndex, shippingMethod.id)">
  225. <!-- <text>{{shippingMethod.name}}<text class="freight" v-if="shippingMethod.freight == 0">(包邮)</text><text class="freight" v-else>(¥{{shippingMethod.freight}})</text></text> -->
  226. <text>{{shippingMethod.name}}</text>
  227. <image :src="shippingMethod.isSelected ? 'http://139.9.103.171:1888/img/image/http://139.9.103.171:1888/img/image/png' : 'http://139.9.103.171:1888/img/image/no_selected_icon.png'" ></image>
  228. </view>
  229. </view>
  230. <!-- <view class="btn_confirm" @tap="selectMethodsConfirm">确定</view> -->
  231. </view>
  232. </view>
  233. </uni-popup>
  234. </block>
  235. <DtEmpty :type="emptyType" />
  236. </view>
  237. </template>
  238. <script>
  239. import DtGoodsList from '../comps/dt_goods_list.vue';
  240. import DtNoData from '../comps/dt_no_data.vue';
  241. import DtNoMore from '../comps/dt_no_more.vue';
  242. import DtEmpty from '../comps/dt_empty.vue';
  243. import uniPopup from "../comps/uni-popup/uni-popup.vue"
  244. export default {
  245. components: {
  246. DtGoodsList,
  247. DtNoData,
  248. DtNoMore,
  249. DtEmpty,
  250. uniPopup
  251. },
  252. data() {
  253. return {
  254. space: '\xa0\xa0',
  255. methodsIndex: 0,
  256. selectMethodsIndex: 0,
  257. showSelectMethods: false,
  258. mentionMember: '',
  259. mentionMobilephone: '',
  260. msgValue: '',
  261. params: '', //立即购买 传进来的参数
  262. cartItemIds: '', //购物车 购物车Ids
  263. dtos: '', //购物车 重新计算费用参数
  264. flag: -1,
  265. isCalculate: false,
  266. couponCodes: [], // 优惠券列表
  267. preOrderInfo: {},
  268. shippingMethodId: 1, //邮寄方式
  269. orderGoodsList: [],
  270. amountPayableCount: 0, //实付总额
  271. price: 0, //商品总额
  272. couponDiscount: 0, // 优惠券优惠金额
  273. promotionDiscountTotal: 0, //促销优惠
  274. selectCodes: [], // 跳转选择优惠券页面获取的优惠券
  275. // chooseCodes:[], // 选中的优惠券
  276. promotionDiscount: 0, //促销金额
  277. freight: 0, //运费
  278. receiverAddress: {}, //收货地址
  279. isCanDelivery: true, //收货地址是否支持收货
  280. deliveryNames: '', //不支持收货的地址
  281. orders: [],
  282. orderIndex: -1,
  283. shippingMethodIndex: -1,
  284. isAgent:false,//是否显示代理选项
  285. selectAgent:false, //是否选择代理地址
  286. disabled:true, //禁止switch
  287. organizationInfo:null, //团长信息
  288. memberId:null
  289. };
  290. },
  291. computed: {
  292. footSafe() {
  293. return `padding-bottom:${this.safeAreaBottom}px`;
  294. }
  295. },
  296. methods: {
  297. async getOrganizationInfo(){
  298. let resp = await this.$api.getOrganizationInfo({
  299. memberId: this.memberId
  300. });
  301. if(resp.receiverId){
  302. this.disabled = false;
  303. this.organizationInfo = resp;
  304. }
  305. },
  306. jumpNearby(){
  307. if(this.disabled){
  308. uni.navigateTo({
  309. url: '/pages/nearby_team?jumpType=1'
  310. });
  311. }
  312. },
  313. tapSwitch(e){
  314. if(this.disabled){
  315. this.$dialog.alert({
  316. content:'您未加入附近团',
  317. confirmText: '去添加',
  318. showCancel: true,
  319. success: (res) => {
  320. if (res.confirm) {
  321. uni.navigateTo({
  322. url: '/pages/nearby_team?jumpType=1'
  323. });
  324. }
  325. }
  326. })
  327. }
  328. },
  329. switchChange(e){
  330. this.selectAgent = e.detail.value;
  331. },
  332. shippingMethod(){
  333. this.$refs.popup.close();
  334. },
  335. selectShippingMethod(orderIndex, shippingMethodIndex){
  336. this.orderIndex = orderIndex;
  337. this.shippingMethodIndex = shippingMethodIndex;
  338. this.$refs.popup.open();
  339. },
  340. selectShippingMethod2(orderIndex, id){
  341. console.error("======id>>"+id);
  342. this.orderIndex = -1;
  343. this.shippingMethodIndex = -1;
  344. this.shippingMethodId = id;
  345. this.$refs.popup.close();
  346. if(this.orders[orderIndex].shippingMethods.length == 1) return;
  347. for(let i = 0; i < this.orders[orderIndex].shippingMethods.length; i++){
  348. this.orders[orderIndex].shippingMethods[i].isSelected = this.orders[orderIndex].shippingMethods[i].id == id;
  349. }
  350. this.isCalculate = true;
  351. this.onShowPage();
  352. },
  353. inputMentionMember(e) {
  354. this.mentionMember = e.detail.value;
  355. },
  356. inputMentionMobilePhone(e) {
  357. this.mentionMobilephone = e.detail.value;
  358. },
  359. inputMsg(e) {
  360. this.msgValue = e.detail.value;
  361. if (this.dtos && this.dtos.length > 0) {
  362. this.dtos[0].memo = this.msgValue;
  363. }
  364. },
  365. selectMethodsConfirm() {
  366. this.methodsIndex = this.selectMethodsIndex;
  367. this.showSelectMethods = false;
  368. },
  369. //选择地址
  370. selectAddress() {
  371. uni.navigateTo({
  372. url: '/pagesM/pages/address_list?isFromOrder=1'
  373. });
  374. },
  375. //选择优惠券
  376. selectCoupon() {
  377. uni.navigateTo({
  378. url: '/pagesM/pages/coupon_select?flag=' + this.flag
  379. });
  380. },
  381. //立即购买预加载订单
  382. async preloadBuy() {
  383. try {
  384. let data = JSON.parse(this.params);
  385. data._isShowLoading = true;
  386. data._isReject = true;
  387. let resp = await this.$api.preloadBuy(data);
  388. this.preOrderInfo = resp;
  389. this.emptyType = 0;
  390. this.handleOrder(resp);
  391. } catch (err) {
  392. this.emptyType = 2;
  393. this.$dialog.alert({
  394. content: err.errmsg || '暂无数据~'
  395. });
  396. }
  397. },
  398. //购物车预加载订单
  399. async preload() {
  400. try {
  401. let data = JSON.parse(this.cartItemIds);
  402. data._isShowLoading = true;
  403. data._isReject = true;
  404. let resp = await this.$api.preload(data);
  405. this.preOrderInfo = resp;
  406. this.emptyType = 0;
  407. this.handleOrder(resp);
  408. } catch (err) {
  409. this.emptyType = 2;
  410. this.$dialog.alert({
  411. content: err.errmsg || '暂无数据~'
  412. });
  413. }
  414. },
  415. //立即购买-重新计算费用
  416. async calculateBuy() {
  417. let { skuId, quantity } = JSON.parse(this.params);
  418. let data = {};
  419. data.codes = this.selectCodes;
  420. if(this.selectAgent){//判断是否选择代理地址
  421. data.receiverId = this.organizationInfo.receiverId;
  422. }else{
  423. data.receiverId = this.receiverAddress.id;
  424. }
  425. data.paymentMethodId = 1;
  426. data.shippingMethodId = this.shippingMethodId;
  427. data.balance = 0;
  428. data.skuId = skuId;
  429. data.quantity = quantity;
  430. data.memo = this.msgValue;
  431. // data.invoiceTitle="";
  432. // data.invoiceTaxNumber=""
  433. console.log(data);
  434. let resp = await this.$api.calculateBuy(data);
  435. console.log(295, resp);
  436. this.preOrderInfo = resp;
  437. this.handleOrder(resp);
  438. },
  439. //购物车-重新计算费用
  440. async cartCalculate() {
  441. console.log(302);
  442. let data = {};
  443. if(this.selectAgent){//判断是否选择代理地址
  444. data.receiverId = this.organizationInfo.receiverId;
  445. }else{
  446. data.receiverId = this.receiverAddress.id;
  447. }
  448. data.paymentMethodId = 1;
  449. data.balance = 0;
  450. data.codes = this.selectCodes;
  451. this.dtos[0].shippingMethodId = this.shippingMethodId;
  452. this.dtos[0].codes = this.selectCodes;
  453. data.dtos = this.dtos;
  454. let resp = await this.$api.cartCalculate(data);
  455. this.preOrderInfo = resp;
  456. this.handleOrder(resp);
  457. },
  458. handleOrder(resp) {
  459. if (resp.defaultReceiver) {
  460. this.receiverAddress = resp.defaultReceiver;
  461. let isCanDelivery = true;
  462. let names = '';
  463. this.deliveryNames = '';
  464. if (resp.orders != null && resp.orders.length > 0) {
  465. for (let item of resp.orders) {
  466. if (item.isCanDelivery == false) {
  467. isCanDelivery = false;
  468. if (item.orderItemGroups != null || item.orderItemGroups.length > 0) {
  469. for (let orderItem of item.orderItemGroups) {
  470. names += (names.length > 0 ? ',' : '') + orderItem.name;
  471. }
  472. }
  473. }
  474. }
  475. }
  476. this.deliveryNames = names;
  477. this.isCanDelivery = isCanDelivery;
  478. if (!this.isCanDelivery) {
  479. let msg = names.length > 0 ? names + '等' : '部分';
  480. uni.showToast({
  481. icon: 'none',
  482. title: msg + '商品不支持配送 ' + this.receiverAddress.areaName + ' 地区'
  483. });
  484. }
  485. }
  486. this.orders = resp.orders || [];
  487. let aimStoreId = this.$global.server.storeId;
  488. this.promotionDiscountTotal = 0;
  489. this.orders.forEach((order, i) => {
  490. if (aimStoreId == order.storeId) {
  491. if (order.promotionDiscount != null && order.promotionDiscount > 0) {
  492. this.promotionDiscountTotal += order.promotionDiscount;
  493. }
  494. let couponCodes = order.couponCodes || [];
  495. let selectCodes = [];
  496. couponCodes.forEach(coupon => {
  497. if (coupon.isSelected && !coupon.isUsed) {
  498. // 选中而未使用的
  499. selectCodes.push(coupon.code);
  500. }
  501. });
  502. this.couponCodes = couponCodes.slice(0);
  503. this.selectCodes = selectCodes;
  504. let orderItemGroups = order.orderItemGroups || [];
  505. let orderItemList = [];
  506. orderItemGroups.forEach(orderItem => {
  507. orderItem.skus.forEach(sku => {
  508. let oItem = Object.assign({}, orderItem);
  509. oItem.skuDetail = sku;
  510. oItem.specificationsDesc = sku.specifications.join(' ');
  511. orderItemList.push(oItem);
  512. });
  513. });
  514. this.orderGoodsList = orderItemList;
  515. this.shippingMethodId = order.shippingMethodId || 1;
  516. this.amountPayableCount = order.amountPayable;
  517. this.price = order.price;
  518. this.couponDiscount = order.couponDiscount;
  519. this.promotionDiscount = order.promotionDiscount;
  520. this.freight = order.freight;
  521. }
  522. });
  523. //判断是否是团长
  524. if(resp.agentReceivers&&resp.agentReceivers.length>0){
  525. resp.agentReceivers.forEach((order, i) => {
  526. if (aimStoreId == order.storeId) {
  527. if (!order.isTeamLeader) {
  528. this.isAgent = true;
  529. }
  530. }
  531. });
  532. }
  533. },
  534. //提交订单
  535. async orderConfirm() {
  536. if(this.selectAgent&&!this.organizationInfo){
  537. this.$dialog.toast('请选择地址');
  538. return;
  539. }else if(!this.selectAgent&&!this.receiverAddress.id){
  540. this.$dialog.toast('请选择地址');
  541. return;
  542. }
  543. if (!this.isCanDelivery) {
  544. let msg = this.deliveryNames.length > 0 ? this.deliveryNames + '等' : '部分';
  545. uni.showToast({
  546. icon: 'none',
  547. title: msg + '商品不支持配送 ' + this.receiverAddress.areaName + ' 地区'
  548. });
  549. return;
  550. }
  551. if(this.orders == null || this.orders.length <= 0) return;
  552. for (let order of this.orders) {
  553. if(order.shippingMethods == null || order.shippingMethods.length <= 0){
  554. uni.showToast({icon: 'none', title: '商品不支持配送 '});
  555. return;
  556. }
  557. }
  558. let tmplIds = ['hk0klJ6E88dHqnFgqXfndbUwZebarjLy5C6OYRL0Hgg'];//订单状态提醒
  559. uni.requestSubscribeMessage({
  560. tmplIds: tmplIds,
  561. success(res) {Log.e('小程序订阅消息-success', res);},
  562. fail (error) {Log.e('小程序订阅消息-fail', error);},
  563. });
  564. if (this.flag == this.$global.orderFlag.normal) {
  565. let { skuId, quantity } = JSON.parse(this.params);
  566. let data = {};
  567. data.codes = this.selectCodes;
  568. if(this.selectAgent){//判断是否选择代理地址
  569. data.receiverId = this.organizationInfo.receiverId;
  570. }else{
  571. data.receiverId = this.receiverAddress.id;
  572. }
  573. data.paymentMethodId = 1;
  574. data.shippingMethodId = this.shippingMethodId;
  575. data.balance = 0;
  576. data.skuId = skuId;
  577. data.quantity = quantity;
  578. data.memo = this.msgValue;
  579. let res = await this.$api.createBuy(data);
  580. this.$util.refreshPage(['pages/good_des', 'pages/mine']);
  581. if(this.selectAgent){
  582. this.$dialog.alert({
  583. content:'取货时请到首页查看取货码',
  584. confirmText: '确定',
  585. showCancel: false,
  586. success: (resource) => {
  587. if (resource.confirm) {
  588. uni.redirectTo({
  589. url: '/pagesM/pages/order_pay?orderSns=' + JSON.stringify(res.sns) + '&payFlag=' + this.$global.payFlag.normal
  590. });
  591. }
  592. }
  593. })
  594. }else{
  595. uni.redirectTo({
  596. url: '/pagesM/pages/order_pay?orderSns=' + JSON.stringify(res.sns) + '&payFlag=' + this.$global.payFlag.normal
  597. });
  598. }
  599. } else if (this.flag == this.$global.orderFlag.card) {
  600. let data = {};
  601. if(this.selectAgent){//判断是否选择代理地址
  602. data.receiverId = this.organizationInfo.receiverId;
  603. }else{
  604. data.receiverId = this.receiverAddress.id;
  605. }
  606. data.paymentMethodId = 1;
  607. data.balance = 0;
  608. data.codes = [];
  609. this.dtos[0].shippingMethodId = this.shippingMethodId;
  610. this.dtos[0].codes = this.selectCodes;
  611. data.dtos = this.dtos;
  612. let res = await this.$api.preorderCreate(data);
  613. this.$util.refreshPage(['/pagesM/pages/good_des', 'pages/wode/wode', '/pagesM/pages/shop_car']);
  614. if(this.selectAgent){
  615. this.$dialog.alert({
  616. content:'取货时请到首页查看取货码',
  617. confirmText: '确定',
  618. showCancel: false,
  619. success: (resource) => {
  620. if (resource.confirm) {
  621. uni.redirectTo({
  622. url: '/pagesM/pages/order_pay?orderSns=' + JSON.stringify(res.sns) + '&payFlag=' + this.$global.payFlag.normal
  623. });
  624. }
  625. }
  626. })
  627. }else{
  628. uni.redirectTo({
  629. url: '/pagesM/pages/order_pay?orderSns=' + JSON.stringify(res.sns) + '&payFlag=' + this.$global.payFlag.normal
  630. });
  631. }
  632. // this.$util.refreshPage(['pages/shop_car'])
  633. }
  634. },
  635. onShowPage() {
  636. if (this.isCalculate) {
  637. if (this.flag == this.$global.orderFlag.normal) {
  638. this.calculateBuy();
  639. } else if (this.flag == this.$global.orderFlag.card) {
  640. this.cartCalculate();
  641. }
  642. this.isCalculate = false;
  643. }
  644. },
  645. onLoadPage(options) {
  646. this.memberId = this.$auth.getMemberId();
  647. this.getOrganizationInfo();
  648. this.showSelectMethods = false;
  649. this.flag = options.flag;
  650. if (options.flag && options.flag == this.$global.orderFlag.normal) {
  651. this.params = options.params;
  652. this.preloadBuy();
  653. }
  654. if (options.flag && options.flag == this.$global.orderFlag.card) {
  655. this.cartItemIds = options.cartItemIds;
  656. this.dtos = JSON.parse(options.dtos);
  657. this.preload();
  658. }
  659. }
  660. },
  661. onShow() {
  662. this.onShowPage();
  663. }
  664. };
  665. </script>
  666. <style lang="scss" scoped>
  667. .top {
  668. background: #fff;
  669. .tip {
  670. display: flex;
  671. flex-direction: row;
  672. align-items: center;
  673. background: #fffdd9;
  674. height: 50upx;
  675. padding: 0 30upx;
  676. image {
  677. width: 25upx;
  678. height: 25upx;
  679. margin-right: 10upx;
  680. }
  681. text {
  682. flex: 1;
  683. color: #a72038;
  684. font-size: 22upx;
  685. }
  686. }
  687. .switch_methods {
  688. padding: 30upx;
  689. .active {
  690. background: #e5e5e5;
  691. }
  692. .switch_methods_box {
  693. border: 1upx solid #e5e5e5;
  694. display: flex;
  695. flex-direction: row;
  696. align-items: center;
  697. .item {
  698. width: 50%;
  699. font-size: 30upx;
  700. color: #333333;
  701. height: 60upx;
  702. line-height: 60upx;
  703. text-align: center;
  704. }
  705. }
  706. }
  707. .address_Info {
  708. .address_info_box {
  709. display: flex;
  710. flex-direction: row;
  711. align-items: center;
  712. padding: 30upx;
  713. // padding-bottom: 30upx;
  714. position: relative;
  715. .member_icon {
  716. width: 30upx;
  717. height: 30upx;
  718. position: absolute;
  719. top: 36upx;
  720. left: 30upx;
  721. }
  722. .info_list {
  723. flex: 1;
  724. display: flex;
  725. flex-direction: column;
  726. margin-left: 50upx;
  727. .item {
  728. display: flex;
  729. flex-direction: row;
  730. font-size: 26upx;
  731. color: #666666;
  732. margin-bottom: 10upx;
  733. text:last-child {
  734. flex: 1;
  735. }
  736. .address {
  737. line-height: 40upx;
  738. }
  739. }
  740. .item:first-child {
  741. font-size: 28upx;
  742. color: #333;
  743. }
  744. .item:last-child {
  745. margin-bottom: 0;
  746. }
  747. }
  748. .arrow {
  749. width: 10upx;
  750. height: 18upx;
  751. transform: scale(1.2);
  752. margin-left: 20upx;
  753. }
  754. }
  755. .mention_address_box {
  756. display: flex;
  757. flex-direction: row;
  758. align-items: center;
  759. padding: 0 30upx;
  760. padding-bottom: 30upx;
  761. position: relative;
  762. .store_icon {
  763. width: 30upx;
  764. height: 30upx;
  765. position: absolute;
  766. top: 6upx;
  767. left: 30upx;
  768. }
  769. .info_list {
  770. flex: 1;
  771. display: flex;
  772. flex-direction: column;
  773. margin-left: 50upx;
  774. .item {
  775. display: flex;
  776. flex-direction: row;
  777. font-size: 26upx;
  778. color: #666666;
  779. margin-bottom: 10upx;
  780. text:last-child {
  781. flex: 1;
  782. }
  783. .store_name,
  784. .contact_phone {
  785. display: flex;
  786. flex-direction: row;
  787. }
  788. .store_distance,
  789. .contact {
  790. text-decoration: underline;
  791. color: #f3993a;
  792. font-size: 18upx;
  793. margin-left: 10upx;
  794. letter-spacing: 1upx;
  795. padding: 10upx;
  796. }
  797. }
  798. .item:first-child {
  799. font-size: 28upx;
  800. color: #333;
  801. }
  802. .item:last-child {
  803. margin-bottom: 0;
  804. }
  805. }
  806. .arrow {
  807. width: 10upx;
  808. height: 18upx;
  809. transform: scale(1.2);
  810. margin-left: 20upx;
  811. }
  812. }
  813. .address_line {
  814. width: 100%;
  815. height: 8upx;
  816. display: flex;
  817. flex-direction: row;
  818. image {
  819. height: 8upx;
  820. width: 100%;
  821. }
  822. }
  823. .no_address {
  824. display: flex;
  825. flex-direction: row;
  826. align-items: center;
  827. padding: 30upx;
  828. .no_address_box {
  829. flex: 1;
  830. display: flex;
  831. flex-direction: column;
  832. align-items: center;
  833. image {
  834. width: 35upx;
  835. height: 35upx;
  836. padding-bottom: 20upx;
  837. }
  838. text {
  839. font-size: 28upx;
  840. color: rgb(153, 153, 153);
  841. }
  842. }
  843. .arrow {
  844. width: 10upx;
  845. height: 18upx;
  846. transform: scale(1.2);
  847. margin-left: 20upx;
  848. }
  849. }
  850. .input_box:last-child {
  851. border-top: none;
  852. }
  853. }
  854. }
  855. .input_box {
  856. display: flex;
  857. flex-direction: row;
  858. justify-content: space-between;
  859. padding: 30upx;
  860. align-items: center;
  861. box-sizing: border-box;
  862. border-top: 1upx solid #e5e5e5;
  863. .input_text {
  864. color: #666666;
  865. font-size: 28upx;
  866. }
  867. .input_value {
  868. font-size: 28upx;
  869. flex: 1;
  870. text-align: right;
  871. margin-left: 40upx;
  872. }
  873. .placeholder_class {
  874. color: #999999;
  875. }
  876. }
  877. .item_info_box {
  878. display: flex;
  879. flex-direction: row;
  880. justify-content: space-between;
  881. padding: 30upx;
  882. align-items: center;
  883. box-sizing: border-box;
  884. border-top: 1upx solid #e5e5e5;
  885. .type_name {
  886. color: #666666;
  887. font-size: 28upx;
  888. display: flex;
  889. flex-direction: row;
  890. align-items: center;
  891. flex-grow: 0;
  892. flex-shrink: 0;
  893. .member_level {
  894. padding: 4upx 10upx;
  895. background: #ffc600;
  896. border-radius: 4upx;
  897. color: #fff;
  898. font-size: 22upx;
  899. margin-left: 10upx;
  900. }
  901. }
  902. .type_name2 {
  903. color: #ff9d00;
  904. font-size: 28upx;
  905. display: flex;
  906. flex-direction: row;
  907. align-items: center;
  908. flex-grow: 0;
  909. flex-shrink: 0;
  910. }
  911. .shippingMethod {
  912. display: flex;
  913. flex: 1;
  914. align-items: center;
  915. justify-content: space-between;
  916. margin-left: 20upx;
  917. .name {
  918. font-size: 28upx;
  919. flex-grow: 1;
  920. max-width: 400upx;
  921. overflow: hidden;
  922. text-overflow: ellipsis;
  923. white-space: nowrap;
  924. }
  925. }
  926. .amt {
  927. color: #ff0000;
  928. font-size: 28upx;
  929. margin-left: 20upx;
  930. flex-grow: 0;
  931. flex-grow: 0;
  932. flex-shrink: 0;
  933. }
  934. .type_value {
  935. color: #333;
  936. font-size: 28upx;
  937. flex: 1;
  938. text-align: right;
  939. margin-left: 40upx;
  940. }
  941. .type_red_value {
  942. color: #ff0000;
  943. font-size: 28upx;
  944. flex: 1;
  945. text-align: right;
  946. margin-left: 40upx;
  947. }
  948. image {
  949. width: 10upx;
  950. height: 18upx;
  951. margin-left: 20upx;
  952. }
  953. }
  954. .order_goods_list {
  955. display: flex;
  956. flex-direction: column;
  957. background: #fff;
  958. margin-top: 20upx;
  959. .businessLayout {
  960. display: flex;
  961. align-items: center;
  962. padding: 10upx 20upx;
  963. .logo {
  964. width: 40upx;
  965. height: 40upx;
  966. border-radius: 50%;
  967. border: 1upx solid #c8c7cc;
  968. }
  969. .name {
  970. font-size: 0.9rem;
  971. margin-left: 15upx;
  972. }
  973. }
  974. .goods_item {
  975. display: flex;
  976. flex-direction: row;
  977. padding: 30upx;
  978. border-top: 1upx solid #e5e5e5;
  979. .goods_image {
  980. width: 150upx;
  981. height: 150upx;
  982. }
  983. .goods_info {
  984. display: flex;
  985. flex-direction: column;
  986. flex: 1;
  987. justify-content: space-between;
  988. margin-left: 20upx;
  989. .goods_name {
  990. font-size: 30upx;
  991. color: #333333;
  992. }
  993. .goods_sku_str {
  994. font-size: 26upx;
  995. color: #999999;
  996. }
  997. .goods_price {
  998. font-size: 30upx;
  999. color: #333333;
  1000. }
  1001. }
  1002. .goods_count {
  1003. font-size: 30upx;
  1004. color: #333;
  1005. }
  1006. }
  1007. .goods_item:first-child {
  1008. border-top: none;
  1009. }
  1010. }
  1011. .msg_box {
  1012. background: #fff;
  1013. margin-top: 20upx;
  1014. }
  1015. .order_pay_info,
  1016. .pay_money {
  1017. background: #fff;
  1018. margin-top: 20upx;
  1019. .item_info_box:first-child {
  1020. border-top: none;
  1021. }
  1022. }
  1023. .bottomHeight {
  1024. height: 120upx;
  1025. }
  1026. .bottom {
  1027. height: 98upx;
  1028. background: white;
  1029. position: fixed;
  1030. bottom: 0;
  1031. width: 100%;
  1032. font-size: 30upx;
  1033. display: flex;
  1034. flex-direction: row;
  1035. justify-content: space-between;
  1036. align-items: center;
  1037. border-top: 2upx solid rgb(238, 238, 238);
  1038. .bottomLeft {
  1039. display: flex;
  1040. flex-direction: row;
  1041. align-items: center;
  1042. font-size: 26upx;
  1043. .money_text {
  1044. color: #333333;
  1045. padding-left: 30upx;
  1046. }
  1047. .money {
  1048. color: #d32222;
  1049. font-size: 40upx;
  1050. .unit {
  1051. font-size: 26upx;
  1052. }
  1053. }
  1054. }
  1055. .bottomRight {
  1056. display: flex;
  1057. flex-direction: row;
  1058. align-items: center;
  1059. box-sizing: border-box;
  1060. .orderConfirm {
  1061. background: $dt-color-primary;
  1062. width: 210upx;
  1063. text-align: center;
  1064. height: 98upx;
  1065. line-height: 98upx;
  1066. color: white;
  1067. box-sizing: border-box;
  1068. font-size: 30upx;
  1069. }
  1070. }
  1071. }
  1072. .methods_box {
  1073. height: 100%;
  1074. width: 100%;
  1075. z-index: 101;
  1076. background: rgba(0, 0, 0, 0.5);
  1077. display: flex;
  1078. flex-direction: column;
  1079. align-items: center;
  1080. justify-content: center;
  1081. .methods {
  1082. background: rgba(255, 255, 255, 1);
  1083. width: 100%;
  1084. display: flex;
  1085. flex-direction: column;
  1086. .titleLayout{
  1087. display: flex;
  1088. position: relative;
  1089. justify-content: center;
  1090. align-items: center;
  1091. border-bottom: 1upx solid #e5e5e5;
  1092. .title {
  1093. font-size: 28upx;
  1094. color: #333333;
  1095. font-weight: bold;
  1096. text-align: center;
  1097. height: 79upx;
  1098. line-height: 79upx;
  1099. }
  1100. .cancel{
  1101. position: absolute;
  1102. right: 20upx;
  1103. }
  1104. }
  1105. .methods_list {
  1106. padding: 0 40upx;
  1107. .methods_item {
  1108. display: flex;
  1109. flex-direction: row;
  1110. align-items: center;
  1111. justify-content: space-between;
  1112. height: 140upx;
  1113. border-bottom: 1upx solid #e5e5e5;
  1114. text {
  1115. font-size: 28upx;
  1116. color: #333;
  1117. .freight{color: #FF0000;}
  1118. }
  1119. image {
  1120. width: 40upx;
  1121. height: 40upx;
  1122. }
  1123. }
  1124. .methods_item:last-child {
  1125. border-bottom: none;
  1126. }
  1127. }
  1128. .btn_confirm {
  1129. flex: 1;
  1130. width: 100%;
  1131. background: #f3993a;
  1132. border-radius: 0px 0px 10upx 10upx;
  1133. display: flex;
  1134. align-items: center;
  1135. justify-content: center;
  1136. padding: 20upx 0upx;
  1137. color: #fff;
  1138. }
  1139. }
  1140. }
  1141. </style>