commodityDetails.vue 7.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263
  1. <template>
  2. <view style="padding-top: 0.01rpx;">
  3. <view style="width: 100%;margin: 0 auto;height: 800rpx;">
  4. <!-- <image v-for="(ite,ind) in form.filesList" :key="ind" v-if="ite.version === '0'" :src="ite.url" style="width: 100%;height: 100%;border-radius: 20rpx;"></image> -->
  5. <u-swiper :list="form.filesList" indicator indicatorMode="dot" :autoplay="false" height="800rpx"></u-swiper>
  6. </view>
  7. <view class="contentBox">
  8. <view style="display: flex;align-items: center;">
  9. <view>
  10. <text style="font-size: 58rpx;color: red;margin-right: 20rpx;">¥{{form.mallPrice || 0}}</text>
  11. <!-- <text style="font-size: 48rpx;text-decoration:line-through;">¥{{form.standardPrice}}</text> -->
  12. </view>
  13. <view style="display: flex;">
  14. <view v-if="form.billType == 0"
  15. style="font-size: 16rpx;background-color: #FD4B09;color: #fff;padding: 6rpx;border-radius: 6rpx;">
  16. 今日达</view>
  17. <view v-else
  18. style="font-size: 16rpx;background-color: #5ac725;color: #fff;padding: 6rpx;border-radius: 6rpx;">
  19. 次日达</view>
  20. </view>
  21. </view>
  22. <view>
  23. <text>{{form.cname}}</text>
  24. </view>
  25. </view>
  26. <view class="head">
  27. <u-cell-group title-bg-color="rgb(243, 244, 246)" :border="false">
  28. <u-cell :isLink="false" :border="false" center>
  29. <template slot="value">
  30. <u-radio-group
  31. v-model="dataForm.type"
  32. placement="row"
  33. @change="groupChange">
  34. <u-radio activeColor="#FD4B09" v-if="dataForm.thisLocality" :label="`今日达(库存:${~~(dataForm.thisLocality.inventory) || 0})`" :name="0"></u-radio>
  35. <u-radio activeColor="#FD4B09" v-if="dataForm.offsite" :label="`次日达(库存:${~~(dataForm.offsite.inventory) || 0})`" :name="1"></u-radio>
  36. </u-radio-group>
  37. </template>
  38. </u-cell>
  39. <!-- <u-cell title="所属公司:" :isLink="true" :border="false" center
  40. @click="filterAll(['salesCompanyName','salesCompanyId'])">
  41. <template slot="value">
  42. <text>{{form.salesCompanyName}}</text>
  43. </template>
  44. </u-cell> -->
  45. <u-cell :isLink="false" :border="false" center>
  46. <template slot="title">
  47. <text>库存:{{form.inventory?~~(form.inventory):''}}</text>
  48. </template>
  49. <template slot="value">
  50. <u-number-box v-model="form.goodsNum" :min="1" :max="form.inventory"></u-number-box>
  51. </template>
  52. </u-cell>
  53. </u-cell-group>
  54. </view>
  55. <view class="head">
  56. <u-cell-group title-bg-color="rgb(243, 244, 246)" :border="false" v-if="arrow">
  57. <u-cell :isLink="false" :border="false" center>
  58. <template slot="title">
  59. <text>规格型号:</text>
  60. </template>
  61. <template slot="value">
  62. <text>{{form.specificationAndModel||''}}</text>
  63. </template>
  64. </u-cell>
  65. <u-cell :isLink="false" :border="false" center>
  66. <template slot="title">
  67. <text>花纹:</text>
  68. </template>
  69. <template slot="value">
  70. <text>{{form.brandItem||''}}</text>
  71. </template>
  72. </u-cell>
  73. <u-cell :isLink="false" :border="false" center>
  74. <template slot="title">
  75. <text>产地:{{form.placeProduction||''}}</text>
  76. </template>
  77. <template slot="value">
  78. <text>防爆:{{form.explosionProof==1?"是":"否"}}</text>
  79. </template>
  80. </u-cell>
  81. <u-cell :isLink="false" :border="false" center>
  82. <template slot="title">
  83. <text>原厂:{{form.originalFactory==1?'是':'否'}}</text>
  84. </template>
  85. <template slot="value">
  86. <text>自修补:{{form.selfRecovery==1?'是':'否'}}</text>
  87. </template>
  88. </u-cell>
  89. </u-cell-group>
  90. <view style="margin: 0 auto;" @click="arrow = !arrow">
  91. <u-icon name="arrow-up" labelPos="top" size="28" v-if="arrow"></u-icon>
  92. <u-icon name="arrow-down" labelPos="top" size="28" v-else></u-icon>
  93. </view>
  94. </view>
  95. <u-divider text="商品详情"></u-divider>
  96. <view style="width: 100%;margin-bottom: 100rpx;">
  97. <view v-html="form.detailsText"></view>
  98. </view>
  99. <view style="width: 100%;position: fixed;bottom: 0;background-color: #fff;border-top: 1rpx solid #ccc;padding-bottom: 20rpx;">
  100. <view style="width: 100%;display: flex;font-size: 24rpx;">
  101. <view @click="shoppingCart"
  102. style="width: 25%;display: grid;justify-items: center;padding: 10rpx 0;border-right: 1rpx solid #ccc;">
  103. <u-icon name="shopping-cart"></u-icon>
  104. <view>购物车</view>
  105. </view>
  106. <view @click="placeAnOrder" v-if="form.inventory > 0"
  107. style="width: 75%;background-color: #fd4b09;display: grid;justify-items: center;">
  108. <u-icon name="checkmark" color="#fff"></u-icon>
  109. <view style="color: #fff;">加入购物车</view>
  110. </view>
  111. <view @click="soldOut" v-else
  112. style="width: 75%;background-color: #969696;display: grid;justify-items: center;">
  113. <u-icon name="close" color="#fff"></u-icon>
  114. <view style="color: #fff;">已售罄</view>
  115. </view>
  116. </view>
  117. </view>
  118. <u-picker :show="showWarehouse" :columns="columns" :keyName="keyName" @confirm="confirmWarehouse"
  119. @cancel="showWarehouse = false"></u-picker>
  120. </view>
  121. </template>
  122. <script>
  123. import {
  124. appDetail,
  125. addToCart,
  126. appModifyPrice
  127. } from '@/api/tabBar/home.js'
  128. export default {
  129. data() {
  130. return {
  131. checkboxValue:[],
  132. form: {
  133. shareList: []
  134. },
  135. arrow:false,
  136. dataList: [],
  137. screen: {},
  138. columns: [],
  139. keyName: '',
  140. showWarehouse: false,
  141. dataForm:{
  142. thisLocality:{},
  143. offsite:{}
  144. }
  145. }
  146. },
  147. onLoad(onLoad) {
  148. appDetail(onLoad).then(res => {
  149. this.dataForm = res.data
  150. if(res.data.type == 0){
  151. this.form = res.data.thisLocality
  152. }else{
  153. this.form = res.data.offsite
  154. }
  155. this.form.goodsNum = Number(this.form.goodsNum)
  156. })
  157. },
  158. methods: {
  159. soldOut() {
  160. uni.showToast({
  161. icon: "none",
  162. title: '商品已售罄',
  163. mask: true
  164. });
  165. },
  166. backToHome() {
  167. uni.$u.route({
  168. url: 'pages/tabBar/home',
  169. type: "switchTab"
  170. })
  171. },
  172. placeAnOrder() {
  173. uni.showLoading({
  174. title: '加载中',
  175. mask: true
  176. });
  177. addToCart({
  178. ...this.form,
  179. detailsText: ''
  180. }).then(res => {
  181. uni.showToast({
  182. title: "加入购物车成功",
  183. icon: "none",
  184. mask:true
  185. });
  186. uni.hideLoading();
  187. }).catch(err => {
  188. uni.hideLoading();
  189. })
  190. },
  191. filterAll(screen) {
  192. this.screen = screen
  193. switch (screen[1]) {
  194. case "salesCompanyId":
  195. this.columns = [this.form.shareList]
  196. this.keyName = screen[1]
  197. this.showWarehouse = true
  198. break
  199. }
  200. },
  201. confirmWarehouse(e) {
  202. appModifyPrice({
  203. id: e.value[0].id
  204. }).then(res => {
  205. this.form.salesCompanyName = e.value[0].salesCompanyName
  206. this.form.salesCompanyId = e.value[0].salesCompanyId
  207. this.form.mallPrice = res.data.mallPrice
  208. this.form.inventory = res.data.inventory
  209. this.showWarehouse = false
  210. })
  211. },
  212. groupChange(val){
  213. console.log(val)
  214. if(val == 0){
  215. this.form = this.dataForm.thisLocality
  216. }else{
  217. this.form = this.dataForm.offsite
  218. }
  219. },
  220. shoppingCart() {
  221. uni.$u.route({
  222. url: 'pages/tabBar/shoppingCart',
  223. type: "switchTab"
  224. })
  225. }
  226. }
  227. }
  228. </script>
  229. <style scoped>
  230. /* page {
  231. background-color: #f2f2f2 !important;
  232. } */
  233. .head {
  234. width: calc(96% - 40rpx);
  235. margin: 0 auto;
  236. background-color: #FFFFFF;
  237. margin-top: 20rpx;
  238. border-radius: 20rpx;
  239. padding: 10rpx 20rpx 10rpx 20rpx;
  240. }
  241. .contentBox {
  242. width: 96%;
  243. margin: 20rpx auto;
  244. background-color: #FFFFFF;
  245. border-radius: 20rpx;
  246. /* box-shadow: 0 5rpx 14rpx 0 rgba(101, 176, 249, 0.42); */
  247. padding-top: 15rpx;
  248. padding-bottom: 10rpx;
  249. }
  250. .textBox {
  251. padding: 0 15px;
  252. display: flex;
  253. justify-content: space-between;
  254. font-size: 24rpx;
  255. margin-bottom: 10rpx;
  256. align-items: flex-end;
  257. }
  258. </style>