cosNext.vue 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426
  1. <template>
  2. <view class="affirm-page">
  3. <view class="affirm-view overscroll">
  4. <!-- 门店信息 -->
  5. <form>
  6. <view class="module-com">
  7. <view class="commodity-view">
  8. <view class="commodity-list">
  9. <view
  10. class="commodity-item"
  11. v-for="(item, index) in selectList"
  12. :key="index"
  13. >
  14. <image
  15. class="item-icon"
  16. :src="item.cover"
  17. alt="商品图"
  18. />
  19. <view class="item-info">
  20. <view class="info-line">
  21. <text class="item-name">{{ item.itemName }}</text>
  22. <text class="item-price">
  23. <text class="unit">¥</text>
  24. <text class="price">
  25. {{ getSelectItemPrice(item) }}
  26. </text>
  27. </text>
  28. </view>
  29. <view class="info-line">
  30. <text class="item-type">{{ item.rank }}级</text>
  31. <text class="item-count">
  32. <text v-if="item.bigCount > 0 || item.smallCount > 0">{{
  33. `${item.bigCount}`
  34. }}</text>
  35. <text v-if="item.smallCount > 0">/</text>
  36. <text v-if="item.smallCount > 0">{{ item.smallCount }}</text>
  37. </text>
  38. </view>
  39. </view>
  40. </view>
  41. </view>
  42. <view class="summary-bar">
  43. <view
  44. class="operate-view"
  45. @click="gobackEvent"
  46. >
  47. <text class="iconfont icongouwuche"></text>
  48. 重选花材
  49. </view>
  50. <view class="describe-view">
  51. 共{{ allCount }}种,
  52. <!-- 共16扎9支, -->
  53. 合计 ¥<text class="price">{{ allPrice }}</text>
  54. </view>
  55. </view>
  56. </view>
  57. </view>
  58. <!-- 登录信息 -->
  59. <view class="module-com input-line-wrap">
  60. <tui-list-cell
  61. class="line-cell"
  62. :hover="false"
  63. :arrow="false"
  64. >
  65. <view class="tui-title ">结算方式</view>
  66. <button
  67. class="admin-button-com mini-btn"
  68. :class="payType==i?'blue':'default'"
  69. style="margin-right: 10upx"
  70. @tap="payType=i"
  71. v-for="(res,i) in distributionList"
  72. :key="i"
  73. >
  74. {{ res }}
  75. </button>
  76. </tui-list-cell>
  77. <tui-list-cell
  78. class="line-cell"
  79. :hover="false"
  80. :arrow="true"
  81. >
  82. <view class="tui-title ">配送时间</view>
  83. <view
  84. class="tui-input"
  85. v-if="clientInfo.id"
  86. @click="showCustomer = true"
  87. >{{ clientInfo.name }}</view>
  88. <view
  89. class="tui-placeholder"
  90. style="width: 100%"
  91. v-else
  92. @click="showCustomer = true"
  93. >请选择客户</view>
  94. </tui-list-cell>
  95. <!-- <tui-list-cell
  96. class="line-cell"
  97. :hover="false"
  98. :arrow="false"
  99. >
  100. <view class="tui-title ">运费</view>
  101. <input
  102. type="number"
  103. placeholder="请填写包装费和材料费"
  104. v-model="packingMoney"
  105. placeholder-class="tui-placeholder"
  106. >
  107. </tui-list-cell> -->
  108. <tui-list-cell
  109. class="line-cell"
  110. :hover="false"
  111. :arrow="false"
  112. >
  113. <view class="tui-title ">运费</view>
  114. <input
  115. type="number"
  116. placeholder="选填"
  117. v-model="freight"
  118. placeholder-class="tui-placeholder"
  119. >
  120. </tui-list-cell>
  121. <textarea
  122. name=""
  123. id=""
  124. cols="15"
  125. rows="5"
  126. placeholder="备注..."
  127. class="remarks"
  128. maxlength="60"
  129. ></textarea>
  130. <!-- <appFormSend :form.sync="form"> </appFormSend>-->
  131. </view>
  132. </form>
  133. </view>
  134. <view class="under-bar">
  135. <view class="price-view">
  136. <text class="price-title">收款</text>
  137. <text class="price-number">
  138. ¥ <text class="large">{{ allPrice+Number(packingMoney)+Number(freight) }}</text>
  139. </text>
  140. </view>
  141. <button
  142. class="admin-button-com blue middle"
  143. @click="affirmFormSubmit"
  144. >开单</button>
  145. </view>
  146. <!-- 选择客户 -->
  147. <AppCustomerSel
  148. :show.sync="showCustomer"
  149. @change="changeCustomerFn"
  150. />
  151. </view>
  152. </template>
  153. <script>
  154. import TuiListCell from "@/components/plugin/list-cell";
  155. import AppAvatarModule from "@/components/module/app-avatar";
  156. import SimpleAddress from "@/components/plugin/simple-address";
  157. import AppAreaSel from "@/components/app-area-sel";
  158. import AppCustomerSel from "@/components/app-customer-sel";
  159. import productMins from "@/mixins/product";
  160. import appFormRadioBtn from "@/components/app-formRadio-btn";
  161. import appAddressGroup from "@/components/app-address-group";
  162. import appSendTime from "@/components/app-send-time";
  163. import appFormSend from "@/components/app-form-send";
  164. const formUtil = require("@/utils/formValidation.js");
  165. import { createOrder, freight } from "@/api/order/index";
  166. // import { freight } from "@/api/order";
  167. import { mapActions, mapGetters } from "vuex";
  168. export default {
  169. name: "BillingAffirm", // 开单确认
  170. components: {
  171. TuiListCell,
  172. AppAvatarModule,
  173. SimpleAddress,
  174. AppAreaSel,
  175. AppCustomerSel,
  176. appFormRadioBtn,
  177. appAddressGroup,
  178. appSendTime,
  179. appFormSend
  180. },
  181. mixins: [productMins],
  182. data () {
  183. return {
  184. autoLoad: false,
  185. packingMoney: '',//包装费
  186. freight: '',//运费
  187. payType: null,//选中的-支付类型
  188. clientInfo: '',//客户信息
  189. showCustomer: false,
  190. distributionList: ['配送', '自取']
  191. };
  192. },
  193. onLoad () {
  194. if (!this.getMerchantInfo) {
  195. this.initMerchantInfo().then(data => {
  196. uni.setNavigationBarTitle({
  197. title: data.name
  198. });
  199. });
  200. } else {
  201. uni.setNavigationBarTitle({
  202. title: this.getMerchantInfo.name
  203. });
  204. }
  205. },
  206. computed: {
  207. ...mapGetters(["getMerchantInfo", "getLoginInfo", "getDictionariesInfo"])
  208. },
  209. methods: {
  210. ...mapActions(["initMerchantInfo"]),
  211. // 选取客户
  212. changeCustomerFn (info) {
  213. console.log("changeCustomerFn", info);
  214. this.clientInfo = info;
  215. },
  216. //确定开单
  217. affirmFormSubmit () {
  218. if (this.clientInfo == '') { uni.showToast({ title: '请选择客户!', icon: 'none' }); return; }
  219. if (this.packingMoney == '') { uni.showToast({ title: '请输入包装费!', icon: 'none' }); return; }
  220. if (this.payType == null) { uni.showToast({ title: '请选择结算方式!', icon: 'none' }); return; }
  221. const product = this.selectList.map(ele => {
  222. return { productId: ele.id, bigNum: ele.bigCount, smallNum: ele.smallCount };
  223. });
  224. let options = {
  225. orderType: 2,// 开单类型,1商品开单 2花材开单
  226. packingFee: this.packingMoney,// 包装费
  227. sendCost: this.freight,// 运费
  228. customId: this.clientInfo.id,// 客户
  229. payWay: this.payType,//付款方式
  230. product: JSON.stringify(product),//下单商品
  231. };
  232. let self = this;
  233. uni.showModal({
  234. title: '提示',
  235. content: '确认开单?',
  236. success: function (res) {
  237. if (res.confirm) {
  238. createOrder(options).then(res => {
  239. // this.$msg("下单成功");
  240. self.resetSelectInfoByType(self.pageType);
  241. const {
  242. data: { orderId, orderSn }
  243. } = res;
  244. let url = `/admin/billing/result?orderId=${orderId}&orderSn=${orderSn}&type=zuhe`;
  245. uni.redirectTo({ url: url });
  246. });
  247. }
  248. }
  249. });
  250. },
  251. gobackEvent () {
  252. uni.navigateBack({
  253. delta: 1
  254. });
  255. }
  256. }
  257. };
  258. </script>
  259. <style lang="scss" scoped>
  260. .admin-button-com {
  261. margin-right: 20upx;
  262. }
  263. .affirm-page {
  264. position: relative;
  265. height: 100%;
  266. display: flex;
  267. flex-direction: column;
  268. .affirm-view {
  269. flex: 1;
  270. padding: 20upx;
  271. background-color: #f0f2f6;
  272. .commodity-view {
  273. display: flex;
  274. flex-direction: column;
  275. .commodity-list {
  276. padding: 20upx;
  277. .commodity-item {
  278. display: flex;
  279. margin-bottom: 20upx;
  280. .item-icon {
  281. flex-shrink: 0;
  282. width: 140upx;
  283. height: 140upx;
  284. }
  285. .item-info {
  286. display: flex;
  287. flex-direction: column;
  288. justify-content: center;
  289. flex: 1;
  290. margin-left: 20upx;
  291. .info-line {
  292. margin-bottom: 20upx;
  293. display: flex;
  294. justify-content: space-between;
  295. align-items: flex-end;
  296. .item-name {
  297. color: #666;
  298. font-size: 28upx;
  299. }
  300. .item-price {
  301. color: #333;
  302. font-size: 22upx;
  303. .price {
  304. font-size: 32upx;
  305. font-weight: bold;
  306. }
  307. }
  308. .item-type {
  309. color: #999;
  310. font-size: 24upx;
  311. }
  312. .item-count {
  313. color: #666;
  314. font-size: 24upx;
  315. }
  316. }
  317. }
  318. }
  319. }
  320. .summary-bar {
  321. padding: 0 20upx;
  322. height: 90upx;
  323. display: flex;
  324. align-items: center;
  325. justify-content: space-between;
  326. border-top: 1px solid #eeeeee;
  327. .operate-view {
  328. display: flex;
  329. align-items: center;
  330. color: #3385ff;
  331. font-size: 26upx;
  332. .iconfont {
  333. margin-right: 20upx;
  334. font-size: 40upx;
  335. }
  336. }
  337. .describe-view {
  338. display: flex;
  339. align-items: center;
  340. color: #333;
  341. font-size: 24upx;
  342. .price {
  343. font-weight: bold;
  344. font-size: 36upx;
  345. }
  346. }
  347. }
  348. }
  349. .module-com {
  350. background-color: #fff;
  351. margin-bottom: 20upx;
  352. border-radius: 10upx;
  353. overflow: hidden;
  354. .member-wrap {
  355. .member-det {
  356. font-size: 24upx;
  357. margin-left: 20upx;
  358. }
  359. }
  360. .remark-wrap {
  361. align-items: flex-start;
  362. .remark {
  363. height: 240upx;
  364. }
  365. }
  366. // .tui-placeholder,
  367. // .tui-input {
  368. // padding-right: 30upx;
  369. // width: 100%;
  370. // text-align: right;
  371. // }
  372. }
  373. }
  374. .under-bar {
  375. display: flex;
  376. justify-content: space-between;
  377. align-items: center;
  378. padding: 0 20upx;
  379. width: 100%;
  380. height: 100upx;
  381. background-color: #fff;
  382. box-shadow: 0upx -1px 6upx 0upx rgba(4, 0, 0, 0.06);
  383. .price-view {
  384. display: flex;
  385. align-items: center;
  386. font-size: 24upx;
  387. .price-title {
  388. color: #333;
  389. }
  390. .price-number {
  391. margin: 0 20upx;
  392. color: #ff2842;
  393. .large {
  394. font-size: 40upx;
  395. }
  396. }
  397. }
  398. .admin-button-com {
  399. width: 200upx;
  400. }
  401. }
  402. }
  403. .remarks {
  404. padding: 30upx;
  405. font-size: 26upx;
  406. line-height: 30upx;
  407. height: 150upx;
  408. color: #666;
  409. }
  410. </style>