order.vue 7.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312
  1. <template>
  2. <!-- #ifdef H5 -->
  3. <zj-page-layout :hasFooter="true">
  4. <view class="all-container">
  5. <view class="common-title">产品信息</view>
  6. <view class="product-container card">
  7. <view class="it" v-for="(item, index) in goodsList" :key="index">
  8. <view class="name"
  9. >({{ { INNER: '保内', OUTSIDE: '保外' }[item.repairFlag] }}){{ item.goodsName
  10. }}<text>×{{ item.num }}{{ item.goodsUnit }}</text></view
  11. >
  12. <view class="price">¥{{ item.repairFlag == 'INNER' ? 0 : (item.goodsAmount * item.num) | priceFilter }}</view>
  13. </view>
  14. <view class="total">
  15. <view class="text">合计:</view>
  16. <view class="price">¥{{ totalPrice | priceFilter }}</view>
  17. </view>
  18. </view>
  19. <block v-if="type == 'P'">
  20. <view class="common-title">服务费用</view>
  21. <view class="form-container card">
  22. <view class="item">
  23. <view class="label">其他费用</view>
  24. <u--input placeholder="请输入金额" inputAlign="right" v-model="otherPrice"></u--input>
  25. </view>
  26. <view class="item">
  27. <view class="label">服务费用</view>
  28. <u--input placeholder="请输入金额" inputAlign="right" v-model="servicePrice"></u--input>
  29. </view>
  30. <view class="total">
  31. <view class="text">合计:</view>
  32. <view class="price">¥{{ (Number(otherPrice) + Number(servicePrice)) | priceFilter }}</view>
  33. </view>
  34. </view>
  35. </block>
  36. <view class="common-title">备注</view>
  37. <view class="remark-container card">
  38. <u--textarea v-model="remark" placeholder="请输入内容" border="none" autoHeight></u--textarea>
  39. </view>
  40. </view>
  41. <template slot="footer">
  42. <view class="bottom-container">
  43. <view class="left">
  44. <view class="text">共{{ totalNum }}件,合计:</view>
  45. <view class="price"
  46. >¥{{ (Number(otherPrice) + Number(servicePrice) + Number(totalPrice)) | priceFilter }}</view
  47. >
  48. </view>
  49. <view class="btn">
  50. <u-button
  51. type="primary"
  52. text="确认订单"
  53. @click="submitData(1)"
  54. v-if="!wbId || (wbId && wbIsAllFee == 'NO' && wbPayType == 'SITE')"
  55. ></u-button>
  56. <u-button type="primary" text="提交申请" @click="submitData(2)" v-else></u-button>
  57. </view>
  58. </view>
  59. </template>
  60. </zj-page-layout>
  61. <!-- #endif -->
  62. <!-- #ifndef H5 -->
  63. <web-view
  64. :src="webViewHref(`/packageMaterial/pages/newSale/order`, pam, crossPagePam)"
  65. @message="crossPage.$listener"
  66. ></web-view>
  67. <!-- #endif -->
  68. </template>
  69. <script>
  70. // #ifdef H5
  71. export default {
  72. data() {
  73. return {
  74. type: 'M',
  75. userMobile: '',
  76. orderNo: '',
  77. salesType: "",
  78. brandId: "",
  79. brandName: "",
  80. categoryId: "",
  81. categoryName: "",
  82. websitId: "",
  83. websitName: "",
  84. wbId: null, // 维保工单
  85. wbIsAllFee: null, // 维保工单是否包含全部费用
  86. wbPayType: null, // 维保工单费用支付方式
  87. goodsList: [],
  88. remark: '',
  89. otherPrice: "",
  90. servicePrice: ""
  91. }
  92. },
  93. computed: {
  94. totalNum() {
  95. let val = 0;
  96. this.goodsList.forEach(item => {
  97. val = val + item.num;
  98. })
  99. return val
  100. },
  101. totalPrice() {
  102. let val = 0;
  103. this.goodsList.filter(item=>item.repairFlag=='OUTSIDE').forEach(item => {
  104. val = val + (item.num * (item.goodsAmount * 100) / 100);
  105. })
  106. return val;
  107. },
  108. },
  109. onLoad() {
  110. let data = this.$getStorage('materialSaleDataZhiFu');
  111. if(data) {
  112. this.type = data.type;
  113. this.userMobile = data.userMobile;
  114. this.orderNo = data.orderNo;
  115. this.categoryId = data.categoryId;
  116. this.categoryName = data.categoryName;
  117. this.websitId = data.websitId;
  118. this.websitName = data.websitName;
  119. this.wbId = data.wbId;
  120. this.wbIsAllFee = data.wbIsAllFee;
  121. this.wbPayType = data.wbPayType;
  122. this.goodsList = data.goodsList;
  123. }
  124. },
  125. onHide: function () {
  126. this.$removeStorage('materialSaleData');
  127. },
  128. methods: {
  129. submitData(type) {
  130. if ((Number(this.otherPrice)+0)!==Number(this.otherPrice)) return this.$toast(`其他费用需要为数字`)
  131. if ((Number(this.servicePrice)+0)!==Number(this.servicePrice)) return this.$toast(`服务费用需要为数字`)
  132. this.$api.postJson('/pay/buy', {
  133. settlementType: this.salesType,
  134. goodsType: this.type,
  135. remark: this.remark,
  136. userMobile: this.userMobile,
  137. workerOrderId: this.orderNo,
  138. categoryId: this.categoryId || '123',
  139. categoryName: this.categoryName || '123',
  140. websitId: this.websitId,
  141. websitName: this.websitName,
  142. workerOrderItems: this.goodsList,
  143. otherPrice: this.otherPrice,
  144. servicePrice: this.servicePrice,
  145. }).then(res => {
  146. this.$navToPage({
  147. url: `/packageMaterial/pages/newSale/pay?handleOrderId=${res.data}&wbId=${this.wbId}`
  148. }, "redirectTo")
  149. })
  150. },
  151. },
  152. }
  153. // #endif
  154. // #ifndef H5
  155. export default {
  156. data() {
  157. return {
  158. pam: {},
  159. }
  160. },
  161. onLoad(pam) {
  162. this.pam = pam;
  163. }
  164. }
  165. // #endif
  166. </script>
  167. <style lang="scss" scoped>
  168. .all-container {
  169. padding: 0 20rpx;
  170. }
  171. .common-title {
  172. font-size: 32rpx;
  173. font-weight: 600;
  174. margin-top: 30rpx;
  175. }
  176. .card {
  177. @include zj-card;
  178. margin-top: 20rpx;
  179. padding: 30rpx;
  180. }
  181. .product-container {
  182. .it {
  183. display: flex;
  184. align-items: flex-end;
  185. margin-bottom: 20rpx;
  186. .name {
  187. flex: 1;
  188. font-size: 28rpx;
  189. font-weight: 500;
  190. text {
  191. color: $sec-font;
  192. margin-left: 12rpx;
  193. font-weight: normal;
  194. }
  195. }
  196. .price {
  197. margin-left: 30rpx;
  198. font-size: 28rpx;
  199. font-weight: 500;
  200. }
  201. }
  202. .total {
  203. display: flex;
  204. align-items: center;
  205. justify-content: flex-end;
  206. margin-top: 30rpx;
  207. .text {
  208. font-size: 28rpx;
  209. color: $sec-font;
  210. }
  211. .price {
  212. font-size: 28rpx;
  213. color: $minor-color;
  214. font-weight: 500;
  215. }
  216. }
  217. }
  218. .remark-container {
  219. padding: 0;
  220. ::v-deep .u-textarea {
  221. padding: 20rpx 30rpx;
  222. min-height: 200rpx;
  223. }
  224. }
  225. .form-container {
  226. .item {
  227. height: 50rpx;
  228. display: flex;
  229. align-items: center;
  230. justify-content: space-between;
  231. margin-top: 30rpx;
  232. &:first-child {
  233. margin-top: 0;
  234. }
  235. .label {
  236. margin-right: 30rpx;
  237. flex-shrink: 0;
  238. text {
  239. color: $sec-font;
  240. margin-left: 12rpx;
  241. font-weight: normal;
  242. }
  243. }
  244. .picker {
  245. display: flex;
  246. align-items: center;
  247. .placeholder {
  248. color: $sec-font;
  249. }
  250. .iconfont {
  251. margin-left: 12rpx;
  252. color: $sec-font;
  253. }
  254. }
  255. .value {
  256. flex: 1;
  257. text-align: right;
  258. }
  259. }
  260. .total {
  261. display: flex;
  262. align-items: center;
  263. justify-content: flex-end;
  264. margin-top: 30rpx;
  265. .text {
  266. font-size: 28rpx;
  267. color: $sec-font;
  268. }
  269. .price {
  270. font-size: 28rpx;
  271. color: $minor-color;
  272. font-weight: 500;
  273. }
  274. }
  275. }
  276. .bottom-container {
  277. padding: 20rpx;
  278. display: flex;
  279. align-items: center;
  280. justify-content: space-between;
  281. .left {
  282. display: flex;
  283. align-items: center;
  284. .text {
  285. font-size: 28rpx;
  286. color: $sec-font;
  287. }
  288. .price {
  289. font-size: 32rpx;
  290. color: $minor-color;
  291. font-weight: 500;
  292. }
  293. }
  294. .btn {
  295. width: 180rpx;
  296. }
  297. }
  298. </style>